PlatformIO Community

Not uploading to Redbear Nano BLE v2

On Mac OS X 12.1 with board redbear_blenano2, all of my attempts to use the board don’t do anything when it comes to interfacing with the physical board (but I don’t see errors) . I’ve tried the Arduino IDE/blinky apps and my board works fine, so I know it’s not a hardware issue. I’ve also tried zephyr/west direct installs and they work fine. So something seems to be amiss with my platform.io setup. Below is output for my upload command. Interestingly, platform.io is reporting to be using OpenOCD, whereas the direct zephyr/west cli is using pyocd which is reporting successful uploads, looks like a good hint the the issue? Advice welcome!

> Executing task in folder 211231-162818-arduino-blink: platformio run --target upload --environment redbear_blenano2 <

Processing redbear_blenano2 (platform: nordicnrf52; framework: arduino; board: redbear_blenano2)
------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/redbear_blenano2.html
PLATFORM: Nordic nRF52 (9.1.0) > RedBearLab BLE Nano 2
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (cmsis-dap) On-board (cmsis-dap) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-arduinonordicnrf5 1.700.201209 (7.0) 
 - tool-bossac-nordicnrf52 1.10901.201022 (1.9.1) 
 - tool-openocd 2.1100.211028 (11.0) 
 - tool-sreccat 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/redbear_blenano2/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.2% (used 140 bytes from 65536 bytes)
Flash: [          ]   0.4% (used 2176 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, nrfjprog, stlink
CURRENT: upload_protocol = cmsis-dap
Uploading .pio/build/redbear_blenano2/firmware.hex
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-17-00:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

Both pyocd and openocd should be able to upload the program…

What does the project task “Advanced → Verbose Upload” say?

I seem to just get an extra line of info about using swd transport:

> Executing task in folder rb_test: platformio run --verbose --target upload --environment redbear_blenano2 <

Processing redbear_blenano2 (platform: nordicnrf52; board: redbear_blenano2; framework: zephyr; debug_tool: custom; debug_server: pyocd-gdbserver)
----------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/redbear_blenano2.html
PLATFORM: Nordic nRF52 (9.1.0) > RedBearLab BLE Nano 2
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (custom) On-board (cmsis-dap) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-zephyr 2.20700.211118 (2.7.0) 
 - tool-bossac-nordicnrf52 1.10901.201022 (1.9.1) 
 - tool-cmake 3.21.3 
 - tool-dtc 1.4.7 
 - tool-gperf 3.1.0 
 - tool-ninja 1.9.0 
 - tool-openocd 2.1100.211028 (11.0) 
 - tool-sreccat 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi 1.80201.181220 (8.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/redbear_blenano2/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   6.2% (used 4060 bytes from 65536 bytes)
Flash: [          ]   2.9% (used 15168 bytes from 524288 bytes)
.pio/build/redbear_blenano2/firmware.elf  :
section             size        addr
rom_start            220           0
text               14544         220
.ARM.exidx             8       14764
initlevel             48       14772
devices               96       14820
sw_isr_table         312       14916
device_handles        26       15228
rodata               304       15264
.ramfunc               0   536870912
datas                 32   536870912
device_states         16   536870944
bss                  588   536870960
noinit              3392   536871552
.comment             117           0
.debug_aranges      4136           0
.debug_info       338471           0
.debug_abbrev      43354           0
.debug_line       116669           0
.debug_frame        8740           0
.debug_str         38576           0
.debug_loc         86448           0
.debug_ranges      20744           0
.ARM.attributes       51           0
Total             676892
<lambda>(["upload"], [".pio/build/redbear_blenano2/firmware.hex"])
AVAILABLE: blackmagic, cmsis-dap, jlink, nrfjprog, stlink
CURRENT: upload_protocol = cmsis-dap
openocd -d2 -s /Users/greg/.platformio/packages/tool-openocd/scripts -f interface/cmsis-dap.cfg -f target/nrf52.cfg -c "program {.pio/build/redbear_blenano2/firmware.hex}  verify reset; shutdown;"
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-17-00:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.

…OpenOCD really shouldn’t hang up like this. The invocation line seems perfectly fine.

I’m not sure whether its stuck because of some low-level USB failure or driver issue or because of something else. Please open an issue in https://github.com/platformio/platform-nordicnrf52/.

Thanks, raised https://github.com/platformio/platform-nordicnrf52/issues/137