AnsweredAssumed Answered

How to debug K22 flash controller

Question asked by Kenneth Tait on Jul 7, 2016
Latest reply on Nov 15, 2016 by Alberto Lubeiro

I have my custom K22 bootloader working from end to end, except it refuses to actually flash any bytes.

Erase comes back ok, as I would expect on a fresh load, but the FLASHprogramlongs() command always returns a fail.

I modified the linker file and flash_config area setup because original did not accomodate a 1M part. Each protect bit is 32k, so I moved the app start vector to 0x8000 and adjusted everything accordingly.

 

I don't see any protection bits enabled, so don't think this is the problem.

I'm guessing it has something to do with clocks or wait states?

We are using an external xtal, 8.00mhz clocked up to 20.9 mhz. clock rail to FTFE is enabled.

anyone know what I can check or is there something else that needs to be set up?

 

This is a pretty complicated flash controller and I see lots of workarounds for various parts in the original bootloader source I started with..

 

If i run this on the debugger does debugging do something to prevent flash operation?

 

Thanks

Ken

Outcomes