This content relates to a deprecated version of Mbed
Mbed 2 is now deprecated. For the latest version please see the Mbed OS documentation.
The following instructions demonstrate how to download the first program to your Microcontroller, and start it running.
1. Save a program binary (.bin) to the FRDM-KL25Z¶
Download the "Hello World!" binary:
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.
You must wait for the Status LED to stop flashing before pressing reset!
- As there is no external flash to store the binary received, the binary cannot be kept in an external memory. That is why when a transfer is finished, the mbed USB device (MBED disk, virtual serial port and HID CMSIS-DAP) is disconnected and reconnected few seconds later
- When the MBED disk appears again, it does not contain the binary transferred
Drag and drop programming on Mac
A pop-up window appears on Mac when the mbed USB device is disconnected saying that the device has not been ejected properly. You can just ignore this message
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 the blue LED forever! If you reset the Microcontroller, or disconnect and reconnect the power, the program will simply restart.
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!