- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Cypress,
I would really appreciate some help with an issue I have on addressing a UART resource in the SCB4 block.
The UART is configured using the Device Configurator which also generates code for it.
Seems like I do not register the interrupt correctly as the MCU throws a "cannot address memory" error when
Cy_SCB_UART_Interrupt(scb_4_HW, &uartContext); is called.
I have not found any working example that uses an UART configured with the Device Configurator. Any idea on how to
correctly address this resource ? Could be that scb_4_HW, which is generated by the Configurator, is not the correct
address to reach the configured UART ?
Thanks for any hints
Stefan
Solved! Go to Solution.
- Labels:
-
PSoC 6 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The UART configured in the Device Configuration including respective pins make a successful cyhal_uart_init (as well using the PDL API) impossible as the pins will be reserved. Need to disable the pins, at least, in the Device Configurator. But leave them named. These names can then be used to successfully init the UART with any of the APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Stefan,
Cy_SCB_UART_Interrupt(scb_4_HW, &uartContext); should have worked once SCB4 has been configured. Make sure you are not using any aliases. If yes try the code as below.
Cy_SCB_UART_Interrupt(SCB4, &uartContext);
Meanwhile I am adding below PDL documentation interrupt section for your reference.
Configure Interrupt
The interrupt is optional for the UART operation. To configure interrupt the Cy_SCB_UART_Interrupt function must be called in the interrupt handler for the selected SCB instance. Also, this interrupt must be enabled in the NVIC. The interrupt must be configured when High-Level API will be used.
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vasanth,
do you by any chance know how to change the LSB First to MSB First for the cy_retarget_io_uart_obj ?
I was able to get that to work with P8_0 and P8_1 oft the Wifi BT Kit.
Thanks
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Vasanth, I found the source of the problem now. Even using the high level api I cannot use an UART in SCB4 which I have configured in Device Configurator:
/* Initialize the UART configuration structure */
const cyhal_uart_cfg_t uart_config =
{
.data_bits = DATA_BITS_8,
.stop_bits = STOP_BITS_1,
.parity = CYHAL_UART_PARITY_NONE,
.rx_buffer = rxBuffer,
.rx_buffer_size = UART_RX_BUFFER_SIZE
};
rslt = cyhal_uart_init(&uart_obj, CYBSP_UART1_TX, CYBSP_UART1_RX, NULL, &uart_config);
if(rslt != CY_RSLT_SUCCESS)
{
handle_error();
}
This code fails because the pins are already reserved by the Device Configurator. If I undefine the pins and UART in device configurator then at least the cyhal_uart_init works. However, I need to be able to configure also the MSB_first which I cannot set in the uart_config above.
Would you please provide me with
an example on how to initialize and use an UART which is configured through the device configurator ?
Is the call to cyhal_uart_init unnecessary ? If yes, how do I then address the uart in e.g. cyhal_uart_write ?
Thank you very much for any help
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The UART configured in the Device Configuration including respective pins make a successful cyhal_uart_init (as well using the PDL API) impossible as the pins will be reserved. Need to disable the pins, at least, in the Device Configurator. But leave them named. These names can then be used to successfully init the UART with any of the APIs