- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An erased word in internal flash has the value 0xFFFF_FFFF. Programming this word to e.g. 0x2B11687B is NO problem.
Re-Programming this word from 0x2B11687B to 0x2B01687B ends in a crash.
The flash programming steps are:
1. set FASZR = b01 = 16-bit read/write (CPU programming mode), followed by dummy read of FASZR
2. write 1550, 0AA8, 1550 / program word / wait bits DPOL and TLOV
3. set FASZR = b10 = 32-bit read (CPU ROM mode: Initial value), followed by dummy read of FASZR
When "re-Programming this word from 0x2B11687B to 0x2B01687B" at step "3. set FASZR = b10" the software crashes.
The unsatisfying workaround is:
0. check word in flash != 0xFFFF_FFFF
1. set FASZR = b01 = 16-bit read/write (CPU programming mode), followed by dummy read of FASZR
2. write 1550, 0AA8, 1550 / program word / wait bits DPOL and TLOV
3. if "word in flash != 0xFFFF_FFFF" then perform a software reset. Prevents from crash at "3. set FASZR = b10".
Question : How to prevent the crash at "3. set FASZR = b10" ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I assume this is because the flash memory has a built-in ECC (Error Correction Code) functionality.
See the Flash Programming Manual
"Because ECC bits are added in this series, writes are always required to be performed in units of 32 bits by using two 16-bit writes. See Section "1.3.4 Writing to Flash Memory in Products Equipped with ECC" for details on the procedure."
Regards,
Holger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have checked the above attached c source code in flash.c against "1.3.4 Writing to Flash Memory in Products Equipped with ECC" .
The steps 1-8 are implemented as described in the mentioned chapter.
At step "9.Switch to CPUROM mode. Set the flash access size setting to 32 bits.(FASZR: ASZ="10") " the software crashes.
Any idea why?
Best regards
Emanuel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Emanuel,
sorry for the confusion ...
ECC Flash Memory requires two 16-bit writes (see above)
Additionally, because of ECC code stored by first write access a bitwise manipulation cannot be performed afterwards (as this would have impact on the ECC code already written previously by first write access)
Bitwise manipulation is only possible on FLASH memory without ECC.
Regards,
Holger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Holger
The influence of the ECC i have understood.
Out of application reasons the half word has to be re-programmed / bit-manipulated.
Is there any known workaround to prevent a crash?
Best Regards,
Emanuel