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.

TMS320F280021: After being Flashed, the Standalone Code does not boot/run without ERTM?

Part Number: TMS320F280021

Team,
The below is a follow up from this E2E post:
https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1123529/tms320f280021-standalone-code-not-running-without-ertm?tisearch=e2e-sitesearch&keymatch=TMS320F280021%252520boot%252520flash#
Can you please help to debug the behavior further?
The HW board has been checked against the HW design guide SPRACZ9 (like schematics recommendation like pull up/down, clk, rest timing, boot sequence, ..etc):

Because we write to the flash at runtime, the error in the boot sequence occurs during a POR or reset.
We write using Fapi_DataOnly, i.e. we do not generate an additional ECC (->Flash_disableECC(FLASH0ECC_BASE)).
If we write to the flash area without ECC at runtime, an uncorrectable flash error is detected in the boot sequence after the restart, because ECC is enabled again in f28002x_syctrl.c. The ECC is not enabled in the boot sequence.

ERTM or DBGM ensures that the NMI caused by a flash error is not serviced.
In the library file f28002x_syctrl.c, without ERTM the NMI is serviced and calls a reset, and the boot sequence stops because of an uncorrectable flash error.
In this case, our electronics no longer work.
As we understand it, ERTM ensures that the NMI is ignored in this case.


In our software for the TMS320F280021, we use a 1KB sector in the flash to store data. This sector is locked for uploading the source code. This also works. The programme sequence is as follows:
1. initialisation of the unit
2. ERTM (Enter Real Time Mode)
3. deactivation of ECC check
4. initialisation of the flash
5. normal operation in which data is written to the flash sector (without ECC calculation)
In this case, the electronics work perfectly even after writing to the flash sector.

Now we had found that if we run the software without the step 2, the MCU (software) will not boot after writing the flash in step 5.
So with the following steps:
1. initialisation of the device
2. (NO ERTM)
3. deactivation of ECC checks
4. initialisation of the flash
5. normal operation in which data is written to the flash sector (without ECC calculation)

We assume based on the document (TMS320F28002x Real-Time Microcontrollers Technical Reference Manual (Rev. A) 05 Oct 2020) -> Table 4-37. Boot Status Bit Fields) that we come to an NMI after step 20 "Flash Uncorrectable Error NMI occurred".
Since ECC is re-enabled by the Ti-base software during the initialisation of step 1.
InitSysCtrl()
    InitFlash()
       Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA;
And this NMI for an uncorrectable flash error prevents our F280021 board to boot again.
We can reproduce the problem in debug mode by doing the following:
1. performing steps 1-5
2. reboot
3. execute step 1
4. try to reboot -> but we only get an NMI

What we don't understand here is where it leads to this error.
The omission of ERTM means that the function Fapi_issueProgrammingCommand from the FlashAPI_F28002x library in connection with Fapi_DataOnly will always lead to a flash error when the flash is checked in the boot sequence.

Thus, the function is useless if the corresponding NMI is not suppressed.

Similarly, we do not understand why calling ERTM AFTER the first boot sequence leaves the electronics still functional after flashing the data and rebooting.
Is ERTM permanently stored in a POR? Or why do devices with ERTM boot anyway?
Are there other registers whose values must be ensured so that a device boots or have an influence on the boot process?

Thanks in advance,

A.