XIAO nrf52 examples do not compile

Hi,
I also bought the Seeed NRF528240 and Seeed NRF528240 Sense boards. I followed the Wiki to get started with Arduino but run into problems straight away. Found some thread and it seems others have had similar issues for a long time so I am surprised Wiki is still not updated.

I am on Linux Debian with Arduino 1.8.19. Installed Seeed nRF52 Boards 1.1.8.

Following the wiki I could not even compile the blink sketch example! I was getting this error:

exec: "adafruit-nrfutil": executable file not found in $PATH
Error compiling for board Seeed XIAO nRF52840 Sense.

Eventually ended up reading the AdaFruit instructions here

There are two important points of which both are left out from the Seeed Wiki:

  • Use Arduino IDE 1.8.15 or later. I just suppose this applies for the Seeed boards too, right?
  • For Linux you must also install a python package “adafruit-nrfutil”.

However, at least for my Debian system, the Adafruit instruction was not entierly correct. Using the pip3 command yields an error like this:

$ pip3 install --user adafruit-nrfutil
error: externally-managed-environment
...

Instead I followed instructions (left out from error message above). First ensure that you have python package “pipx” installed. Then do:

$ pipx install adafruit-nrfutil; pipx ensurepath

As I understand it, this installs the 3rd party package in some protected environment.
Then I log out and log in (to PATH updated) and NOW the blink sketch compiles and can be flashed to the XIAO board :slight_smile:

Great, happy with that, So moved on to this Wiki example to emulate a bluetooth keyboard:

Chapter “Installation” is rather confusing. First paragraph says

Since the function we apply is packing in the “Seeed nRF52 Boards Library”, we don’t have to install another third-party library. You can skip the step.

My interpretation is that I have to add nothing since all is already included in the board support package. But if so… why was it mentioned?

However, immediately after, the Wiki lists two methods on how to install either “a zip” (which zip?) (method 1) or to add ArduinoBLE library (method 2) from Arduino IDE library manager. It says I “can” download the ArduinoBLE lib. Sure I can but do I also need it?

Following the intial statement, I skip installing anything extra and compiles the example. But fails.

... /.arduino15/packages/Seeeduino/hardware/nrf52/1.1.8/libraries/Adafruit_nRFCrypto/src/Adafruit_nRFCrypto.cpp:71: undefined reference to `SaSi_LibInit'
... and tons of similar lines ...

So then I install the ArduinoBLE library anyway, But compilation still fails.

Is there any way to get that example work? Maybe I am missing something obvious. Any help appreciated!

Hi there,
Those are not compatible Libraries and BSP’s,(the wiki is a TAD confusing on that), but the demos do go with some tweaking to current revisions. To use the ArduinoBLE that works with the other BSP in the list
the embed one 2.7.2 or 2.9.2 is the current one. look in the board manager and make sure to install both BSP’s current ones are (1.1.8) and (2.9.2) .
HTH
GL :slight_smile: PJ

Do you mean that the ArduinoBLE lib will only work with the “Seeed nRF52 mbed-enabked Boards” BSP?

I install these:

  1. BSP “Seeed nRF52 mbed-enabled Boards” version 2.9.2 and
  2. Library “ArduinoBLE” version 1.3.6.

I select board “Seeed XIAO BLE nRF52840 Sense” from the “Seeed nRF52 mbed-enabled Boards”.

I open the “Adafruit Bluefruit nRF52 Libraries → Peripheral → blehid_keyboard” example and compile. This fails. Compiler outputs:

blehid_keyboard:14:10: fatal error: bluefruit.h: No such file or directory
 #include <bluefruit.h>
          ^~~~~~~~~~~~~
compilation terminated.
exit status 1
bluefruit.h: No such file or directory

I also tried to follow the Wiki instruction:

Step 2. Select your development board model and add it to the Arduino IDE. Here we are using “Seeed nRF52 Boards Library”.

There is no such thing as a “Seeed nRF52 Boards Library” but there is a “Seeed nRF52 Boards” BSP so I tried selecting my board from that BSP. But still, compilation just fails.

But maybe I did not understnad what you meant when writing “with some tweaking to current revisions”.
Am I supposed to change anything in the example sketch itself? Or do I still miss some library or BSP?

Hi there,
Yes the Bluefruit only run in the non-mbed environment with the BSP 1.1.X , the ArduinBLE are meant for the embed 2.9.2 BSP. Board Support Packages. there are two type non-embed based on Adafruit core and the embedded based on the Nrf52 sandeep mistry fork of same core.
Either use the all non -embed 1.1.X for those demo’s or rewrite some of the code to support the other.
Lot’s of examples if you search around Seeed, Adafruit, Df-robot, Sparkfun, all pretty much the same, after tweaking.
HTH
GL :slight_smile: PJ

HTH
GL :slight_smile: PJ

When you refer to “the Blufruit” I assume you mean the examples packaged within the Seeed BSP and listed as “Adafruit Bluefruit nRF52 Libraries”

I tried Arduino 2.2 IDE on a Win PC and did manage to compile the “blehid_keyboard” example for the “Seeed XIAO nRF52840 Sense” board. Same thing in Arduino IDE 1.8 on Linux does not work. Compile output lists lots of missed references, like earlier stated. For example:

/home/username/.arduino15/packages/Seeeduino/hardware/nrf52/1.1.8/libraries/Adafruit_nRFCrypto/src/Adafruit_nRFCrypto.cpp:71: undefined reference to `SaSi_LibInit’

It seems the Seeed package for Linux is not functional. Apart from the blink sketch, the Seeed experience stalled. I’m not overly impressed about the need to tweak stuff to even get the examples working at all :(. Feels like walking up a mountain.

If I do manage to get things going with this board, I will report back. But for now, I probably won’t spend more time on navigating Seeeds wiki pages going round in circles.

Thanks for your effort tough! Very much appreciated!

Hello MarkusB.
I think you may have a problem with your Seeed nRF52 Board installation, perhaps you could reinstall 1.1.8 again. It was fine for me when I ran the biehid_keyboard example from the Adafruit Bluefruit nRF52 library

Sorry for the confusion on this part of the confirmation. We’ll review the wiki content again and make changes afterward. Thank you very much for your feedback!

Hello Seeed_Seraphina,

Finally I had some progress.

If I use Arduino IDE 1.8.19, which is the version offered by the Debian 12 Bookworm repositories, the blehid_keyboard example FAIL. There are compiler errors (or rather linker errors). I guess none of the ble examples works but I didn’t try them all.
I reinstalled the Arduino IDE 1.8.19 several times and also removed the hidden ~/.arduino15 folder but result was always the same.

I then downloaded Arduino IDE 2.2.1 appimage and also installed the Seeed nRF52 boards BSP. I try the same blehid_keyboard example and SUCCESS!

Apparently, for some reason the BSP is not compatible with IDE 1.8.19 or there is some bug in the IDE.

B.t.w. I also tried to install the AdaFruit nRF52 boards. Same story, fails in IDE 1.8.19 but works in IDE 2.2.1.