Adafruit_feather_nrf52832 BLE difference between Arduino and PlatformIO

First time using PlatformIO so it could be a user error, but the symptom is that the same code works as expected when compiled/uploaded through the Arduino IDE, but bluetooth communication from the nrf52832 to a phone doesn’t work when compiled/uploaded via PlatformIO.

I can establish a bluetooth connection, and transmit data from the connected device to the nrf52832. The console log of the nrf52832 shows it received the information from the phone and no errors are shown…just no data is sent back to the phone.

Here’s my INI file:

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

The only difference between the code is the inclusion of #include “Arduino.h” in main.cpp.

I’m not sure what to validate/compare next. Any tips on how to discover what’s different between the two build pipelines? I can post the code or verbose build output, or whatever else would be useful to help debug. Thanks. Here’s the build output to start with:

> pio run --target upload -e adafruit_feather_nrf52832
Processing adafruit_feather_nrf52832 (platform: nordicnrf52; board: adafruit_feather_nrf52832; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52832.html
PLATFORM: Nordic nRF52 (4.5.0) > Adafruit Bluefruit nRF52832 Feather
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
 - framework-arduinoadafruitnrf52 1.2100.201028 (21.0)
 - tool-bossac-nordicnrf52 1.10901.201022 (1.9.1)
 - tool-openocd 2.1000.200630 (10.0)
 - tool-sreccat 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 14 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit Little File System Libraries> 0.11.0
|-- <Adafruit Internal File System on Bluefruit nRF52> 0.11.0
|   |-- <Adafruit Little File System Libraries> 0.11.0
|-- <Adafruit Bluefruit nRF52 Libraries> 0.21.0
|   |-- <Adafruit Little File System Libraries> 0.11.0
|   |-- <Adafruit Internal File System on Bluefruit nRF52> 0.11.0
|   |   |-- <Adafruit Little File System Libraries> 0.11.0
Building in release mode
Checking size .pio/build/adafruit_feather_nrf52832/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  13.9% (used 9100 bytes from 65536 bytes)
Flash: [=         ]  13.7% (used 71628 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = nrfutil
Looking for upload port...
Auto-detected: /dev/cu.usbserial-01E02A38
Uploading .pio/build/adafruit_feather_nrf52832/firmware.zip
Upgrading target on /dev/cu.usbserial-01E02A38 with DFU package /Users/dan/code/cyclometry/arduino/nrf52_hall/.pio/build/adafruit_feather_nrf52832/firmware.zip. Flow control is disabled, Single bank, Touch disabled
########################################
########################################
########################################
####################
Activating new firmware
Device programmed.
===================================================== [SUCCESS] Took 16.31 seconds =====================================================
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

For reference, what’s

  • the exact code you’re compiling
  • the exact Arduino IDE settings for which the sketch confimed works
  • the exact version of the Arduino IDE board manager package for the Adafruit board / core that you’re using

I pushed a branch up to github. I have two top-level directories - nrf52_hall is the platformio project, and nrf52_with_hall has the Arduino file used.

Here’s the platformio main class:
https://github.com/cyclometry/arduino/blob/use_platformio_config/nrf52_hall/src/main.cpp

Arduino IDE settings:
Board: “Adafruit Feather nRF52832”
Bootloader: “0.3.2 SoftDevice s132 6.1.1”
Programmer: “Bootloader DFU for Bluefruit nRF52”

Board manage package: Adafruit nRF52 version 0.21.0

Here’s build/upload output from a verbose Arduino build:

Thanks again.

Derp - just used a different UART iOS client, and it’s receiving ok. i.e. PlatformIO’s build behavior is fine; my iOS client is faulty for a TBD reason.