2022-01-25 06:08 AM
Hello,
I am working on the bootloader, trying to flash only 256 bytes. So, before flashing, erasing the block 0xFF0000. There is already some data in this block. But erase is not happenin, even if FlashErase() returns 0 and FlashCheckStatus() also gives opResult=0. Also when I check memory, it still shows the same data and not erased.
Following below steps to get flash block erased-
#define LOWBLOCKSELECT 0x00000100U
#define MIDBLOCKSELECT 0x00000000U
#define HIGHBLOCKSELECT 0x00000000U
/* Unlock the requested block for Erase operation */
nLargeBlockSelect.firstLargeBlockSelect = 0;
nLargeBlockSelect.secondLargeBlockSelect = 0;
SetLock(&FLSHM_ssdConfig, C55_BLOCK_LOW, UNLOCK_ALL_BLOCKS);
irqIsrDisable();
/* Erase the requested block */
Return_Val = FlashErase(&FLSHM_ssdConfig, C55_ERASE_MAIN, LOWBLOCKSELECT, MIDBLOCKSELECT, HIGHBLOCKSELECT, nLargeBlockSelect);
if(Return_Val == C55_OK)
{
while(C55_INPROGRESS == FlashCheckStatus(&FLSHM_ssdConfig,
C55_MODE_OP_ERASE, &opResult, &FLSHM_eraseCtxData))
{}
/* Erase is in progress */
}
else
{
/* Erase failed */
}
irqIsrEnable();
Configuration for flash is as follows -
SSD_CONFIG FLSHM_ssdConfig = {
C55_REG_BASE, /* C55 control register base */
MAIN_ARRAY_BASE, /* base of main array */
{ 0, 0, 0 }, /* blocks info of low address space */
{ 0, 0, 0 }, /* blocks info of mid address space */
{ 0, 0, 0 }, /* blocks info of high address space */
0, /* number of blocks in 256K address space */
UTEST_ARRAY_BASE, /* base of UTEST array */
TRUE, /* interface flag indicate main or alternate interface */
256U,/* programmable size */
FALSE /* debug mode selection */
};
What could be the issue here?
Regards,
AM
2022-01-28 03:06 AM
OK
-Olivier
2022-01-28 04:04 AM
Hi Olivier,
Updated the remarks from point 2,
a)checked the returned value from SetLock
b)checked opResult value
But, same behaviour.
The execution is not halting at any of both ErrorTrap() and gets stuck in unhandled exception.
/* Unlock the requested block for Erase operation */
nLargeBlockSelect.firstLargeBlockSelect = 0;
nLargeBlockSelect.secondLargeBlockSelect = 0;
Return_Val = SetLock(&FLSHM_ssdConfig, C55_BLOCK_LOW, UNLOCK_ALL_BLOCKS);
if (C55_OK != Return_Val)
{
ErrorTrap(Return_Val);
}
/* Erase the requested block */
Return_Val = FlashErase(&FLSHM_ssdConfig, C55_ERASE_MAIN, LOWBLOCKSELECT, MIDBLOCKSELECT, HIGHBLOCKSELECT, nLargeBlockSelect);
if(Return_Val == C55_OK)
{
while(C55_INPROGRESS == FlashCheckStatus(&FLSHM_ssdConfig,
C55_MODE_OP_ERASE, &opResult, &FLSHM_eraseCtxData))
{}
if(opResult == C55_OK)
{
/* Erase is in progress */
FLSHM_CmdStat = FLSHM_SUCCESS;
}
else
{
/* Erase failed */
FLSHM_CmdStat = FLSHM_ERASEFAILED;
ErrorTrap(opResult);
}
}
else
{
/* Erase failed */
FLSHM_CmdStat = FLSHM_ERASEFAILED;
}
Warm Regards,
AM
2022-01-28 04:51 AM
Would you please show me your BOOT configuration in SPC58xGxx RLA Platform->runtime_settings ?
as example:
BRs,
-Olivier
2022-01-28 05:41 AM
Hi Olivier,
Here's the Platform RLA configuration (I dont have watchdog option in this)-
Watchdog is in clock RLA -
Warm Regards,
AM
2022-01-28 06:13 AM
Could you try this Load in RAM configuration ? (in runtime settings)
BRs,
-Olivier
2022-01-28 06:28 AM
Hi Olivier,
Great! This is erasing the flash successfully, even writing to flash is also working.
Could you tell me the reason for this?
Warm Regards,
AM
2022-01-28 06:32 AM
I am not 100% sure, I will check with Flash expert,
but I think you cannot erase a flash sector near to the one you are executing your own program.
0xFC_0000 and 0xFF_0000 are may be too closed from each other.
Load your program in RAM and executing from RAM, there is no more conflict
BRs,
-Olivier
2022-01-28 06:51 AM
Hi Olivier,
Sure, please check with the expert and let me know the reason for this.
'0xFC_0000 and 0xFF_0000 are may be too closed from each other.' - If so, I will check this scenario for different flash block then.
Also, loading the program in RAM should certainly have some limitations I suspect. Am I right?
Warm Regards,
AM
2022-01-28 06:55 AM
Sure I will provide confirmation as soon as I have all the information.
For load in RAM the program must fulfill into limited RAM size..
BRs,
-Olivier
2022-01-28 10:41 PM
Hi Olivier,
I tried flash erase for large blocks address space as -
nLargeBlockSelect.firstLargeBlockSelect = 0x01; //0x0100_0000
nLargeBlockSelect.firstLargeBlockSelect = 0x02; // 0x0104_0000
nLargeBlockSelect.firstLargeBlockSelect = 0x10; //0x010C_0000
But, seen the same result. Flash erase doesn't happen and control gets stuck in unhandled exception.
Warm Regards,
AM