Arduino and mbed framework on ble sense

hello
i tried loading the blinker example from mbed and i have ble 33 nano sense board from arduino. I get the following message
mbed framework is not supported on this board
when i searched i found that arduino supports mbed ?
is it possible to run rtos with mbed on this board?

thank you

This is partly explained it Is there a functional difference between Platformio's "framework-arduinoadafruitnrf52" firmware and arduino's official firmware - #4 by maxgerhardt. The Arduino core for this board is framework-arduino-nrf52-mbedos which is actually an implementation of the Arduino core API on top of a specific mbed-os. The mbed-os part of it is still fully functional. Have a look at GitHub - arduino/ArduinoCore-nRF528x-mbedos: [Archived] Arduino core supporting mbed-enabled boards.

thank you for your reply, i am aware of ArduinoCore-nRF528x-mbedos but i still don’t know how can i use it from platformio, how can i use a special framework?

framework = arduino must be selected for that. It’s an Arduino core on top of mbed-os, after all.

thats great but should i replace the arduino framework or is it a new framework with a new definition?

i noticed there is a framework called as follows in the packages folder
.platformio/packages/framework-arduino-nrf52-mbedos
is it the same framework you mentioned? how can i use it what is the environment name?

There is nothing to replace. By specifying framework = arduino PlatformIO will automatically select the corerct Arduino core for you. Example:

platformio.ini

[env:nano33ble]
platform = nordicnrf52
framework = arduino
board = nano33ble

src/main.cpp

#include <Arduino.h>

/* use mbedos object for build in LED */
mbed::DigitalOut led(P0_13); 

void setup(void)
{
    Serial.begin(115200); /* arduino function */
    Serial.println("Hello world");
}

void loop(void)
{
    led = 1; /* mbedos function */
    delay(500); /* arduino function */
    led = 0; /* mbedos function */
    delay(500); /* arduino function */
}

in the compilation output you will see the used packages.

Processing nano33ble (platform: nordicnrf52; framework: arduino; board: nano33ble)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nano33ble.html
PLATFORM: Nordic nRF52 (5.0.0) > Arduino Nano 33 BLE
HARDWARE: NRF52840 64MHz, 256KB RAM, 960KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink)
PACKAGES:
 - framework-arduino-nrf52-mbedos 1.3.0
 - tool-sreccat 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
..
Linking .pio\build\nano33ble\firmware.elf
Building .pio\build\nano33ble\firmware.bin
Checking size .pio\build\nano33ble\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  16.6% (used 43496 bytes from 262144 bytes)
Flash: [=         ]   7.8% (used 77116 bytes from 983040 bytes)
============================= [SUCCESS] Took 5.95 seconds =============================

Excellent thank you. Here is another sample for people who like to work with the mbed main function, the same program but written using threading.

Summary:
To recap, as soon as the mbed object is called, it will compile using mbed rtos although the framework in the setup is arduino.

#include <Arduino.h>

/* use mbedos object for build in LED */

#define WAIT_TIME_MS 3000 
mbed::DigitalOut led(P0_13);

int main()
{
    printf("This is the bare metal blinky example running on Mbed OS %d.%d.%d.\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);

    while (true)
    {
        led = !led;
        thread_sleep_for(WAIT_TIME_MS);
    }
}

The only still problem is:
1- although it compiles and flashes well, but i get under problems, thread_sleep_for is undefined, and P0_13 is undefined

it seems there is a missing header ?

Is that a compile error when using the Build button or an IntelliSense error? The IntelliSense won’t be able to find that framework files if you haven’t built it at least once, because then it will download the framework. Also when in doubt, use the project task “Rebuild IntelliSense” after a build.

I can compile perfectly fine and the IntelliSense works.

i don’t know where the problems come from, i clicked ignore and it vanished.

I will check it, the next time i create this project and test this issue.
My second step would to be able to debug the program while running, could you please help me with it also?

thank you

Like the documentation says, the board doesn’t have an on-board debugging device. You need an external SWD debugger device like a ST-Link (or general CMSIS-DAP), JLink or Black Magic Probe and connect it to the board’s SWD pins (SWDIO+SWCLK+GND,RST,3V3 ofc), which are on the back of the board

image

from Arduino Nano 33 BLE — Arduino Official Store and pinout from https://medium.com/@manuel.bl/arduino-in-circuit-debugging-with-platformio-9f699da57ddc. (<-- this article link uses a slightly different board! but the pinout is the same, I have checked with the brd file in the Arduino page).