4 years, 6 months ago.

FRDM K64F program upload caoses "SWD ERROR"


i have a brand new FRDM K64F. Done all as shown in the very good turorials and very helpful starting pages. All is very easy to unterstand. Having my first programm after 10 Minutes. Compile "blinky" and try to upload. But this was my last success with the new board. Everytime i uploaded a programm i get a "fail.txt" file, with the file content "SWD ERROR".

I changed Firmwarein Bootloader mode: - V0201 -> FW update > ok Version Check > ok upload blinky >"SWD ERROR". - V0202 -> FW update > ok Version Check > ok upload blinky >"SWD ERROR". - V0203 -> FW update > ok Version Check > ok upload blinky >"SWD ERROR".

I tried this with the folowing Host Systems: - Windows8.1 - Windows 7 - macosx 10.9.4

Heres the version check for the actual FW: " <! mbed Microcontroller Website and Authentication Shortcut > <! Version: 0203 Build: May 30 2014 19:00:51 Git Commit SHA: ebe7dab202606d9dd80804b70ce95580d3077e23 Git local mods:Yes> <html> <head> <meta http-equiv="refresh" content="0; url="/> <title>mbed Website Shortcut</title> </head> <body></body></html>"

All looks ok, all is working ok but upload of a new binry is not possible!

I think that my board is in a wrong condition. Dbug mode or secure mode or something equal ...

Unfortunately I read al lot of this problem in internet but "mbed" and "fresscale" give no helpful answer to the comunity. The other threats to this problem are 3 Month old so i have only less hope toget a fast help.... but i will try it.

The pseudo help with upload the binary with the pressed reset button is nonsense so please don't post it here again. Thanky you guys in looking forward to some realy helpful answers.


Question relating to:

hello, lot of thanks for your help. I bought a new board and all works perfect. So you can see the problem was not in front of the Computer :-) ... I dont Know what is the reason, but the new and the old boards showing the same beahavoir except in the poinbt when you try to upload an new programm. So i commit in the point that the board has to be in a wrong state. Thanks for your help. Frank

posted by Frank Sartorius 17 Oct 2014

It has been an year since this question was asked, but I had the exact same issue today morning. I tried the said solutions but none of them worked. Finally I tried the latest version of the firmware from mbed's website and the problem was solved.

posted by Siddhesh Nadkarni 20 Jan 2016
Comment on this question

3 Answers

4 years, 6 months ago.

That 'pseudohelp' is a virtually perfect method, on the original mbed LPC1768. On the K64F if you do the entire thing with reset button pressed it is just going to enter bootloader mode.

Now I don't have the K64F myself, but most boards come loaded with some kind of example code which blinks LEDs. Do you recall if that was the case on your K64F board? If yes we can rule out issues with the target MCU. If no, well then it would be helpful if someone knows if it should be the case.

I do have a K22F, so it might be on some things a bit different. However if you look at the bottom of your board, then below every jumper connector there should be a PCB connection. If this is cut there would be an issue. Is the reset jumper (three pin jumper, should be pins 1-2 connection) correct? (Dunno if that one matters, but can't hurt to check).

SWD ERROR is a pretty generic one that no communication was possible with the target. If it would be in a secure state it should give another error.

Finally: On which PC did you do the firmware update? On the windows 7 PC it should 100% sure be able to go correctly (if it gives that FW information I would consider it strange if the firmware didn't load correctly, but it needs to be something). A broken K64 is of course also an option, but in my experience it generally is something else.

If you read my Problem i unterstand how to go to the Bootloader mode. FW update work propperly on all of the told Platforms. I can verify it after the update in checking the htm of the mbed disk. Its all fine and working! My Problem is that i cant load some binarys "blinky" for example.

So you see my PC is working properly and the board is working properly too. The communication between them is fine.

When i copy the binary on the Target disk I can see the upload procedure. The binary file is shown on the USB Disk of the mbed board. Then the explorer disapear and com up again. The bin file is erased and the failure fiole appear instead of it. So the File reached the disk of the board. The restart for loading the file starts, but the board is not able to handle it correctly. This is my problem.

With "pseudo help" i meaned the idea in some other treats to load the binary during you hold the reset button pushed. It makes no sense to me and did not work.

To reset the board during pluging in the USB to go to the Bootloader mode is working!

The jumpers are pluged in correctly.

Thanks for your answer!

posted by Frank Sartorius 28 Sep 2014

The point regarding that 'pseudo help' was that it is a very valid method, but for another board (the original mbed LPC1768/LPC11u24 boards). For your board however it is not relevant.

I am out of ideas, going to point someone else to your issues, but it might in the end be a defective board.

One question: You say in your comment that you can't load "some" binaries. I take it you mean any binary? Or do some work? Also I assume you haven't managed to upload a single binary succesfully (the first time for example)?

It is possible to make a board unresponsive with some creative code (easiest way is using the reset pin as GPIO pin, although from that you can still recover), but from your description that shouldn't be relevant here.

posted by Erik Olieman 28 Sep 2014

Add a comment here..

Do you have any IDE, like KDS (using openOCD) or uVision or any other? Your target can be in a state which does not allow to reflash it (there is still space for improvement in mbed cmsis-dap). I was there couple of times. I solved it by refleshing it via uVision.. Even if that to does not help, there could be a problem with reset line, hold reset line, flash the device (click on the button in the IDE) and at the same time release the reset button.

Or use jliink open sda, which allows you to use jlink console or jlink gdb server. And reflash it.

posted by Martin Kojtal 29 Sep 2014
4 years, 1 month ago.

Hi All, this morning I have the same problem on 2 board F401RE and F411RE.

When I plug them into usb port I can see a text file named fail.txt with SWD ERROR inside.

I've just updated the firmware but the problem is unsolved.


4 years, 1 month ago.

Just wanted to give you a heads up. Maybe you figured it out for yourself, but for anybody who has thisissue please follow these steps.

1.) Go to: 2.) download OpenSDA V2 3.) enter bootloader mode(hold down reset while plugging in board) 4.) paste .bin file in bootloader 4.1)at this point your red reset led should still be lit. Its okay just proceed 5.) Download J-flash Lite from here: 6.) Select this device (MK64FN1M0xxx12 (allow security)) 7.)Download FRDM gpio and program using Jflash. 8.)Red light should go away 9.) re enter bootloader mode and upload the latest firmware for FRDM-k64f 10.) Device should now read MBED.

Hope it works for you I figured this out after reading way too many threads on the topic.

Your step 7.)Download FRDM gpio and program using Jflash. Download from where?

posted by Just Gary 10 Mar 2015

Sorry, Just downlad blinky from:

The point is to use a known file and upload it. Hope it works any more questions let me know,

Patrick Smith

posted by Patrick Smith 11 Mar 2015

To post an answer, please log in.