I want to use the bluefruit dual role bleuart
but I ALSO need the IMU
Does anyone know how to do this… i have been banging my head against the wall trying to find a way to accomplish this.
How did it get working in mbed core? i want to replicate whatever made it work on the blue fruit library
fe7565
September 27, 2022, 8:03pm
#2
Assuming you are using this: Dual Roles BLEUART | Bluefruit nRF52 Feather Learning Guide | Adafruit Learning System
Check in the two board variant files and make sure that the XIAO IMU I2C control pin(s) are not being used by the Adafruit dual UART program.
Even the seed lsm6ds3 library examples dont work on the non embed version
Wire1 just plain doesnt work
Can someone please tell me what they did to get it working in later versions?
fe7565
September 28, 2022, 3:05am
#4
This one works on version 1.0
/*
Arduino LSM6DS3 - Simple Gyroscope
This example reads the gyroscope values from the LSM6DS3
sensor and continuously prints them to the Serial Monitor
or Serial Plotter.
The circuit:
Arduino Uno WiFi Rev 2 or Arduino Nano 33 IoT
created 10 Jul 2019
by Riccardo Rizzo
This example code is in the public domain.
*/
#include <Arduino_LSM6DS3TR_C.h>
void setup() {
Serial.begin(9600);
while (!Serial);
if (!IMU.begin()) {
Serial.println(“Failed to initialize IMU!”);
while (1) yield();
}
Serial.print(“Gyroscope sample rate = “);
Serial.print(IMU.gyroscopeSampleRate());
Serial.println(” Hz”);
Serial.println();
Serial.println(“Gyroscope in degrees/second”);
Serial.println(“X\tY\tZ”);
}
void loop() {
float x, y, z;
if (IMU.gyroscopeAvailable()) {
IMU.readGyroscope(x, y, z);
Serial.print(x);
Serial.print('\t');
Serial.print(y);
Serial.print('\t');
Serial.println(z);
}
}
Hi Matthew_DeBlock
It may not be the right way, but I am using the IMU implemented in “Seeed XIAO nRF52840 Sense” on “Seeed nRF52 Borads 1.0.0” (non mbed) in the following way
Board library: Seeed nRF52 Borads 1.0.0 (non mbed)
Board : Seeed nRF52 Borads / Seeed XIAO nRF52840 Sense
IMU library: Seeed_Arduino_LSM6DS3
–>Replace “Wire” in LSM6DS3.cpp with “Wire1”.
1 Like
the
Seeed Arduino Lsm6ds3 library already does that, doesn’t it?
it has …
#define Wire Wire1
(on line 36 of LSM6DS3.cpp)
When I use this library i get garbage data, a bunch of repeating values that never change and a bunch of errors reports.
“#define Wire Wire1” does not work as expected, so I rewrote Wire to Wire1.
My sketch is attached for reference. The comments are in Japanese so I don’t think you can read them, but please bear with me.
nRF52_XIAO_IMU_Madgwick_peripheral.zip (17.4 KB)
@msfujino and @Matthew_DeBlock
The reason “#define Wire Wire1” doesn’t work with embed is the target processor type has a slightly different name.
For non-embed code it is
TARGET_SEEED_XIAO_NRF52840_SENSE=1
And on the embed version it uses:
ARDUINO_Seeed_XIAO_nRF52840_Sense=1
You can see what the two versions are by turning on compilation verbosity.
File->Preferences
Check box for “Show verbose output during compile”.
So instead of editing the entire file and changing all Wire to Wire1 you can edit and change from:
#ifdef TARGET_SEEED_XIAO_NRF52840_SENSE
#define Wire Wire1
#endif
To:
#if defined(TARGET_SEEED_XIAO_NRF52840_SENSE)
#define Wire Wire1
#elif defined(ARDUINO_Seeed_XIAO_nRF52840_Sense)
#define Wire Wire1
#endif
Hi Don.Small,
Thanks for the information. I have confirmed that it works.
Why don’t you post it to “Lib for Seeed Xiao Sens, IC2 wire1 define not OK · Issue #10 · Seeed-Studio/Seeed_Arduino_LSM6DS3 · GitHub ” for an official fix for the library?
1 Like