PlatformIO with Atom working, PlatformIO with Visual Studio Code was working but stopped

I switched to using VSCode with PlatformIO from Atom with PlatformIO about a month ago. Today uploading to my Adafruit Feather nRF52840 Express the board just locks up. There is no serial output from setup(). You cannot even upload again without manually putting the board into bootloader mode. If I switch to Atom/PlatformIO, the exact code uploads and runs fine. I’ve tried simple code using VSCode and that still works.

Using the latest version of libraries and bootloader and core.

Any one have ideas on what to investigate or try?

Thanks,

Let’s make sure you’re using the all-latest versions. Open a CLI and execute

pio platform update nordicnrf52

and retry uploading. Does it work now?

Performed update, but nothing updated and the upload still locks up the board.
pdavis@Pauls-MBP emu_converter_adafruit % pio platform update nordicnrf52
Platform nordicnrf52
--------
Updating platformio/nordicnrf52 9.1.0 [Up-to-date]
Updating platformio/toolchain-gccarmnoneeabi 1.70201.0 @ >=1.60301.0,<1.80000.0 [Up-to-date]
Updating platformio/framework-arduinoadafruitnrf52 1.10200.0 @ ~1.10200.0 [Up-to-date]
Updating platformio/framework-cmsis 2.50700.210515 @ ~2.50700.0 [Up-to-date]
Updating platformio/tool-adafruit-nrfutil 1.503.0 @ ~1.503.0 [Up-to-date]
Updating platformio/tool-sreccat 1.164.0 @ ~1.164.0 [Up-to-date]
Updating platformio/tool-openocd 2.1100.211028 @ ~2.1100.0 [Up-to-date]
Updating platformio/tool-bossac-nordicnrf52 1.10901.201022 @ ~1.10901.0 [Up-to-date]

Does this also happen with the simplest possible code & platformio.ini?

[env:adafruit_feather_nrf52840]
platform = nordicnrf52
board = adafruit_feather_nrf52840
framework = arduino
#include <Arduino.h>
#include <Adafruit_TinyUSB.h>

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("Hello!");
  delay(1000);
}

No, it does not hang with simple code.

Then there’s a possible regression in your code with respect to the updated nordicnrf52 platforms and the therein used Arduino core. Possible your Atom installation was using an older nordicnrf52 version. Things like an exception / crash within the constructor of a globally constructed object can have the effect you’re seeing. It’s hard to say what exactly is happening without the complete code or a debugger though. If you have a e.g. JLink, you may to try to connect it to the board to see exactly in which line of code it’s stuck.

An alternative would be to roll-back the used nordicnrf52 platform version. See Nordic nRF52 — PlatformIO latest documentation in combination with Releases · platformio/platform-nordicnrf52 · GitHub to gradually roll back from 9.1.0 to earlier version until things start working again.

Thanks Maxgerhardt for your help. No I don’t have a debugger. But, my Atom is working right now with the same code and libraries and core. So, it seems to me, for some reason VSCode loads/compiles differently than the Atom environment.

Do you have access to the CLI in Atom? What does it show for pio platform show nordicnrf52? What does it show for a verbose compilation (pio run -v)?

Here is what you requested. Couldn’t find a way to upload a text file.

nordicnrf52 ~ Nordic nRF52
==========================
The nRF52 Series are built for speed to carry out increasingly complex tasks in the shortest possible time and return to sleep, conserving precious battery power. They have a Cortex-M4F processor and are the most capable Bluetooth Smart SoCs on the market.

Version: 9.1.0
Home: https://www.nordicsemi.com/Products/nRF52-Series-SoC
Repository: https://github.com/platformio/platform-nordicnrf52.git
Vendor: https://www.nordicsemi.com/Products/nRF52-Series-SoC
License: Apache-2.0
Frameworks: arduino, mbed, zephyr

Packages
--------

Package toolchain-gccarmnoneeabi
--------------------------------
Type: toolchain
Requirements: >=1.60301.0,<1.80000.0
Installed: Yes
Version: 1.70201.0
Original version: 7.2.1
Description: GNU toolchain for Arm Cortex-M and Cortex-R processors

Package framework-mbed
----------------------
Type: framework
Requirements: ~6.60900.0
Installed: No (optional)

Package framework-arduinoadafruitnrf52
--------------------------------------
Type: framework
Requirements: ~1.10200.0
Installed: Yes
Version: 1.10200.0
Original version: 1.2.0
Description: Arduino Wiring-based Framework for Nordic Semiconductor nRF52 BLE SoC

Package framework-arduinonordicnrf5
-----------------------------------
Type: framework
Requirements: ~1.700.0
Installed: No (optional)

Package framework-arduino-mbed
------------------------------
Type: framework
Requirements: ~2.6.0
Installed: No (optional)

Package framework-cmsis
-----------------------
Type: framework
Requirements: ~2.50700.0
Installed: Yes
Version: 2.50700.210515
Original version: 5.7.0
Description: Vendor-independent hardware abstraction layer for the Cortex-M processor series

Package framework-zephyr
------------------------
Type: framework
Requirements: ~2.20700.0
Installed: No (optional)

Package tool-adafruit-nrfutil
-----------------------------
Requirements: ~1.503.0
Installed: Yes
Version: 1.503.0
Original version: 5.3
Description: adafruit-nrfutil is a Python package that includes the adafruit-nrfutil command line utility and the nordicsemi library.

Package tool-sreccat
--------------------
Requirements: ~1.164.0
Installed: Yes
Version: 1.164.0
Original version: 1.64
Description: Collection of powerful tools for manipulating EPROM load files

Package tool-openocd
--------------------
Type: uploader
Requirements: ~2.1100.0
Installed: Yes
Version: 2.1100.211028
Original version: 11.0
Description: Open On-Chip Debugger. Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing

Package tool-nrfjprog
---------------------
Type: uploader
Requirements: ~1.90702.0
Installed: No (optional)

Package tool-jlink
------------------
Type: uploader
Requirements: ^1.63208.0
Installed: No (optional)

Package tool-bossac-nordicnrf52
-------------------------------
Type: uploader
Requirements: ~1.10901.0
Installed: Yes
Version: 1.10901.201022
Original version: 1.9.1
Description: Basic Open Source SAM-BA Application (BOSSA) for Nordic nRF52 microcontrollers

Package tool-cmake
------------------
Requirements: ~3.21.0
Installed: No (optional)

Package tool-dtc
----------------
Requirements: ~1.4.7
Installed: No (optional)

Package tool-ninja
------------------
Requirements: ^1.7.0
Installed: No (optional)

Package tool-gperf
------------------
Requirements: ^3.0.0
Installed: No (optional)

Boards
------
ID                               MCU       Frequency    Flash     RAM      Name
-------------------------------  --------  -----------  --------  -------  -----------------------------------------
96b_nitrogen                     NRF52832  64MHz        512KB     64KB     96Boards Nitrogen
adafruit_clue_nrf52840           NRF52840  64MHz        796KB     243KB    Adafruit CLUE nRF52840
adafruit_cplaynrf52840           NRF52840  64MHz        796KB     243KB    Circuit Playground Bluefruit
adafruit_feather_nrf52832        NRF52832  64MHz        512KB     64KB     Adafruit Bluefruit nRF52832 Feather
adafruit_feather_nrf52840        NRF52840  64MHz        796KB     243KB    Adafruit Feather nRF52840 Express
adafruit_feather_nrf52840_sense  NRF52840  64MHz        796KB     243KB    Adafruit Feather Bluefruit Sense
adafruit_itsybitsy_nrf52840      NRF52840  64MHz        796KB     243KB    ItsyBitsy nRF52840 Express
adafruit_ledglasses_nrf52840     NRF52840  64MHz        796KB     232KB    Adafruit LED Glasses Driver nRF52840
adafruit_metro_nrf52840          NRF52840  64MHz        796KB     243KB    Metro nRF52840 Express
bbcmicrobit_v2                   NRF52833  64MHz        512KB     128KB    BBC micro:bit V2
bluey                            NRF52832  64MHz        512KB     64KB     Bluey nRF52832 IoT
delta_dfbm_nq620                 NRF52832  64MHz        512KB     64KB     Delta DFBM-NQ620
dwm1001_dev                      NRF52832  64MHz        512KB     64KB     decaWave DWM1001 Module Development Board
electronut_blip                  NRF52840  64MHz        1MB       256KB    ElectronutLabs Blip
electronut_papyr                 NRF52840  64MHz        1MB       256KB    ElectronutLabs Papyr
hackaBLE                         NRF52832  64MHz        512KB     64KB     hackaBLE
holyiot_yj16019                  NRF52832  64MHz        512KB     64KB     Holyiot YJ-16019
laird_bl652_dvk                  NRF52832  64MHz        512KB     64KB     BL652 Development Kit
laird_bl653_dvk                  NRF52833  64MHz        512KB     128KB    BL653 Development Kit
laird_bl654_dvk                  NRF52840  64MHz        1MB       256KB    BL654 Development Kit
laird_pinnacle_100_dvk           NRF52840  64MHz        1MB       256KB    Laird Connectivity Pinnacle 100 DVK
nano33ble                        NRF52840  64MHz        960KB     256KB    Arduino Nano 33 BLE
nicla_sense_me                   NRF52832  64MHz        515.25KB  62.78KB  Arduino Nicla Sense ME
nrf52832_mdk                     NRF52832  64MHz        512KB     64KB     Makerdiary nRF52832-MDK
nrf52833_dk                      NRF52833  64MHz        512KB     128KB    Nordic nRF52833-DK
nrf52840_dk                      NRF52840  64MHz        1MB       256KB    Nordic nRF52840-DK
nrf52840_dk_adafruit             NRF52840  64MHz        796KB     243KB    Nordic nRF52840-DK (Adafruit BSP)
nrf52840_mdk                     NRF52840  64MHz        1MB       256KB    Makerdiary nRF52840-MDK
nrf52_dk                         NRF52832  64MHz        512KB     64KB     Nordic nRF52-DK
particle_argon                   NRF52840  64MHz        796KB     243KB    Particle Argon
particle_boron                   NRF52840  64MHz        796KB     243KB    Particle Boron
particle_xenon                   NRF52840  64MHz        796KB     243KB    Particle Xenon
raytac_mdbt50q_rx                NRF52840  64MHz        796KB     243KB    Raytac MDBT50Q-RX Dongle
redbear_blenano2                 NRF52832  64MHz        512KB     64KB     RedBearLab BLE Nano 2
redbear_blend2                   NRF52832  64MHz        512KB     64KB     RedBearLab Blend 2
reel_board                       NRF52840  64MHz        1MB       256KB    PHYTEC reel board
reel_board_v2                    NRF52840  64MHz        1MB       256KB    PHYTEC reel board v2
ruuvitag                         NRF52832  64MHz        512KB     64KB     Ruuvi Tag
sdt52832b                        NRF52832  64MHz        512KB     64KB     SDT52832B
stct_nrf52_minidev               NRF52832  64MHz        512KB     64KB     Taida Century nRF52 mini board
thingy_52                        NRF52832  64MHz        512KB     64KB     Nordic Thingy:52 (nRF52-PCA20020)
ublox_bmd345eval_nrf52840        NRF52840  64MHz        1MB       256KB    u-blox BMD-345-EVAL
ublox_evk_nina_b1                NRF52832  64MHz        512KB     64KB     u-blox EVK-NINA-B1
vbluno52                         NRF52832  64MHz        512KB     64KB     VNG VBLUno52
Processing adafruit_feather_nrf52840 (platform: nordicnrf52; board: adafruit_feather_nrf52840; framework: arduino; lib_archive: False; build_flags: -I include)
--------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52840.html
PLATFORM: Nordic nRF52 (9.1.0) > Adafruit Feather nRF52840 Express
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduinoadafruitnrf52 1.10200.0 (1.2.0) 
 - framework-cmsis 2.50700.210515 (5.7.0) 
 - tool-adafruit-nrfutil 1.503.0 (5.3) 
 - 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 46 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SdFat - Adafruit Fork> 1.2.4 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/SdFat - Adafruit Fork)
|   |-- <SPI> 1.0 (/Users/pdavis/.platformio/packages/framework-arduinoadafruitnrf52/libraries/SPI)
|   |   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <ButtonDebounce> 1.0.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/ButtonDebounce)
|-- <CRC_Check> (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/lib/CRC_Check)
|-- <I2C_EEPROM> 1.5.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/I2C_EEPROM)
|   |-- <Wire> 1.0 (/Users/pdavis/.platformio/packages/framework-arduinoadafruitnrf52/libraries/Wire)
|   |   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <LEDs> (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/lib/LEDs)
|   |-- <NRF52_TimerInterrupt> 1.3.0 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/NRF52_TimerInterrupt)
|   |   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <LiquidCrystal_I2C> 1.1.4 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/LiquidCrystal_I2C)
|   |-- <Wire> 1.0 (/Users/pdavis/.platformio/packages/framework-arduinoadafruitnrf52/libraries/Wire)
|   |   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <SD> 1.2.4 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/SD)
|   |-- <SPI> 1.0 (/Users/pdavis/.platformio/packages/framework-arduinoadafruitnrf52/libraries/SPI)
|   |   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <SPI> 1.0 (/Users/pdavis/.platformio/packages/framework-arduinoadafruitnrf52/libraries/SPI)
|   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
|-- <Utils> (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/lib/Utils)
|-- <Wire> 1.0 (/Users/pdavis/.platformio/packages/framework-arduinoadafruitnrf52/libraries/Wire)
|   |-- <Adafruit TinyUSB Library> 1.7.1 (/Users/pdavis/Documents/eclipse-workspace/3341816_EMU_Converter_Box/Technical/Work/SW/Code/emu_converter_adafruit/.pio/libdeps/adafruit_feather_nrf52840/Adafruit TinyUSB Library)
Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/adafruit_feather_nrf52840/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 11580 bytes from 248832 bytes)
Flash: [=         ]   9.4% (used 76584 bytes from 815104 bytes)
.pio/build/adafruit_feather_nrf52840/firmware.elf  :
section             size        addr
.text              75740      155648
.ARM.exidx             8      231388
.data                836   536895488
.bss               10744   536896324
.heap             223940   536907068
.ARM.attributes       50           0
.comment             126           0
.debug_frame        3568           0
.stabstr             387           0
Total             315399
========================= [SUCCESS] Took 4.01 seconds =========================

NOTE: the output is the same for these two commands when comparing Atom/PlatformIO to VSCode/PlatformIO.

That’s… interesting. Usually TinyUSB is sourced from the framework folder, not as a library dependency as if it were declared in lib_deps.

Do you work on exactly the same project folder (same path) in VSCode and Atom or did you duplicate the folders?

I used to have my libraries defined in PlatformIO.ini but found the version wasn’t matching what was being shown in the graph dependency, so I removed them. I use the same project folder via SVN for both VSCode and Atom. Here is my platformIO.ini:

[env:adafruit_feather_nrf52840]
platform = nordicnrf52
board = adafruit_feather_nrf52840
framework = arduino
lib_archive = no
; This will make the include folder global to all libraries.
build_flags = -I include

Early on I couldn’t get it to compile without including “lib_archive=no”. Not sure what this does.
I’m using a MacBook Pro here macOS Big Sir. I just tried VSCode for this project on Windows 10 and it worked uploading this project. I’m going to reinstall VSCode on my Mac and see if that helps.

I uninstall my VSCode and removed all the resource files:

rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist 
rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist 
rm -fr ~/Library/Caches/com.microsoft.VSCode
rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -fr ~/Library/Application\ Support/Code/
rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -fr ~/.vscode/

Reinstalled VSCode and PlatformIO extension. Now it works uploading my platformio project.