Issue on Flash erase of MPC5748G

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue on Flash erase of MPC5748G

Jump to solution
977 Views
developer_newbie
Contributor III

Hello,

I have developed a program that erase flash and program new sw from srec file.

I am facing an issue when I test the following configurations:

1- Only 1 block is erased, the function pflashErase return correctly and my code continue executing normaly and I can program my flash with new program (but my need is erase whole wirteable blocks needed by my program)

//unlock all 
pSetLock(&ssdConfig, C55_BLOCK_LOW, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_MID, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_HIGH, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_256K_FIRST, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_256K_SECOND, 0x00000000);
//select blocks to erase
lowBlockSelect = 0x0;
midBlockSelect = 0x1;
highBlockSelect = 0x0;
n256KBlockSelect.first256KBlockSelect = 0x0;
n256KBlockSelect.second256KBlockSelect = 0x0;
returnCode = pFlashErase(&ssdConfig,
			C55_ERASE_MAIN,
			lowBlockSelect,
			midBlockSelect,
			highBlockSelect,
			n256KBlockSelect);

 2- with the following configuration, I can see in the debuger that all needed partitions are erased but the function pFlashErase does not return anything and it stay blocked and my program cannot continue executing (I can see that all needed blocks are erased when I reset board and stop execution on break point using ic5700 debuger)

//unlock all 
pSetLock(&ssdConfig, C55_BLOCK_LOW, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_MID, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_HIGH, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_256K_FIRST, 0x00000000);
pSetLock(&ssdConfig, C55_BLOCK_256K_SECOND, 0x00000000);
//select blocks to erase
lowBlockSelect = 0x0;
midBlockSelect = 0x40;
highBlockSelect = 0x0;
n256KBlockSelect.first256KBlockSelect = 0x000FFFFF;
n256KBlockSelect.second256KBlockSelect = 0x0;
returnCode = pFlashErase(&ssdConfig,
			C55_ERASE_MAIN,
			lowBlockSelect,
			midBlockSelect,
			highBlockSelect,
			n256KBlockSelect);

 

Have you an explanation for this behaviour and how to fix it ?

 

NOTE: for all cases I can execute pFlashProgram correctly

0 Kudos
Reply
1 Solution
967 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @developer_newbie 

this sounds like read-while-write (RWW) issue. Where the code is running from? Are you sure you do not access partitions which are being erased? Are interrupts disabled? In case of RWW issue, IVOR1 is triggered - can you see that? Do you have IVOR1 handler? Do you use watchdog? Do you feed the watchdog via callbacks?

Regards,

Lukas

View solution in original post

3 Replies
961 Views
developer_newbie
Contributor III

Hello @lukaszadrapa,

You are right I have tried to erase Range 0x014C0000-0x0153FFFF that it is reserved by bootloader so when I change 0xFFFFF by 0x7FFFF evrythings are ok now and erase is done correctly.

Thanks a lot for your support

0 Kudos
Reply
968 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @developer_newbie 

this sounds like read-while-write (RWW) issue. Where the code is running from? Are you sure you do not access partitions which are being erased? Are interrupts disabled? In case of RWW issue, IVOR1 is triggered - can you see that? Do you have IVOR1 handler? Do you use watchdog? Do you feed the watchdog via callbacks?

Regards,

Lukas

965 Views
developer_newbie
Contributor III

The code is running from bootloader, the mapping of flash looks like following:
- FC0000- FC7FFF (32K, partition 0) for bootloader startup
- F90000- F93FFF (16K, partition 2) for the bootloader “EEPROM” area
- Zone F94000-FA7FFF reserved (not used)
- FA8000-FABFFF (16K, partition 3) for app startup
- Partitions 6 (2048K, range 1000000-11FFFFF) reserved for the m_text section of the Z4_0 core app.
- Partitions 7 (2048K, range 1200000-13FFFFF) reserved for the m_text section of the Z4_1 core app.
- Partitions 8 (768K, range 1400000-14BFFFF) reserved for the m_text section of the Z2_2 core app.
- Partition 9 reserved for the bootloader
* Range 0x014C0000-0x0153FFFF (256K) reserved (not used)
* Range 0x01540000-0x0157FFFF (512K) for m_text section of bootloader

As anwsers for your question :

interrupts is not disabled 

I don't know.  How can I see IVOR1? watchdog is not used 

The bootloader rest running and blocked on pFlashErase until I stop it via the debuger, when I stop it I got default ISR

DefaultISR:
e_b DefaultISR
.size DefaultISR, . - DefaultISR

developer_newbie_0-1672750595739.png

 

0 Kudos
Reply