Adafruit Feather nRF52840 Sense Upload Issue

I have an Adafruit Feather nRF52840 Sense board that I’m trying to get work with PlatformIO. I selected the Adafruit Feather Bluefruit Sense for the board for the project.

First issue (no idea how to fix): After uploading code to the board, the board automatically disconnects from the USB port, and no longer shows up as a comport (I’m on windows). I’m confident the code uploaded correctly, as I’ve been able to successfully test the onboard LEDs/button. The only way I can get the board to connect to USB again is to double-tap the reset button, which terminates the code I uploaded. This appears not to be an issue when I upload code via the Arduino IDE.

Second issue (have a workaround): weirdly I could not get code using Serial to compile initially. After some troubleshooting, I installed Adafruit_TinyUSB into the project, and it now compiles, even if I don’t have “#include <Adafruit_Sensor.h>” in the code. Curious if anyone knows what’s going on here?

Thanks in advance,

First of all you should make sure that you’re using the latest core version, the platform recently had an update. Open a CLI and execute pio platform update nordicnrf52.

Is a Serial.begin(115200); in the sketch?

Hm I see that issue too, a simple Serial.begin(115200); leads to

.pio\build\adafruit_feather_nrf52840_sense\src\main.cpp.o: In function `setup':
main.cpp:(.text.setup+0xc): undefined reference to `Serial'
main.cpp:(.text.setup+0x6): undefined reference to `Adafruit_USBD_CDC::begin(unsigned long)'

I then discovered that this breakage was intentional per issue. The USB has been removed from the core and was refactored as a library, so now at least

#include <Arduino.h>
#include "Adafruit_TinyUSB.h"

void setup() {
void loop() {

is required.

However, as I can see in a verbose build, the library is linked as an archive and not as object files, which is required for libraries implementing an interrupt vector (such as, USB interrupts…). This won’t work. Additionally,

lib_archive = no

(docs) has to be added to the platformio.ini.

Can you try it that way?

If you did that via lib_deps or the library manager, that is wrong, because the core already contains the corretc TinyUSB version. You should not add a different one. Try the way above first and remove any previous lib_deps declarations.


Incredible. Thank you for your comprehensive reply @maxgerhardt.

After following your instructions, it appears that it’s working as desired now.

I had already done the update prior to my first post, so I don’t think that was part of the problem.

My actions (in accordance with your instructions):
(1) I added lib_archive = no to my platformio.ini file
(2) I had previously installed Adafruit_TinyUSB via the library manager, so I removed that from lib_deps
(3) Added #include "Adafruit_TinyUSB.h" to my code

Like I said, appears to be working now–I really appreciate your help (and the issue link re: Serial, not sure why I hadn’t found that previously).

1 Like

Glad to hear it worked – I’ve opened issue Add notes for USB Serial · Issue #119 · platformio/platform-nordicnrf52 · GitHub to get this resolved more cleanly.