Hello,
I am having difficulties using external SRAM memories (using EMIF) on the TMS570 MCU in FreeRTOS tasks. The problem appears as, from my point of view, various errors related to the memory which finally results in MCU stuck in aborts or simply incorrect behavior.
One of the more obvious error I've seen while debugging is in a function similar to:
void (void* x)
{
void* y;
y = x;
}
The SRAM is used as the stack, x points to a memory region on the SRAM and so does y. After some successful calls to this function, the assignment fails and the pointer y still has the value 0xA5A5A5A5 (as the stack is initialized to by FreeRTOS). If I add a dummy variable prior to this code, it never fails and the program works as expected (The program in this case is an LWIP web server example).
The following has been tested:
- Write and read to the entire SRAM, with MPU region set up both as device and normal. Successful.
- Lowering EMIF clock frequency. No difference.
- Raising EMIF clock frequency. Works in this special case but not in another part of the code. Indicates some kind of race condition?
Any advice or guidance on how to set up the memory region or what could cause this behavior is appreciated. Or tips on how to troubleshoot the memory accesses on the TMS570.
Thanks and regards
Mikael Rothin