Trouble configuring Nano 33 BLE as an I2C Slave

Can't seem to get this new board configured as a slave. In looking at the Wire library (it's using the mbed OS underneath), there is a define that is not set "DEVICE_I2CSLAVE". Without this being set, it doesn't look like calling Wire.begin(...) with a slave address will do anything. But when I try to define DEVICE_I2CSLAVE, I can't seem to get things to compile. And I'm not even sure that is the correct solution. Has anyone been able to configure a Nano 33 BLE as an I2C slave? If so, can you share your insight? Thanks in advance!

TL;DR: At the time of this writing, you can't use the Wire library to implement a Nano 33 BLE or Nano 33 BLE Sense as a I2C slave.

In looking into this further (looking at both the Arduino Wire.cpp source and the mbedos source it uses), it appears that I2C Slave functionality is not implemented at all for the nRF52840 boards. I'm sure this is POSSIBLE, but the mbedos target for the entire nRF52xxx chipset has the slave section simply containing debug printf statements instead of any functional code:

And nothing on the Arduino side is attempting to implement this outside the mbedos world.

Yet another disappointing unimplemented feature on the new Nano 33 BLE boards: They also cannot function as an SPI slave either.

This is bordering on false advertising as Arduino claims "Your code will still work, but remember, it operates at 3.3V". I understand that third-party libraries could have issues but the basics like the Wire library or SPI should have been fully implemented. Buyer beware, these boards are not production-ready and are certainly not able to run previous code in many instances.

Arduino should make clear on their product pages all functionality that is missing due to their reliance on mbedos that has not implemented much of the functionality for the NRF52840 chip.

Hi, I had the same problem and it took me several hours to understand that the slave mode was not implemented in the Wire library for this board. Have you solved the problem in any way? Thank you so much

1 Like

Yeah, it would have been nice if they'd simply thrown in a #pragma warning during compilation instead of never saying a word and have users needing to scope the circuit to even see that the device wasn't responding as a slave.

Anyway, I had to ditch Arduino and MBedOS completely and ported my code to work with the native nRF5 sdk from Nordic. The slave works great under that native SDK without Arduino or MBedOS issues. I will definitely use the nRF52840 going forward as it's extremely flexible but I won't be implementing it with a Nano 33 BLE as there are far better solutions when using the native sdk.

As a side note, I did post an issue in the MBedOS github and was told I was welcome to do a Pull Request and write the functionality myself, but I've never worked with the internals of MBedOS and don't want to learn them just to implement something Arduino really should do, given that they're the ones making money off selling the Nano 33 BLE and Sense, claiming they have the same functionality and more of previous Nanos.

Wow. What a disappointment! I bought two of these boards for use in a project that requires they operate in slave mode along with other devices. Looks like I've wasted my money.

kevingre - are you using the native Nrf5 sdk from Nordic on this board or a different device? Looks like I need to do the same thing.

thank you,
Will

Sorry for the delayed response. I did use the Nano 33 BLE in the native NRF5 sdk initially. For the final board however, I did switch to using just a nRF52840 chip from Raytac (the MDBT50Q-1MV2). It has the advantage of being half the price and has better BLE antenna options. You will need a reflow oven to solder it of course. I did notice that the native solution uses quite a bit less power, especially in sleep mode. There's a lot of overhead in the MBedOS and Arduino code that you no longer have with the native sdk.

You can definitely use the native sdk with the Nano 33 BLE though - it's quite simple. You just define your own "board" via creating a file called "custom_board.h" and defining "BOARD_CUSTOM" in your project. I've attached the one I created. Fair warning as I didn't implement the functionality I wasn't using (like the internal I2C for the on-board components of the ble), but it will be super-easy to define those in the attached file as well. Just grab the schematic of the Nano on this site and you can see how the various sensors are attached to which pins on the microcontroller.

Hope that helps!

nano_33_ble.h (3.73 KB)

Hope you don't mind me asking a side question.

Whilst using the nrf5 sdk with the nano ble, did you use the USB bootloader? Would rather use the USB to reprogram instead of breaking of the soldering iron

Totally agree. Loading via usb is so easy. Yes I did replace the boot loader as well. I ended up using the Adafruit DFU boot loader with a few simple modifications to support the Nano33BLE. It works great. I’m not at my pc at the moment but will upload the file later today that I created to support the Nano.

One Thing to note is you’ll need an SWD debugger like a JLink in order to burn the boot loader. You connect it to the pins on the underside of the board.

I’ll detail the steps when I upload the file later.

@Nuhash,
I created a new thread for how to load the Adafruit bootloader here: Using Adafruit nRF52 Bootloader with Nano33BLE - Nano 33 BLE - Arduino Forum

I didn't want to cloud this thread with too much unrelated info :slight_smile:

Good luck!

fede11:
Hi, I had the same problem and it took me several hours to understand that the slave mode was not implemented in the Wire library for this board. Have you solved the problem in any way? Thank you so much

wbphelps:
Wow. What a disappointment! I bought two of these boards for use in a project that requires they operate in slave mode along with other devices. Looks like I've wasted my money.

These comments were written about six months ago. I just purchased an Arduino Nano BLE Sense specifically for an application as a I2C slave processor, waited about three weeks for it to be delivered (I live in New Zealand), and have just spent an entire evening trying to use it on a master-slave test bench that I'd previously been using successfully with an Arduino Micro. It's only by digging around in the Arduino forums that I found that what would be considered a pretty essential functionality has not been implemented for the BLE Sense.

Like the other people posting on this subject I feel pretty burned by this. I've wasted a lot of money and time now. If the documentation for the BLE Sense had been forthright I wouldn't have bothered purchasing it, as it is not fit for purpose.

Really disappointing. Now I'm wondering what else hasn't been implemented, and if I were to buy a different Arduino model it might not work either. I hate to say but I'll probably dump using Arduinos entirely and go to some other microcontroller board that actually implements what it contracts.