Strange problem loading code…

10 Dec 2011

It seems that the image isn’t always getting written to my mBed-LPC1768.

I was having a problem so I tried backing off to a known working version of the code. When I loaded it, it didn’t work either. So I downloaded the HelloWorld_LPC1768.bin from the Getting Started instructions and loaded it on the target after deleting my code. This worked so I reloaded the known good copy of my code (after deleting HelloWorld_LPC1768.bin), it now worked, so I loaded the version I was debugging, it worked as well. So I continued updating my code and on the next load, everything failed again.

This time I renamed HelloWorld_LPC1768.bin to match the name of my code’s binary image (LPC1768.bin). Guess what, it didn’t work. So I deleted the binary and reloaded the renamed HelloWorld_LPC1768.bin. It now worked. So I tried reloading my code and after reset it was running the renamed HelloWorld_LPC1768.bin code!!! After seeing this I tried deleting the old binary before loading a new binary image, this didn’t help as sometimes it would be running the new image and sometimes the old. As a last test, I tried loading the original HelloWorld_LPC1768.bin with its original name, This now sometimes worked and didn't. Since encountering this I’ve also tried un-mounting the mBed target from my computer and re-mounting it, which sometimes helps and sometimes doesn’t and rebooting my computer between loads. Once again, it sometimes helps and sometimes doesn’t

At this point I’m really confused. I don’t know if there is a bug in the built in loader or the on board flash is failing. I find it hard to believe that the flash is failing since I’ve only had this for less than 1 week and have probably loaded less than 100 times to the target. I’ve also been using it stand-alone (no extra hardware) on a bread-board (for pin protection) while I get used to programming the LPC1768.

Any ideas, information on known/suspected loading issues and suggestions would be greatly appreciated. Thanks G

[EDIT] Corrected references to LPC2368 to LPC1768 [/EDIT]

10 Dec 2011

What OS are you using ?

It sounds like your OS has not written the image to the USB stick yet.

I know when using Linux (as I do) you need to mount the USB stick in 'synchronous' mode or simply use a 'sync' command after transferring your compiled image. Windows does this AFAIK automatically although I read about USB/mbed problems with Windows 7

10 Dec 2011

My OS is Windows XP but I don't think that's the problem since the loading issue didn't show up until the last couple of days.

G.

10 Dec 2011

Hi Grant,

You mention in your notes things like "HelloWorld_LPC2368.bin" which is for the LPC2368 board, but I think you have the LPC1768 board; one thing to check is you are trying to run/compile for the right target, as they use different binaries (they contain different ARM processors/peripherals, so make sure you are using the right one).

To get a basic hello world for the LPC1768, try:

And if that doesn't work, have a work through:

Hopefully that'll get you up and running, but if not, please don't hesitate to email us at support@mbed.org

Simon

10 Dec 2011

I double checked and the software was/is the LPC1768 version, I just entered the wrong name in the original post (cut-and-paste error).

I went through the dead mbed section, again with the same results. Sometimes it loads and runs as expected, sometimes it doesn't even replace the flashed code.