8 years, 10 months ago.

KL05Z problem programming external devices

I designed a battery powered device using the KL05 chip and developed the code using mbed and the FRDM-KL05Z board. Once my own boards were complete, I modified a KL25Z board to be a programmer (cut the trace, installed the connector) and began programming my own device. The KL05Z board can also be used, but there is a mistake in the wiring of the socket (http://mcuoneclipse.com/2013/04/27/debug-external-processors-with-usbdm-and-freedom-board/). The first board I programmed worked fine and I used that board for a few weeks fine tuning the program.

When I started programming additional boards that had never been programmed, 3 of the first 7 failed to program. There was no indication of this from mbed as the bin file appeared to copy to the part. I had already observed this limitation of the mbed programming method. You can have nothing connected and it still thinks the part is programmed. I then moved the program over to Keil uVision4 and in the process of programming boards have gotten a variety of errors: - Cannot access memory - Download failed - Kinetis locked - Device cannot be powered up

After a few tries clicking the load button, it works and I was able to program all of my parts. I had never observed this problem during development, but I did all of the development in mbed, not Keil so it is quite possible that in some cases where I thought I had downloaded a new program, nothing had happened and the previous program was still loaded.

Possible relevant information: My PC is running Windows 8. The ribbon cable from the mbed board to my board is 6" long. I got the same results using a J-Link Lite programmer in place of the KL25Z board. My reset pin has a 10k pullup and a 100nF capacitor to ground (the mbed board actually has 1uF). My 32kHz crystal has no capacitors, just like the KL05Z board.

I was able to duplicate the error about not being able to power the device using Keil and just the Freedom board and I suspect this happens when the device is in deep sleep which I do use in my code.

So, what is my question? Can anyone help me in resolving or at least explaining this problem. In addition, I think the CMSIS-DAP firmware needs to change so that an error is generated if programming did not succeed when using the drag and drop method of programming.

Thanks, Tom

Hi Tom - Can you share some more details about your setup?

  1. what version of the firmware is loaded on the OpenSDA circuit?
  2. can you upload some pictures of the current wiring and connections?

It seems quite odd that with nothing connected the device would tell you it programmed ok but would like to look at the right version of the codebase to be sure.

posted by Sam Grove 01 Jun 2015

I am using: 20140530_k20dx128_kl25z_if_opensda

I just spent some time with it and although it appears that copying still worked, when I open the mbed folder there is a file called "fail.txt" which contains the error message SWD ERROR. It looks like when it fails, it also halts the running of any mbed program which was running on the FRDM board until you either power cycle or do a successful download. So a good idea would be to run blinky on the FRDM board and if you notice that it stops blinking, then check for a fail.txt file.

BUT, I still have the problem of not always being able to download new code. I have switched over to uVision so I get better feedback and get occasional download problems. Usually it is a program download failure, but if the device is in deepsleep it sometimes can't download at all. My original problem of not being able to download at all with mbed I can't duplicate, but maybe that only appears with new devices.

posted by Tom Russell 01 Jun 2015
Be the first to answer this question.