Hi,
I have a setup where I have a Raspberry Pi communicating with various sensors and an Arduino Nano 33 IoT over I2C (RPi master, Nano slave). I want to access the accelerometer data of the LSM6DS3 on the Nano IoT.
I can read the LSM6DS3 data on the Nano IoT, but as soon as I start the communication functions from the Nano IoT to talk to the LSM6DS3, I2C communication breaks down, and I can't send the data to the RPi.
Using i2cdetect on the RPi, I can see the LSM6DS3 is present with the two addresses 0x60 and 0x6A. And according to this communication it should be possible to fetch the data from the LSM6DS3 directly over I2C from the RPi.
And I can! But I get the same response over I2C from the LSM6DS3 every time, no matter how I position the Nano; turning it on one side should give me different data, right? But I keep getting the same figures.
Do I have to send a specific command to a specific register over I2C to get the LSM6DS3 to do a new reading? And is there some documentation for how to control and poll the LSM6DS3 over I2C?
That is a 3.3V ARM M0+ processor with a NINA-W102 block for Wifi.
All SDA and SCL on the board are connected and there are 4k7 pullup resistors.
I think that 0x60 is for the crypto chip and 0x6A is for the LSM6DS3.
You should be able to use them with Raspberry Pi, but the Arduino may not use them at the same time.
If both the Arduino and the Raspberry Pi are a Master, then they might be active at the same time. Only one can be the Master.
This could get quite involved. Please give us a Schematic showing all hardware with links, power, ground, interconnections, etc for your project, not a frizzy thing. Also include your software and a short explanation as to how you determine the master or pass the token?
You can't have the Arduino use hardware I2C to access the accelerometer and act as a slave for the RPi at the same time.
The straightforward approach would be for the Arduino to collect accelerometer data and send it via UART or Software Serial to the RPi. Better, buy an accelerometer module and connect it to the RPi directly.
Thank you for your replies.
This is/was not caused by faulty connections.
I2C is working - I have distance sensors connected to the Nano IoT also, and I have working I2C communication between the RPi and Nano IoT sending me the measured distances.
So that part is OK.
And my setup actually seems to be working now. I was preparing an answer to Koepel with code and output, and when I came to the part where I got figures that didn't change no matter ho I turned the Nano IoT, I started to get changing figures
The only change made is I swapped the Nano IoT for another one. I think the Nano IoT was faulty. It was brand new, but a part of it broke off(!) and I changed it.
So thanks for your replies, guys. I'll now have to figure out how to interpret the bytes I receive.
jremington:
You can't have the Arduino use hardware I2C to access the accelerometer and act as a slave for the RPi at the same time.
Hi jremington,
My experience exactly - I think I wrote that in the OP.
And I actually came from a setup with a separate MPU6050 accelerometer attached to a classic Arduino Nano, so using the integrated IMU of the Nano IoT seemed like an extra bonus.
Anyway, as I wrote to Koepel and gilschultz, I seem to get live data now by polling the LSM6DS3 directly on I2C address 0x6A from register 0x28 and up. A part physically fell off my first Nano IoT, so I think it might be faulty wrt. the LSM6DS3 too.
Anyway, thanks again for your efforts, guys, it is much appreciated.
Kind regards
Martin