I wonder whether anyone can explain why the Flash on my FRDM-K22F board won't program using the phrase program command?
When I run the same programming code on my FRDM-K64F it works normally.
This is what I do and see:
1. The FSTAT is at 0x80 (CCIF and ready)
2. I prepare for phrase programming (eg. programming 0x00000000 0x00000000 to 0x10000)
- FTFL_FCCOB0 = 0x07 (phrase programming command)
- FTFL_FCCOB1 = 0x01 [three bytes for the address 0x10000]
- FTFL_FCCOB2 = 0x00
- FTFL_FCCOB3 = 0x00
- FTFL_FCCOB4 = 0x00 [8 data bytes]
- FTFL_FCCOB5 = 0x00
- FTFL_FCCOB6 = 0x00
- FTFL_FCCOB7 = 0x00
- FTFL_FCCOB8 = 0x00
- FTFL_FCCOB9 = 0x00
- FTFL_FCCOBA = 0x00
- FTFL_FCCOBB = 0x00
3. The command is issued and FSTAT is 0xa0 (access error - bad address, wrong flash mode or protected)
The flash config is
ff ff ff ff ff ff ff ff ff ff ff ff fe ff ff f (that is, unsecured and no protection).
The address 0x10000 is phrase aligned and in flash so I haven't been able to work out why it is not working (all other K parts supporting phrase programming are Ok with the identical code and sequence).