ΣSigmaStudio Ask AI Русский Log in

Using UART2 vs UART0 with FREERTOS

Processors & DSP CIMSOR Jul 17, 2015 00:00 4 replies Original on forum ↗
Subscribe
CIMSOR Question
Jul 17, 2015 00:00

My project requires the use of UART2 (TX only) within the FREERTOS environment. I started with the FREERTOS UartCharEcho example. Very simple modifications while using UART0 work as expected. However when UART2 is selected, the program hangs at adi_uart_Write (line 274). The adi_pinmux.c was changed to allow UART2_TX. UartCharEcho was modified only to change Uart parameters and can easily be switched to UART0 or UART2 via define selection near top. Suggestions appreciated.

Thanks,

Bob

CIMSOR Reply
Jul 17, 2015 00:00

How foolish of me to forget the overhead information. I'm using the CM408EZ kit with a pin-probe board to connect to UART2 Tx. Code is from Analog Devices EZKIT release 2.0.0. Compiler is IAR ARM 7.4.

Bob

CIMSOR Reply
Aug 15, 2015 00:00

This issue has been resolved; but Analog Devices should be quite embarrassed. The solution can be found in their supplied file src/drivers/uart/adi_uart_data_cm40z.c where the UART2 information looks suspiciously like UART1. I'm not sure how UART2 was tested; but I now know how to make it work!

Bob

gvasanth Reply
Aug 26, 2015 00:00

Hi Bob,

Yes, there is a mistake in the driver adi_uart_data_cm40z.c wherein it fails to enable the UART due to the mistake in referencing to UART2.

Thus, libdrv40z.ewp (in the path ..\C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\libdrv40z) needs to be updated with the corrections to adi_uart_data_cm40z.c (shown below) and then rebuild.

static ADI_UART_INFO gUARTDevInfo[] =

{

/* UART 0 */

{

(volatile ADI_UART_REGS *)REG_UART0_CTL, /* First UART register address */

ADI_DMA_CHNL_UART0_TX,
/* UART0 Tx DMA Channel ID */

ADI_DMA_CHNL_UART0_RX,
/* UART0 Rx DMA Channel ID */

(uint32_t)INTR_UART0_STAT,
/* UART0 Status interrupt ID */

NULL
Pointer to UART device instance data */

},

/* UART 1 */

{

(volatile ADI_UART_REGS *)REG_UART1_CTL, /* First UART register address */

ADI_DMA_CHNL_UART1_TX,
/* UART1 Tx DMA Channel ID */

ADI_DMA_CHNL_UART1_RX,
/* UART1 Rx DMA Channel ID */

(uint32_t)INTR_UART1_STAT,
/* UART1 Status interrupt ID */

NULL
/* Pointer to UART device instance data */

},

/* UART 2 */

{

(volatile ADI_UART_REGS *)REG_UART2_CTL, /* First UART register address */

ADI_DMA_CHNL_UART2_TX,
/* UART2 Tx DMA Channel ID */

ADI_DMA_CHNL_UART2_RX,
/* UART2 Rx DMA Channel ID */

(uint32_t)INTR_UART2_STAT,
/* UART2 Status interrupt ID */

NULL
/* Pointer to UART device instance data */

};

Regards,

Guru

EZAdministrator Reply
Aug 2, 2018 00:00

This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Thank you,
EZ Admin