Downloading a program

Table of Contents

  1. Instructions

Getting started

  1. Setup Guide
  2. Downloading a Program
  3. Creating a Program
  4. Communicating with your mbed

The following instructions demonstrate how to download the first program to your Microcontroller, and start it running.

Instructions

1. Save a program binary (.bin) to the mbed Microcontroller

Download the appropriate "Hello World!" binary:

Note: the source code for this program can be seen in the next section, Creating a program

Save the program binary file to your mbed Microcontroller Disk, just like you would with a normal USB disk. The Status LED will flash as the PC writes the file to the Microcontroller disk.

/media/uploads/dan/BoardLayoutSmall.png

2. Press the Reset Button

When the Reset Button in pressed, the newest program on the mbed Microcontroller Disk will be loaded in to the Microcontroller FLASH memory. The Status LED will flash as this happens.

When the program is has been loaded onto the microcontroller, it will then start it running.

3. Hello World!

The Microcontroller is now running the program; flashing LED1 forever! If you reset the Microcontroller, or disconnect and reconnect the power, the program will simply restart.

4. To download a different program

It is the newest program on the mbed Microcontroller that is run after reset. We can therefore download a new program or overwrite an existing one to update the program that will run.

Where Next

Troubleshooting

Make sure you save the file to the mbed Microcontroller!

  • You can use your computer's file explorer to to check what is on the Microcontroller, as you would for a normal USB Disk
  • If the Status LED did not flash when saving to the Microcontroller, or after resetting the first time, you probably saved it elsewhere!
  • Some browsers default to saving files to your "Desktop", so this should be changed; see Choose-where-to-save-files-FAQ
  • Some Linux or old Mac PCs don't write data until you "Eject" the drive; see Mounting-with-sync

Don't try and "Open" or "Run" the program files. Always "Save" them to the Microcontroller.

  • Some applications (e.g. VLC Media Player) recognise the .bin extension; ignore them!

Make sure you set it running!

  • Remember to reset the Microcontroller to start it running after you download a new program
  • If the binary downloads to the micro, but nothing happens, make sure you chose the correct board binary

When you unplug the Microcontroller, you may get a "Device Removal" error message; don't worry!

  • You can ignore this, but you can also use "Eject" (Mac) or "Safely Remove Hardware" (Windows) to avoid this if you want

If you have any problems, or think this tutorial could be improved, please tell us in the Forum!




22 comments:

27 Sep 2010

Hi, the link "FAQs/Firefox-Save-As" above leads to "Access denied". Anything wrong ??

28 Sep 2010

I've got the same thing. But I'll wager the guide will point users to "Tools > Options > General > Save Files To..." in the Firefox 3.x browser.

user Juergen Hausmann wrote:

Hi, the link "FAQs/Firefox-Save-As" above leads to "Access denied". Anything wrong ??

28 Sep 2010

Fixed!

18 Oct 2010

Very easy. Thanks. Gracias

09 Nov 2010

All things are ok

03 Jan 2011

Just manage to get the board on hand... pretty impressive.

12 Jan 2011

Warning if you are using windows, the Windows File Protection (WFP) system (http://support.microsoft.com/kb/222193/en-us) can bug and refuse to finish the file transfer (a small windows opens during the transfer and doesn't close). So, if you unplugged the mbed during such problem, you can destroy the file system of the mbed...

It happened to my mbed: two new files appear : USBCð ­3 997 696KB and USBC-­ZL. 753 664KB) and the .bin file can no more be remove or update So the mbed works with this only program, and I have found no solutions for the moment to solve this issue...

12 Jan 2011

I don't see how WFP would affect mbed, seeing as it only cares about system files (i.e. in Windows and Program Files directories).

16 Jan 2011

It would be nice to put the source code of the HelloWorld program here :)

16 Jan 2011

Hi Xtian,

Thanks, I just added that (to the next page actually).

Cheers, Simon

13 Mar 2011

i wrote a Windows script file to automatically copy move files to the MBED. save the attached script somewhere safe and then run it once (as administrator!) to associate .bin files with the script. from then on, you can double click on .bin files, or configure your browser automatically run them after downloading. enjoy.

/media/uploads/chag/transfer_to_mbed.cmd

(updated to move instead of copy, to prevent multiple versions of the same program building up.)

08 Dec 2011

vay anasını, hakkaten kolaymış ya. that's reallt easy.

13 Jan 2012

I'm sold. Registered for the development software, got the ARM controller connected to my computer, AND was able to load and run a program on it all within 1 minute of opening the box. Perfect way to handle the unboxing, mbed - don't change a thing! :)

Also, hello mbed community!! よろしくおねがい~

14 Mar 2012

Worked right out of the box with Win 7 on a Toshiba laptop. LED1 flashes as promised! One suggestion: the program should not be called "Hello World" unless the actual phrase is displayed or printed somewhere. Small point, but tradition is tradition.

15 Mar 2012

user Joe Legris wrote:

the program should not be called "Hello World" unless the actual phrase is displayed or printed somewhere. Small point, but tradition is tradition.

You are right ! I suggest "Flash the world " A novice user might try to catch the hello world at a terminal. There is a Terminal Hello World , which should be the original Hello world version

02 Apr 2012

Hi, Does anyone know why my EMBED is filing up with a bunch of 0 KB files. (see below). It seems to happen when I delete a bin file on the EMBED, windows times out giving me access error. I tried deleting it again but I get a message "can not read file"

Any idea on how to get rid of them?

°    0 KB File USBC(╗Öä. 0 KB File USBC(╗Öä. 0 KB File USBC(╗Öä. 0 KB File

Thanks

02 Apr 2012

Try Chrome Internet Explorer can do strange things.

Especially if you are using Windows 7

Lots of windows 7 threads hear.

Hope that helps

Ceri

05 Apr 2012

http://wikisend.com/download/169246/mbed_autotransfer.exe This will automatically transfer bin files to mbed. This is the compiled version of chag's vb script. This is faster than the .cmd one since this is a .exe file.

03 Jul 2012

lcd progrm kaavaali

11 Aug 2012

I was able to run first program fine in few minutes on Nxp1768. Now, I wanted to upload a new "test" program. I changed source code and tried to compile the test program. I got fist time right and will not get SUCCESS message at all further for new compilations. It does nothing. Are there restrictions when controller is running Hello World and now you want to run new program? Some documentation would help. For example, only one binary should stay at a time in MBED drive. What are requirements for compiler to run a new program? What is setup?

11 Aug 2012

You can put as many binaries as you like on the mbed drive, it will load the latest one upon reset. Of course until the drive is full, then just throw the old ones away. There shouldnt be any restrictions. But if the compiler does not return success, does it also not return an error?

Some browsers (at least chrome) have the irritating habit that if you cancel downloading an attachement once (such as the bin file here), it will automatically block all downloads from the entire site. So you could try using a different browser to see if that helps.

26 Nov 2012

My laptop froze while uploading a binary to mbed, and I had to restart. When I checked mbet, it now has two "USBCG⌐." files in it, and I am not able to remove them. "The file name you specified is not valid or too long". Is it safe to format mbed, or is there any other way to remove?

Posting comments for this page has been disabled