Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 1 month ago.
Code with Mbed studio for Arduino nano 33 BLE
Hi,
I recently bought an Arduino Nano 33 BLE since I wanted to experiment with Bluetooth mesh....
I start playing with the board and Arduino BLE library before I realize it has a limited use.... Then I start understanding a little more about these new Arduino Nano base on different processor and that arduino core (still unsure what that is) is running on top of MBed OS (I did not know that it exists before that).... and also start to understand that there is a Bluetooth stack availble for MBed OS "Cordio" that I could used instead of the arduino one and that MBed OS has lot of extra functionalities.... So I decided to try to use MBed directly to program the board and then get MBed studio and write some code but I m stuck at uploading it :( I read somewhere that some board will act as USB device and you can copy past the generate file into the board to upload your program (seems to be call a DAP link) but I m guessing it do not work like that with the Nano 33 BLE because the program pre-loaded on the board only work for arduino IDE....
So my question is... how (if possible) could I use the Nano 33 BLE as an MBED board with MBED studio ? Is there a way to " flash" the pre-install bootloader with an "MBED" bootloader (if that exists) and how (what tool) do i do that ?
Thanks in advance, Charles
2 Answers
5 years, 1 month ago.
Hi Charles,
MbedOS enabled hardware have Arm Mbed DAPLink which enables programming and debugging application software running on Arm Cortex CPUs. How you can upload programs to Arduino Nano board now? Online compiler does binary file. You can also used Mbed CLI enviroment and use GCC_ARM. Can you upload binary files? Is it possible to use Arduino IDE for uploading?
Regards, Pekka
Hi, Thx for taking the time to answers. Zoltan suggest a way to upload but i did not manage to have it working and someone else suggest to try bossac https://github.com/arduino/ArduinoCore-nRF528x-mbedos/issues/19 so i m going to try that now
posted by 02 Oct 20195 years, 1 month ago.
Hello Charles,
I have no experience with such board but I think you have two options:
- Either try to program the board with a DIPDAP-LPC11U35 or SWDAP-LPC11U35 board. But for that you have to connect the programmer to the "debug pins" (+3.3V, SWD, SWCLK, GND, RST) described in Tech Specs here, which could prove quite difficult.
- Or try to program the board using the pre-installed bootloader:
- Build a simple "Blink" project for the Arduino Nano 33 BLE in Arduino IDE. That will generate a
C:\Users\[Your User Name]\AppData\Local\Temp\arduino_build_..\Blink.ino.hex
file. Do not close the Arduino IDE! (But you can hide the window if you like so.) - Build your Mbed project offline with "Mbed Studio IDE" or "mbed-cli" for the "ARDUINO_NANO33BLE" target.
- Rename the hex file generated by Mbed to
Blink.ino.hex
- Replace the
C:\Users\[Your User Name]\AppData\Local\Temp\arduino_build_..\Blink.ino.hex
file with the MbedBlink.ino.hex
file (copy & paste it to theC:\Users\[Your User Name]\AppData\Local\Temp\arduino_build_..
folder"). - In "Arduino IDE" click on the
Upload
button to run the pre-installed bootloader which will upload thehex
file to the board.
- Build a simple "Blink" project for the Arduino Nano 33 BLE in Arduino IDE. That will generate a
Hi and thx for taking time to answer.
I manage to compile in MBED studio after I update the lib to MBED OS 5.14...the nano 33 target appears so it s a progress already ;)
The upload process you suggest do not work. It seems arduino always recompile before upload as you can see https://ibb.co/wW9HxMM nevertheless someone suggested me to try bossac https://github.com/arduino/ArduinoCore-nRF528x-mbedos/issues/19 so i m going to try that now
posted by 02 Oct 2019- In Arduino IDE menu, before building the "Blink" project, click on
File>Preferences
and make sure the optionShow verbose output during:
is checked for bothcompilation
andupload
. Then click on theUpload
button. - Once the build is complete and the
hex
file uploaded to your board click on theCopy error messages
button. - Run Windows
Notepad
and press Ctrl+V. That will paste Arduino IDE messages into the Notepad editor. - The line which follows after the sketch information (like "Global variables used ...") is the command executed by Arduino IDE to upload the Arduino
hex
file to the board. Copy that line to the clipboard. - In Windows
File explorer
navigate the folder containing thehex
file built with Mbed. Typecmd
into the edit line at the top of theFile explorer
and hitENTER
. That will open a command prompt in the folder containing the Mbedhex
file. - Right-click on the command prompt window and select
Paste
. - Edit the command:
- Delete the whole path to the
Blink.ino.hex
file. - Replace
Blink.ino.hex
with the name of thehex
file created with Mbed.
- Delete the whole path to the
- To execute the modified command hit
ENTER
. Consequently, Arduino's programmer should program your board with Mbed'shex
file.
Save the modified command which was used to launch Arduino's programmer to program the Arduino Nano 33 BLE board into a text file for future use.
Edit: After adding support for Arduino nRF528x Boards to the Arduino IDE it turned out that the command used by Arduino IDE to program the Arduino Nano 33 BLE board on my PC is as follows:
C:\Users\[My User Name]\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino1/bossac.exe -d --port=COM8 -U -i -e -w MyProgram.bin -R