Part Number: AM2434
Other Parts Discussed in Thread: SYSCONFIG,
I would like to report what appears to be a SysConfig code-generation issue on AM2434 when using two UART instances configured in DMA mode.
Issue summary
When SysConfig is configured with two UART instances in DMA mode, the generated initialization code assigns the same dmaChCfg to both UART instances. As a result, both UARTs end up referencing the same DMA channel configuration structure.
Expected behavior
Each UART instance should be generated with its own dmaChCfg assignment (e.g., gUartDmaChCfg[CONFIG_UARTx]), so that DMA resources are unique per instance.
Observed behavior
Both UART instances are initialized with the same dmaChCfg pointer in the generated code.
Workaround
To avoid the faulty generated initialization, I do not call Drivers_open() (and therefore avoid Drivers_uartOpenLld()), and instead:
- call the required Drivers_* open functions manually
-
manually initialize each UART and correct the dmaChCfg assignment before calling UART_lld_initDma().
Below is an excerpt from my main.c after System_init()/ Board_init():
/* ============================================== Open drivers ==============================================
* WARNING!! Cannot use Drivers_open(); function generated from TI due to a SysConfig generation bug
* when you use more than a UART with DMA like in this case TI assign the same dmaChCfg to all the UARTs
* see the lines below with the "FIX TI" comments.
* if you edit the SysConfig remember to update this section accordingly
*/
Drivers_firewallOpen();
Drivers_udmaOpen();
gUartHandleLld[CONFIG_UART0] = &gUartObject[CONFIG_UART0];
gUartHandleLld[CONFIG_UART0]->state = UART_STATE_RESET;
gUartHandleLld[CONFIG_UART0]->baseAddr = CSL_UART0_BASE;
gUartHandleLld[CONFIG_UART0]->hUartInit = &gUartInitObject[CONFIG_UART0];
gUartHandleLld[CONFIG_UART0]->hUartInit->dmaChCfg = (UART_DmaChConfig) &(gUartDmaChCfg[CONFIG_UART0]); // FIX TI
status = UART_lld_initDma(gUartHandleLld[CONFIG_UART0]);
DebugP_assert(status == UART_STATUS_SUCCESS);
gUartHandleLld[CONFIG_UART_SIMPLE_LOG] = &gUartObject[CONFIG_UART_SIMPLE_LOG];
gUartHandleLld[CONFIG_UART_SIMPLE_LOG]->state = UART_STATE_RESET;
gUartHandleLld[CONFIG_UART_SIMPLE_LOG]->baseAddr = CSL_UART5_BASE;
gUartHandleLld[CONFIG_UART_SIMPLE_LOG]->hUartInit = &gUartInitObject[CONFIG_UART_SIMPLE_LOG];
gUartHandleLld[CONFIG_UART_SIMPLE_LOG]->hUartInit->dmaChCfg = (UART_DmaChConfig) &(gUartDmaChCfg[CONFIG_UART_SIMPLE_LOG]); // FIX TI
status = UART_lld_initDma(gUartHandleLld[CONFIG_UART_SIMPLE_LOG]);
DebugP_assert(status == UART_STATUS_SUCCESS);
It would be great if this could be fixed in a future SysConfig/SDK revision.
Development environment
- MCU+ SDK: 11.00.00.15
- Compiler: TI ARM CLANG 4.0.4 LTS
- SysConfig: 1.26.0
- CCS: 20.40
- Device: AM2434 (Cortex-R5F_0-0)