Compiling for Seeed Studio XIAO nRF52840 Sense Plus (SKU 102010694)

Hi,

I have an issue with my XIAO nRF52840 Sense Plus, this code “runs”:

#define LEDRED        (11u)
#define LEDGREEN        (12u)
#define LEDBLUE        (13u)
void setup() {
  pinMode(LEDRED, OUTPUT);
  pinMode(LEDGREEN, OUTPUT);
  pinMode(LEDBLUE, OUTPUT);
}

void loop() {
  digitalWrite(LEDRED, HIGH);
  delay(100);
  digitalWrite(LEDRED, LOW);
  delay(100);
  digitalWrite(LEDGREEN, HIGH);
  delay(100);
  digitalWrite(LEDGREEN, LOW);
  delay(100);
  digitalWrite(LEDBLUE, HIGH);
  delay(100);
  digitalWrite(LEDBLUE, LOW);
  delay(100);
}

Couple comments about code above:

  • The PIN numbers I’m using are not the ones on the schematic, I found these by try/error,
  • I do verify, then upload, it says it works but then it does not do anything.
  • I then run Sketch → Export Compiled Library
  • I had to download Adafruit_nRF52_Bootloader, go to lib/uf2/utils/ and run: python3 uf2conv.py /Users/albertocole/Documents/Arduino/blink_2/build/Seeeduino.mbed.xiaonRF52840SensePlus/blink_2.ino.hex -c -f 0xADA52840

this process is the only way I’ve found to make this thing run code, and on top of that, when I add Serial stuff to try to debug anything, program wont run. I feel like I’m lost with this, just need to know what’s the best way to program with this, I also tried with circuitpython .uf2 (Seeed Studio XIAO nRF52840 (Sense) Download) and it never changed the drive name to CIRCUITPY, so I’m even wondering if I did something to this board that made it unstable/faulty, is there a way to know that?

Thanks in advance

Hi,

Well, we have tested it with the build in macros, and it seems this USER LED behave as expected.

#include "Adafruit_TinyUSB.h"
#define LEDRED  LED_RED
#define LEDGREEN LED_GREEN
#define LEDBLUE LED_BLUE
void setup() {
  pinMode(LEDRED, OUTPUT);
  pinMode(LEDGREEN, OUTPUT);
  pinMode(LEDBLUE, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  Serial.println("Shiny Red");
  digitalWrite(LEDRED, HIGH);
  delay(1000);
  digitalWrite(LEDRED, LOW);
  delay(1000);
  Serial.println("Bright Green");
  digitalWrite(LEDGREEN, HIGH);
  delay(1000);
  digitalWrite(LEDGREEN, LOW);
  delay(1000);
  Serial.println("Melancholy Blue");
  digitalWrite(LEDBLUE, HIGH);
  delay(1000);
  digitalWrite(LEDBLUE, LOW);
  delay(100);
}


Video (Link valid for 7 days):

/Users/albertocole/Documents/Arduino/libraries/Adafruit_TinyUSB_Library/src/tusb_config.h:57:4: error: #error TinyUSB Arduino Library does not support your core yet
#error TinyUSB Arduino Library does not support your core yet
^~~~~
exit status 1

Compilation error: exit status 1

That’s what I get when copying your code.

And if I change it for the non-mbed board, I then get this:

/Users/albertocole/Library/Arduino15/packages/Seeeduino/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-objcopy -O ihex /Users/albertocole/Library/Caches/arduino/sketches/078673FB8D8E04F4B01756D8AFB30FF7/blink_2.ino.elf /Users/albertocole/Library/Caches/arduino/sketches/078673FB8D8E04F4B01756D8AFB30FF7/blink_2.ino.hex
/Users/albertocole/Library/Arduino15/packages/Seeeduino/hardware/nrf52/1.1.9/tools/adafruit-nrfutil/macos/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x0123 --application /Users/albertocole/Library/Caches/arduino/sketches/078673FB8D8E04F4B01756D8AFB30FF7/blink_2.ino.hex /Users/albertocole/Library/Caches/arduino/sketches/078673FB8D8E04F4B01756D8AFB30FF7/blink_2.ino.zip
Traceback (most recent call last):
File “main.py”, line 317, in
File “click/core.py”, line 1134, in call
File “click/core.py”, line 1040, in main
File “click/_unicodefun.py”, line 100, in _verify_python_env
RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult Unicode Support — Click Documentation (8.1.x) for mitigation steps.

This system lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8
[41457] Failed to execute script main
Multiple libraries were found for “Adafruit_TinyUSB.h”
Used: /Users/albertocole/Documents/Arduino/libraries/Adafruit_TinyUSB_Library
Not used: /Users/albertocole/Library/Arduino15/packages/Seeeduino/hardware/nrf52/1.1.9/libraries/Adafruit_TinyUSB_Arduino
Using library Adafruit TinyUSB Library at version 3.4.2 in folder: /Users/albertocole/Documents/Arduino/libraries/Adafruit_TinyUSB_Library
Using library SPI at version 1.0 in folder: /Users/albertocole/Library/Arduino15/packages/Seeeduino/hardware/nrf52/1.1.9/libraries/SPI
exit status 1

Compilation error: exit status 1

Let me know what options I have

Sorry that I don’t possess a Mac to reproduce this issue, on Windows everything seems to be OK. For your reference:

I made it to run that code on a ubuntu box I setup with UTM, found that there’s no Arduino IDE for ubuntu arm (using a M2 Pro), installed the Arduino legacy one, and I was able to run your code, so def something on mac setups, now, I then do the upload button and it still wont do anything, even by changing your code to use 11,12,13 pins, thx for you help I’ll keep digging.