XIAO BLE (Sense) display on XIAO Expansion Board

I ran into issues making my newly purchased XIAO BLE and XIAO BLE Sense devices work with the XIAO Expansion Board display, so I am sharing my findings here.

In a nutshell, the various code examples on the XIAO BLE and Expansion Board wiki pages did not work for me: some constants used by the code have not been defined in the version of the Board Manager that I have, and the function call for setting up the connection with the display does not work with both my XIAO BLE and XIAO BLE Sense devices.

So hereā€™s what I did to make it work:

1. Solving the missing ā€˜SCLā€™ and ā€˜SDAā€™ definitions (optional):

I added 2 lines in ~/Library/Arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/variants/SEEED_XIAO_NRF52840_SENSE/pins_arduino.h :

// Wire
#define PIN_WIRE_SDA        (4u)
#define PIN_WIRE_SCL        (5u)

became

// Wire
#define PIN_WIRE_SDA        (4u)
#define PIN_WIRE_SCL        (5u)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

2. Fixing the sample code on the XIAO BLE wiki page

I changed

U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);

into

U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);

and

U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);

into

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

For instance, here is an example that works fine for me:

#include <Arduino.h>
#include <U8x8lib.h>
#include <Wire.h>
 
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
 
void setup(void) {
  u8x8.begin();
  u8x8.setFlipMode(1);
}
 
void loop(void) {
  u8x8.setFont(u8x8_font_chroma48medium8_r);
  u8x8.setCursor(0, 0);
  u8x8.print("Hello World!");
}

Hope this helps!

2 Likes

Hi jegweb - great you found this oops and thanks for sharing :slightly_smiling_face:

The Xiao BLE looks like a nice little board. Just wondering, have you used the BLE functionality? From what I see (without a Xiao in hand) the Xiao uses the ArduinoBLE.h library as default. For my use, I really need the Adafruit bluefruit.h or SandeepMisty NRF library, but no point going down that path unless the BT of this module works well. Be very interested in your experience on this once you get to it :slightly_smiling_face:

We have been working hard on XIAO RP2040 and XIAO BLE compatible XIAO expansion board. But because of the Spring Festival holiday some time ago, the process was delayed. Thank you so much for your hard work on this project.

Hi Brendan,
I have not yet played with the BLE functionality, but I intend to do so next week.
I will then check the libraries that you mention and keep you posted.

1 Like

Hi Brendan,

I performed some BLE tests (not very extensive yet though), and here are my findings so far:

  • the XIAO BLE is working nicely with ArduinoBLE.
  • Adafruit bluefruit.h and SandeepMisty NRF library canā€™t be used out of the box.

A few observations on the second item:

  • SandeepMisty NRF library is a bit outdated (seems to date from NRF51)
  • Adafruit_nRF52_Arduino is a fork from SandeepMisty NRF library. However, BLE support is packaged within the board manager in Arduino IDE, and not as a separate library. Integration with the XIAO BLE is therefore less trivial for me.
  • Adafruit nRF52 relies on Nordicā€™s S140 SoftDevice, which is already flashed into the XIAO BLE by default (version 7.3.0). However, the S140 API is not present in the board manager of the XIAO BLE, which seems a bit odd to me.

I believe an integration of the XIAO BLE with either the Adafruit nRF52 or SandeepMisty NRF library is possible for someone willing to spend some time on that.

Is there a specific reason why you need to use Adafruit nRF52 or SandeepMisty NRF library?

2 Likes

Hello @jegweb,
I need to make a purchase decision on the Xiao BLE, but I would like to understand the BLE communication programming first.
I canā€™t find example code. It seems you got the examples in the Arduino IDE to work. Is that correct?
Thanks,
P

PS: I wanted to IM you, but I might not have that forum privilege yet. Just joined!

Hi @pescatore,
Indeed the Arduino BLE library is working fine with the XIAO BLE devices.
You can find programming examples in the git repository (check the ā€˜examplesā€™ folder).
You will notice that the Arduino BLE library is quite low level: it does not provide much helper functions to develop standard services. With that library you have to build your BLE services from scratch.
Integration with a higher level library (like SandeepMisty NRF) would be more than welcome.
But for simple BLE interactions this is doing the job.
HTH

3 Likes

In case there still people scanning this thread to check whether Adafruitā€™s bluefruit API can be used with the Xiao BLE, the answer is YES.

I recently experimented that successfully, BUT it requires using the non-MBED version of the board manager => ā€œSeeed nRF52 Boards by Seeed Studioā€ v1.x.x.
Note that the v1.x.x does not seem to support the extra sensors of the XIAO BLE ā€œSenseā€ board.

You said ITā€¦ Hello SEEED engineering? Hellooo, bueller ?
some freshness is in order for sure. Well updated anyway.
I AGREE
YES=Vote
HTH
GL :slight_smile: