AnsweredAssumed Answered

K60/K20 flash programming - reg access to ftfl

Question asked by Richard Laplante on Sep 14, 2012
Latest reply on Sep 15, 2012 by Mark Butcher

I am working on a fw updater for the internal flash on two boards, one based on a K60 and the other a K20.  IAR embedded workbench is the toolset.


On the K20 board - bare metal <no operating system> The first thing that happens when I attempt to execute a flash command (I have tried read 1s section and erase) is that when I write to the FSTAT (0x40020000) to cause command execution (parameters previously written to the FCCOB registers), from a RAM copy of the flash command execution code), the processor goes to a hard fault handler.


I thought this was due to having interrupts enabled in the FCNFG register (and not having installed an interrupt handler for it), but this is not the case.(The IE bits in FCNFG are == 0)


I decide to observe the flash operations on the K60 board (running MQX) to verify that I had the method and sequence of operations correct, so I rebuilt the bsp with flashx driver and added an _io_open(), _io_write() and_io_read() for the flash driver in my main.


The flash driver successfully erases a sector, programs 0x800 bytes (using 32-bit flash writes) and all looks good.


The surprise to me is that when I add a few lines of register writes/reads to the main (to verify that I can set the values in the ftfl registers), the writes do not work at all on the first three regs (FSTAT, FCNFG, FSEC). In this environment, there is no bus error or fault occurring, just that the writes do not have effect.


I'm not sure what I missed here, because the other  registers in that space are writable (FCCOBn).