Part Number: AM62P
Hi TI Team,
We are working on configuring UDMA ring buffers for UART on the AM62P Cortex-R5 core, and we ran into a behavior we hope you could help us clarify.
Observation & Debug Logs
When we place the ring memory in external DDR (0x93000000 region), Udma_ringAlloc() fails during Sciclient_rmRingCfg():
MCU_R5FSS0_0: [UDMA] ring cfg addr_lo=0x93000000 addr_hi=0xffffffff
MCU_R5FSS0_0: ERROR: Udma_ringAlloc:190: [UDMA] Ring config failed!!!
MCU_R5FSS0_0: ERROR: Udma_chAllocResource:2554: [UDMA] FQ ring alloc failed!!!
However, when the ring memory resides in MSRAM (0x79101200), the configuration succeeds:
MCU_R5FSS0_0: [UDMA] ring cfg addr_lo=0x79101200 addr_hi=0x00000000
My Analysis
Looking into udma_utils.c, Udma_defaultVirtToPhyFxn() performs a direct cast:
uint64_t Udma_defaultVirtToPhyFxn(const void *virtAddr, uint32_t chNum, void *appData)
{
return ((uint64_t) virtAddr); // Direct cast from 32-bit void* to uint64_t
}
Our understanding is that on a 32-bit architecture, casting a const void * directly to uint64_t when Bit 31 is set (e.g., DDR addresses starting above 0x80000000) might trigger integer sign-extension depending on compiler behavior. This results in physBase becoming 0xFFFFFFFF93000000, causing addr_hi to be set to 0xFFFFFFFF.
When we modified the function locally to cast through uintptr_t first:
return ((uint64_t)(uintptr_t)virtAddr);
addr_hi becomes 0x00000000 for DDR addresses, and Udma_ringAlloc() passes cleanly.
Could you help confirm if our analysis regarding the sign-extension is correct, or if we might be misinterpreting how virtToPhyFxn is intended to be configured for DDR addresses on 32-bit cores?
We would greatly appreciate your guidance and insights on this.
Regards,
Wei Han