Riot arduino (nrf52840)

I use the Arduino to program the nrf52840, gnu-arm-GCC. May I add RTOS to my Nrf52840 arduino ? Remember, it’s not avr/atmega, it’s nrf52840 Thanks!

short answer: probably, but not with the arduino IDE

long answer:
I don’t think if you can use RIOT with the Arduino programming environment, as you do not have makefile support in the IDE.
My suggestion would be to look at platformIO/vscode.

If you can easily add RIOT to your NRF5280 depends on which NRF52840 board you are using.

RIOT supports multiple NRF52840 board, see:

If you have one of these boards, RIOT should work. If you have a different board you should check if your board is compatible.

Maybe my questions wasn’t correctly formulated! Is it possíble the riot use the cpp h libs that were originally done to Arduino?

Yes! Check out the arduino_hello-world example.

There is also an example for using an Arduino Driver with RIOT, but it’s unfortunately not merged yet.

Hi @benpicco

Got success to flick the LED using the RIOT ARDUINO

Building application “arduino_hello-world” for “feather-nrf52840” with MCU “nrf52”.

“make” -C /home/Usuario/test/RIOT/boards/feather-nrf52840 “make” -C /home/Usuario/test/RIOT/core “make” -C /home/Usuario/test/RIOT/cpu/nrf52 “make” -C /home/Usuario/test/RIOT/cpu/cortexm_common “make” -C /home/Usuario/test/RIOT/cpu/cortexm_common/periph “make” -C /home/Usuario/test/RIOT/cpu/nrf52/periph “make” -C /home/Usuario/test/RIOT/cpu/nrf52/vectors “make” -C /home/Usuario/test/RIOT/cpu/nrf5x_common “make” -C /home/Usuario/test/RIOT/cpu/nrf5x_common/periph “make” -C /home/Usuario/test/RIOT/drivers “make” -C /home/Usuario/test/RIOT/drivers/periph_common “make” -C /home/Usuario/test/RIOT/examples/arduino_hello-world/bin/feather-nrf52840/arduino_sketches “make” -C /home/Usuario/test/RIOT/sys “make” -C /home/Usuario/test/RIOT/sys/arduino “make” -C /home/Usuario/test/RIOT/sys/auto_init “make” -C /home/Usuario/test/RIOT/sys/auto_init/usb “make” -C /home/Usuario/test/RIOT/sys/div “make” -C /home/Usuario/test/RIOT/sys/event “make” -C /home/Usuario/test/RIOT/sys/isrpipe “make” -C /home/Usuario/test/RIOT/sys/newlib_syscalls_default “make” -C /home/Usuario/test/RIOT/sys/tsrb “make” -C /home/Usuario/test/RIOT/sys/usb/usbus “make” -C /home/Usuario/test/RIOT/sys/usb/usbus/cdc/acm “make” -C /home/Usuario/test/RIOT/sys/xtimer text data bss dec hex filename 26656 132 5756 32544 7f20 C:/msys64/home/Usuario/test/RIOT/examples/arduino_hello-world/bin/feather-nrf52840/arduino_hello-world.elf

This is the example

/*
  Arduino Hello-World @ RIOT
  Prints 'Hello Arduino!' once on the serial port during startup, toggles the
  default LED twice each seconds and echoes incoming characters on the serial
  port.
 */

// Per convention, RIOT defines a macro that is assigned the pin number of an
// on-board LED. If no LED is available, the pin number defaults to 0. For
// compatibility with the Arduino IDE, we also fall back to pin 0 here, if the
// RIOT macro is not available
#ifndef ARDUINO_LED
#define ARDUINO_LED     (1)
#endif

// For some boards RIOT defines a macro assigning the required baudrate of the
// serial link. If this macro is not set, the default baudrate is set to
// 115200.
#ifdef STDIO_UART_BAUDRATE
#define SERIAL_BAUDRATE STDIO_UART_BAUDRATE
#else
#define SERIAL_BAUDRATE 115200
#endif

// Assign the default LED pin
int ledPin = ARDUINO_LED;

// input buffer for receiving chars on the serial port
int buf[64];

// counter that counts the number of received chars
int count = 0;

void setup(void)
{
    // configure the LED pin to be output
    pinMode(ledPin, OUTPUT);
    // configure the first serial port to run with the previously defined
    // baudrate
    Serial.begin(SERIAL_BAUDRATE);
    // say hello
    Serial.println("Hello Arduino!");
}

void loop(void)
{
    Serial.println("hello");
    digitalWrite(ledPin, LOW);
    delay(2000);
    digitalWrite(ledPin, HIGH);
    delay(2000);
}

My question is, will RIOT still running in Background ? or not ?

I asked you because i cant see more the RIOT WELCOME message now! And i cant see the “hello” too on usb cdc.

other non arduino examples, all works on USB CDC

Those are simply prints that are included in the hello-world example. If you remove them, or use a different example, they will not show up:

printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
printf("This board features a(n) %s MCU.\n", RIOT_MCU);

Hello @Wosym

Nice tip!

Now RIOT now is calling Arduino functions (pinMode, digitalWrite, digitalRead) and now i can control a LED on u-blox nina B302 :slight_smile:

thanks again!

Is there some threads example to blynk LED ?