This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: ESM Group 3 error (RAM ECC) when using stack in startup but not on other RAM access - why?

Part Number: TMS570LC4357

Hello,

I am seeing the following problem. When the lines in orange are added, a variable is placed on the stack and an ECC error is thrown. However, I have also modified memInit to perform similar accesses, which do not cause any problems. My question boils down to "why are these different to the ECC checking functionality in the chip?" I will include the changes to HL_sys_startup.c and the changes to HL_sys_core.asm

HL_sys_startup.c placed below with mods in orange, some body is skipped/replaced with ellipsis (...) after the code in question to show the ESM group 3 notification check at the end, which is what brought this to my attention:
```

void _c_int00(void)
{
register resetSource_t rstSrc;
/* USER CODE BEGIN (5) */
/* USER CODE END */

/* Initialize Core Registers to avoid CCM Error */
_coreInitRegisters_();

/* Initialize Stack Pointers */
_coreInitStackPointer_();

/* Reset handler: the following instructions read from the system exception status register
* to identify the cause of the CPU reset.
*/
rstSrc = getResetSource();

uint32_t *reset_cause = (uint32_t *)RESET_CAUSE;

*reset_cause = (uint32_t)rstSrc;

switch(rstSrc)
{
default:

/* Initialize L2RAM to avoid ECC errors right after power on */
_memInit_();

...

_coreEnableEventBusExport_();

/* USER CODE BEGIN (10) */
/* USER CODE END */

/* Check if there were ESM group3 errors during power-up.
* These could occur during eFuse auto-load or during reads from flash OTP
* during power-up. Device operation is not reliable and not recommended
* in this case. */
if ((esmREG->SR1[2]) != 0U)
{
esmGroup3Notification(esmREG,esmREG->SR1[2]);
}

/* Initialize System - Clock, Flash settings with Efuse self check */
systemInit();
```

HL_sys_core.asm:
```

;-------------------------------------------------------------------------------
;Initialize RAM memory
;
; store the bootloader and application intercommunication objects into
; CPU registers to avoid getting erased by the memory initialization
; routine required for ECC

.def _memInit_
.asmfunc

_memInit_

ldr r0, INTERCOM ;Load INTERCOM (address) to r0
ldr r6, [r0, #0] ;Save INTERCOM into a register
ldr r7, [r0, #4] ;Save RESET_CAUSE into a register
ldr r8, [r0, #8] ;Save UPDATE_STATUS into a register
ldr r9, [r0, #12] ;Save VECTOR_TABLE_PTR into a register
ldr r12, MINITGCR ;Load MINITGCR register address
ldr r12, MINITGCR ;Load MINITGCR register address
mov r4, #0xA
str r4, [r12] ;Enable global memory hardware initialization

ldr r11, MSIENA ;Load MSIENA register address
mov r4, #0x1 ;Bit position 0 of MSIENA corresponds to SRAM
str r4, [r11] ;Enable auto hardware initalisation for SRAM
mloop ;Loop till memory hardware initialization comletes
ldr r5, MSTCGSTAT
ldr r4, [r5]
tst r4, #0x100
beq mloop

mov r4, #5
str r4, [r12] ;Disable global memory hardware initialization
str r6, [r0, #0] ;Put the INTERCOM back
str r7, [r0, #4] ;Put RESET_CAUSE back
str r8, [r0, #8] ;Put UPDATE_STATUS back
str r9, [r0, #12] ;Put VECTOR_TABLE_PTR back
bx lr

INTERCOM .word 0x0807FFF0
RESET_CAUSE .word 0x0807FFF4
UPDATE_STATUS .word 0x0807FFF8
VECTOR_TABLE_PTR .word 0x0807FFFC
.endasmfunc
```

Why do the changes to HL_sys_startup.c cause an ESM group 3 (register reads 0x08) error but the changes to HL_sys_core.asm do not cause this error? It is very reproducible that from application of power, this error depends on the changes to HL_sys_startup.c. However, I cannot explain it because I would expect the changes to HL_sys_core.asm to be operating on memory at the same point in startup sequence. It may be worth noting that the change to HL_sys_startup.c does write to the stack before the new code in HL_sys_core.asm, but I cannot explain a write onto the stack causing an ECC error unless there are some other transactions going on.