Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
brandiware
Level 4
Level 4
First like given 25 sign-ins 5 solutions authored

Hello Cypress,

I get a CYHAL_UART_RSLT_ERR_INVALID_PIN error result from calling

 

  /* Initialize the UART Block */

  rslt = cyhal_uart_init(&uart_obj, CYBSP_UART1_TX, CYBSP_UART1_RX, CYPSP_UART1_CLK_HW, &uart_config);

  if(rslt != CY_RSLT_SUCCESS)

  {

      handle_error();

  }

 

The pins are named just like this in the Device Configurator. Seems like I am having trouble allocating the resources correctly.

Or there is some well hidden syntax when naming pins or clocks ?

Debugging gets me down to CYHAL_HWMGR_RSLT_ERR_INVALID from the CYHAL_HWMGR. I have made the P8_0 and

P8_1 pins available as they are used in the PSoC 6 WIFI-BT Pioneer Kit - had to remove a resistor and to add two 0Ohms as explained in the kit documentation.

Any help is appreciated.

Regards

Stefan

0 Likes
1 Solution
brandiware
Level 4
Level 4
First like given 25 sign-ins 5 solutions authored

Hi Aashita,

yes -  I figured that out. I had the UART and the pins configured in the Device Configurator and tried to do a 

cyhal_uart_init in order to get a reference to the uart obj.

Still I cannot get to use the UART in code. I want to fully configure it in the Device Configurator and then use it. How do I address it then ? I need a reference to the uartobj in

rslt = cyhal_uart_write(&LID_UART_obj, (void*)txBuffer, &txBuffer_length);

but the one I found in the generated source ie. LID_UART_obj is not the correct reference.

Do I need to initialize the UART in my code ?

 

Best Regards

Stefan

View solution in original post

0 Likes
3 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @brandiware ,

Can you please let us know if you have enabled the UART pins or same UART instance in the device configurator? If this is the case, HAL will assume that the resources are occupied and you may end up getting such errors.

Best Regards,

Aashita

0 Likes
brandiware
Level 4
Level 4
First like given 25 sign-ins 5 solutions authored

Hi Aashita,

yes -  I figured that out. I had the UART and the pins configured in the Device Configurator and tried to do a 

cyhal_uart_init in order to get a reference to the uart obj.

Still I cannot get to use the UART in code. I want to fully configure it in the Device Configurator and then use it. How do I address it then ? I need a reference to the uartobj in

rslt = cyhal_uart_write(&LID_UART_obj, (void*)txBuffer, &txBuffer_length);

but the one I found in the generated source ie. LID_UART_obj is not the correct reference.

Do I need to initialize the UART in my code ?

 

Best Regards

Stefan

0 Likes
brandiware
Level 4
Level 4
First like given 25 sign-ins 5 solutions authored

Hi Aasihita,

I have now realized that the call to initialize the configured devices

init_cycfg_all();

was missing.

Now I only need to know ? how to get the address of the uartObj ? from the configured UART for

cyhal_uart_write(cyhal_uart_t *obj, void *tx, size_t *tx_length);

Is cyhal_uart_init still needed to get the object reference ? If so, what parameters to pass to avoid the above

errors ?

Thanks in advance for any help on this.

Regards

Stefan

0 Likes