MB9BF518S, internal flash, re-programming alreay programmed flash word ends in a crash

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EmBu_2547871
Level 1
Level 1
First reply posted First question asked

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" ?

0 Likes
4 Replies
HolgerW_56
Employee
Employee
25 solutions authored 10 sign-ins 5 sign-ins

Hi,
I assume this is because the flash memory has a built-in ECC (Error Correction Code) functionality.

See the Flash Programming Manual

https://www.cypress.com/design-guides/fm3-family-cy9b110t210t310t410t510t610t-series-flash-programmi...

"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

0 Likes

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

0 Likes

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

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

0 Likes