2 weeks, 3 days 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

Comment on this question

2 Answers

1 week, 6 days 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 charles walker 02 Oct 2019
1 week, 6 days 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 Mbed Blink.ino.hex file (copy & paste it to the C:\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 the hex file to the board.

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 charles walker 02 Oct 2019
  • In Arduino IDE menu, before building the "Blink" project, click on File>Preferences and make sure the option Show verbose output during: is checked for both compilation and upload. Then click on the Upload button.
  • Once the build is complete and the hex file uploaded to your board click on the Copy 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 the hex file built with Mbed. Type cmd into the edit line at the top of the File explorer and hit ENTER. That will open a command prompt in the folder containing the Mbed hex 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 the hex file created with Mbed.
  • To execute the modified command hit ENTER. Consequently, Arduino's programmer should program your board with Mbed's hex 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
posted by Zoltan Hudak 02 Oct 2019

You need to log in to post a question