I am debugging the startup-code of the RM46L852ZWT compiled with HalCoGen Version 3.5.2.
In the File sys_selftest.c:
- CCM-test is started
- Then wait for test complete
- Then check, if CCM-Module has reported an error (line 54)
- Then check, if ESM-module has the error-flag "CCM-R4-self-test-failed" set (line 59)
This seems wrong to me. The flag must be zero, if there is no error.
I debugged this with a trick (see source code) and the result is, that after a sucessful CCM-test, the ccmFail(1U); will be called.
/* Configure CCM in self-test mode */
CCMKEYR = 0x6U;
/* Wait for CCM self-test to complete */
while ((CCMSR & 0x100U) != 0x100U)
{
}/* Wait */
/* USER CODE BEGIN (3) */
{
volatile char s=0;
while (s==0)
{
asm("nop"); // Start application without debugger, then login with debugger and set variable s to 1 to continue
}
}
/* USER CODE END */
/* Check if there was an error during the self-test */
if ((CCMSR & 0x1U) == 0x1U)
{
/* STE is set */
ccmFail(0U);
}
else
{
/* Check CCM-R4 self-test error flag by itself (without compare error) */
if ((esmREG->ESTATUS1[0U] & 0x80000000U) != 0x80000000U)
{
/* ESM flag is not set */
ccmFail(1U);
}
else
{
/* clear ESM group1 channel 31 flag */
esmREG->ESTATUS1[0U] = 0x80000000U;