PlatformIO Community

NRF52832 on platformio compile and upload blink LED but not working

good day.
Its my first time using the nordic chip but after i compiled the Blink Led program PlatformIO using Arduino as my frameWork and uploading the binaries, it DID NOT WORK but that same code on Arduino IDE worked. i have tried different ENV variables but to no avail (with Arduino framwork); but also, when i tried the mbed framework using same project, it worked (of course blinky on mbed). But Arduino Framwork just never works. below is my coded and ENV variables too

///// mbed code
#include "mbed.h"

 

#define WAIT_TIME_MS 1500 

DigitalOut led1(LED1);

DigitalOut led221(p13);

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)

    {

        led1 = !led1;

        led221 = !led221;

        thread_sleep_for(WAIT_TIME_MS);

    }

}

// arduino code

#include <Arduino.h>

// the setup function runs once when you press reset or power the board

void setup() {

  // initialize digital pin LED_BUILTIN as an output.

  pinMode(LED_BUILTIN, OUTPUT);

  pinMode(19, OUTPUT);

  Serial.begin(9600);

}

// the loop function runs over and over again forever

void loop() {

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)

  digitalWrite(19, HIGH);   // turn the LED on (HIGH is the voltage level)

  Serial.println("LED HIGH");

  delay(3000);                       // wait for a second

  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW

  digitalWrite(19, LOW);    // turn the LED off by making the voltage LOW

  Serial.println("LED LOW");

  delay(1000);                       // wait for a second

}

// end of code

platformio.ini variables

[env:stct_nrf52_minidev]
platform = nordicnrf52
board = stct_nrf52_minidev
framework = arduino
; SoftDevice version
build_flags = -DNRF52_S132
upload_protocol = stlink
lib_deps =
    sandeepmistry/BLEPeripheral @ ^0.4.0

[env:adafruit_feather_nrf52832]
platform = https://github.com/platformio/platform-nordicnrf52.git
board = adafruit_feather_nrf52832
framework = arduino
upload_protocol = stlink    ; nrfutil
; build_flags = 
;   -DARDUINO_BSP_VERSION=\"0.9.3\"

[env:stct_nrf52_minidev2]
platform = nordicnrf52
board = adafruit_feather_nrf52832
framework = arduino
upload_protocol = stlink    ; nrfutil

[env:nrf52]
platform = nordicnrf52
board = hackaBLE
framework = arduino
upload_protocol = stlink    ; nrfutil

[env:nrf52_dk]
platform = nordicnrf52
board = nrf52_dk
framework = mbed
upload_protocol = stlink    ; nrfutil

[env:adafruit_feather_nrf52832_2]
platform = nordicnrf52
board = adafruit_feather_nrf52832 
framework = arduino
; change microcontroller
board_build.mcu = nrf52832
; change MCU frequency
board_build.f_cpu = 32000000L ; 64000000L
upload_protocol = stlink    ; nrfutil.

please help me!!!

Can you show a screenshot of the menu configuration settings in the Arduino IDE with which the blinky code works?

Also what version of the nRF52 board package does it show in the Arduino IDE’s board manager?

image

image

This may seem counter-intuititive, but try with

[env:nrf52]
platform = nordicnrf52
board = ublox_evk_nina_b1
framework = arduino
upload_protocol = stlink    ; nrfutil

to also use the “Generic nRF52” board in PlatformIO. The board definition file chooses the Sandeep nRF5 core with the Generic variant and that should work.

thanks a great deal. that helped like charm!!!