Flash Programmer for Kinetis will not program Flash Configuration Field on K40

cancel
Showing results for 
Search instead for 
Did you mean: 

Flash Programmer for Kinetis will not program Flash Configuration Field on K40

909 Views
ride
Contributor I

I created a Flash Programmer for Kinetis task with an Erase (whole device) and Program task for programming the PFlash in memory range 0x0 - 0x0003FFFF.  Security is Enabled in the programming file Flash Configuration Field.  The Verify fails when programming the Flash Configuration Field at 0x00000400.  If I turn off the verify operation the process will complete, but when I read out the Flash Configuration Field contents they are not equivalent to what is specified in the programming file.

The programming file srecord is:

 

S31500000400FFFFFFFFFFFFFFFFFFFFFFFF7FFDFFFF

When I dump out what was programmed:

 

S32500000400FFFFFFFFFFFFFFFFFFFFFFFF7EFDFFFF

What is interesting is that it looks like FDPROT register is the reason for failing.  But after programming and rebooting security is not enabled.  I can do a Flash Memory dump again.  But it looks from what I can tell is that the Flash Configuration Fields are configured for Security to be enabled.

The real ugly mess is that I can use a debugger launch configuration to program the ELF output for the same S19 programming file and if I answer "No" to the 2 Device is Secure - Erase to Unsecure prompts after the program has been downloaded, I can reboot and Security is enabled and the Flash Memory dump provides the Device is Secure - Erase to Unsecure prompt.

I want to use a Flash Programmer for Kinetis Task, as I have a separate S19 file for programming in a Serial Number to a Data Flash memory location.  I want to do this only once in life of the product at production time and do not want any way lingering in code to be able to rewrite the Serial Number.  It seemed to me to be an easier process to edit a 1 line S19 record file with each unique Serial Number and then program the device without having to edit the Application S19 file.

I am running CodeWarrior 10.3.

Thanks for any help on this issue.

Labels (1)
0 Kudos
3 Replies

139 Views
mjbcswitzerland
Specialist V

Hi

It may be that CW.x is not allowing you to set the secure state (SEC in FTFL_FSET != 0x02). For production programming it may be best to use an EZPORT tool.

If you want to add a serial number which should never be changed (in fact can never be changed) why not use the Program Once Field (64 bytes of user programmable data which can never be changed once written).

Regards

Mark

139 Views
ride
Contributor I

Thanks for the response.

There must be some difference between the Debugger tool programming and the Flash Programming Task where the Debugger tool is able to write to the Flash Configuration Field at 0x00000400 and the Flash Programming Task is not. I setup the Flash Programming Task to use the same Run Configuration as the Debugger.  I just haven't been able to figure out what the Debugger is doing different that it is able to enable the Security in the Flash Configuration Field, but after setting up a Flash Programming Task using the same Run Configuration is not able to enable Security in the Flash Configuration Field.

The serial number format may need to be changed per customer specs and I wanted to reserve a memory area for it where it can be reprogrammed to meet customer requirements.  I didn't want the application with a user interface that provides access to modifying the serial number.

I worked around this programming issue, by creating the user interface and only enabling the user interface to the serial number editing when the memory area is erased.  This just forces a manual editing of the serial number on the production line rather than being able to automate the process more programmatically.  For now, not too big of a deal with lower volumes.

0 Kudos

139 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

I checked with CodeWarrior team that if customer use embedded [Flash file to Target] tool, it recommend to set FTFL_FSEC[SEC] bit to 0b00 instead of 0b11 to secure MCU.

As you know Flash memory change '1' to '0' is ok, while change '0' to '1' need erase then program.

Kinetis MCU shipped to customer with MCU security status is unsecure, FTFL_FSEC[SEC] bit is 0b10.

I tried to program Flash address 0x40C with value 0x7C success with [Flash file to Target] tool.

You can try it on your site.

Wish it helps.

0 Kudos