Cannot program New MKL25Z128

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot program New MKL25Z128

Jump to solution
3,768 Views
OskarLG
Contributor I

Hello everybody,

This is my first time writting at the forum.I have been reading a lot but now I am in a problem no one seems to have been in. Here is my problem :

I bought two FRDM-KL25 boards and after testing several things i have made up a custom board. The idea was to use one of the boards as a USBDM-FRDM programmer.

I can program one board with another without problem, but I cannot program my board :smileyconfused:.

At the begginning I thought about hw problems (because of the different HW) and try several solutions:

  • Adding a serial resistor in the SWD_CLK line
  • Adding 100pF capacitor to the SWD_CLKand SWD_DIO lines
  • Powering the microcontroller with the reset signal low
  • Combinations of the above.

The results are always the same:

When programming-->> unable to read/confirm CHIP_ID,

When trying to Detect the CHIP_ID->> Device appears to be secured.... Unsecure and enterely erase?

When unsecuring-->>Failed to probe the target reason Target is secured

Finally I decided for the Hw solution ( yes i am a HW guy coming into SW) I desoldered the new chip and the one in the FRDM board and change them, soldering down the new chip into the FRDM board and the "old" into my custom board.So now i have now problem programming my board  :smileyhappy::smileyhappy:.no new problems the connections were ok so the problem was with the new chip. Tried again in another exactly equal custom board  with another new chip, same results.

Not only that but when I try to program my FRDM board with the new chip in, I am in the same situation.So it seems again that the problem appears with the new chips.

As I have read here in this forum(https://community.freescale.com/thread/309895 )

I have tried to use the TCL interpreter to found a solution, when i source the following script

openbdm 

settarget arm 

source devicedata/arm/Kinetis-KLxx-flash-scripts.tcl 

catch { connect }

rcreg  $::MDM_AP_Status

I get the following:

test_tcl.bmp

So it seems it is secured??? But it can be mass  erased...

When I try the massEraseTarget  I get:

pastedImage_4.png

.....so no luck.

I'm using the last USBDM version and I am lost ,no further ideas. What else can I try?

Its normal for a new device to be secured?

Thanks for your feedbacks,

Best Regards,

Oskar

0 Kudos
Reply
1 Solution
2,624 Views
pgo
Senior Contributor V

Follow-up to above:

I replaced the chip on a FRDM-KL25 with a new "factory fresh" chip.

It programmed and verified without any issue.

This being the case I can't see how I can diagnose and problems. - Sorry.

It would appear that a new chip is blank apart from the security value of 0xFE which makes it unsecured so AFAICS it would operate the same as a mass-erased chip.

The RESET behaviour was also the same (oscillating ~485mVp-p at 1.6ms period.

For reference the waveform for a blank device:

pastedImage_0.pngbye

bye

View solution in original post

0 Kudos
Reply
6 Replies
2,624 Views
pgo
Senior Contributor V

Hi Oskar,

I have programmed a number of Kinetis 'factory fresh' devices without any problem but not a KL25.

I have tested with mostly MK devices e.g. MK22, MK20 and these were OK.  The only "factory fresh" MKL devices devices were KL05 and these also didn't have any problems.

As before I have tried mass erasing some KL25s and confirmed that they were blank except for the security byte.  I have no trouble re-programming these or for that matter reading them to confirm that they were actually blank.

So I'm a bit stuck.  I will get some some new KL25s and see if I can re-produce the problem but it will be while.

bye

2,625 Views
pgo
Senior Contributor V

Follow-up to above:

I replaced the chip on a FRDM-KL25 with a new "factory fresh" chip.

It programmed and verified without any issue.

This being the case I can't see how I can diagnose and problems. - Sorry.

It would appear that a new chip is blank apart from the security value of 0xFE which makes it unsecured so AFAICS it would operate the same as a mass-erased chip.

The RESET behaviour was also the same (oscillating ~485mVp-p at 1.6ms period.

For reference the waveform for a blank device:

pastedImage_0.pngbye

bye

0 Kudos
Reply
2,624 Views
OskarLG
Contributor I

Hello PGO;

I have soldered a "really fresh" device from the same batch in the FRDM board and programmed and verified it without any issue.:smileyhappy:

So it seems that the previous chip get corrupted somewhere.

Summarizing the (SW) attempts with the first two devices in the order tried:

  1. Tried to program then with the mbed FW programmed in the K20... no success.
  2. Tried to program then with the USBDM FW programmed in the K20... no suceess.
  3. Read  the register with the TCL interpreter.... results above.
  4. Tried the OpenSDAMassEraseKinetis.sx Fw the USBDM (connecting and reconnecting power). Supossed to mass erase successfully but no succees.
  5. Retried to program then with the USBDM FW programmed in the K20... no success.

 

I have also read something in  the AN4835 page 10:

          Applying voltages to I/O pins when the processor is not powered. If the pin VDIO or VIO specifications are violated,

          the processor can attempt a partial power up and/or puts the flash into an undefined state. This can lead to corruption of

          flash contents, corruption of flash control logic, or corruption of device configuration and trim values which in turn can

          lead to the processor reporting as secured (locked device) or failure of the processor to respond to and complete flash

          commands.

So maybe this is the cause of corruption......


So the next thing to try is a "really fresh" device in my custom board with USBDM-FRDM programmer to see if the behaviour is the same.

Oskar


Just to know, the fresh device gave me the following status,----> not secured.

usbdm_int_fresh.JPG.jpg

The RESET behaviour was similar oscillating ~500mVp-p at 1.33ms period.

NewFile0.png

0 Kudos
Reply
2,624 Views
OskarLG
Contributor I

Hello PGO;

A bit late but finally done. A " fresh" device  was soldered in my custom board and programmed with USBDM-FRDM programmer to see if the behaviour was the same.

It was.

So I must left the first problem as a "Uc flash corruption somewhere". Maybe the  mbed programmer with a blank chip, don´t know.Will start with the USBDM next time.

Thanks.

Oskar

0 Kudos
Reply
2,624 Views
OskarLG
Contributor I

Hello PGO and thanks for your efforts,


I am going to try with another "factory fresh" device soldered in a FRDM board. Maybe the last one was not really fresh but corrupted in a previous try-to-program  in my custom board (??).

I will tell you as soon as possible.

0 Kudos
Reply
2,623 Views
gibbon1
Contributor III

The firmware in the FRDM-K25Z128 dev boards are locked so you can't program anything other than another FRDM-KL25Z128.

Try looking here, I you can reprogram the K20 on the FRDM-KL25Z128 so that it will work with other boards/processors.

USBDM: USBDM-FRDM - USBDM Debugger based on Freescale FRDM-xxxx board

You can also buy a CooCox CoLinkEx from Farnell $30 and this adapter

http://www.adafruit.com/products/2094?gclid=CJ_c1ZSgzsICFUdefgodGbQA3w

Or buy the J-Link 9-pin Cortex-M Adapter from Segger.

0 Kudos
Reply