AnsweredAssumed Answered

MPC5674 Data written to flash not going to correct address

Question asked by Ross Myers on Jun 14, 2015
Latest reply on Jun 15, 2015 by Ross Myers

Hi All,

 

I have a strange issue, using an MPC5674 in VLE mode, when I write data to the 4Mb internal flash (not external flash) where I am intending it to be written is not where it is getting written.

 

Actual Address in red

000B8000 000B8004 000B8008 000B800C 000B8010 000B8014 000B8018 000B801C << Actual address in Flash

000B8010 000B8014 000B8008 000B800C FFFFFFFF FFFFFFFF 000B8018 000B801C << Data should have been written to this address

 

So what I set up was I just had a loop that incremented the write to address by 8 in total, wrote 2 x 4 bytes as per the rules of this flash and this is what I've ended up with.

Essentially all it is doing to writing the address value to the actual address in flash I am writing to. Eg, load address 0xB8000 and write that value to 0xB8000, then load address 0xB8004 and write that value to 0xB8004 and so on.

The first one, I was writing to address 0xB8000, but what was actually written was 0xB8010 meaning that data should have been written to 0xB8010, but it ended up at address 0xB8000 in the flash.

Then on the 0xB8010 and 0xB8014 in the flash there was nothing written at all (it should have contained the values 0xB8010 and 0xB8014) that is a mystery too.

 

This was the test code I ran (if it makes more sense than my description) - r8 was preloaded with 0xB8000.

 

e_li  r11,0
add   r11,r11,r8             ; Get address to write to
e_stw r11,0(r8)              ; Write address value to flash
e_addir8,r8,4                ; Increment write address for next pass
e_li  r11,0
add   r11,r11,r8             ; Get address to write to
e_stw r11,0(r8)              ; Write address value to flash
e_addir8,r8,4                ; Increment write address for next pass

 

This problem only happens on addresses above 0xA0000, eg if I write to address 0x90010 then the data is written to 0x90010, above 0xA0000 if I write to 0xA0010 the data ends up at 0xA0000.

Can anyone please give me a hint as to why the address I am telling the CPU to write to is not where the data ends up once above 0xA0000.

 

Thanks.

Outcomes