#LSM6
1 messages ยท Page 1 of 1 (latest)
Sure
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
while (!Serial);
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for (address = 1; address < 127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.print(address, HEX);
Serial.println(" !");
nDevices++;
} else if (error == 4) {
Serial.print("Unknow error at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.println(address, HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
} else {
Serial.println("Scan completed\n");
}
delay(5000); // Wait 5 seconds for next scan
}
This is the code I have
are the RP2040 using arduino right?
yeap
ahhh got it. do you have the adafruit arduino library link?
One moment
thanks I do not use Arduino very often ๐
I think the code is wrong with the i2c scanner ๐คฆโโ๏ธ this is the output in serial monitor
Are these sensor from adafruit, I am asking because if they are not sometimes they require a pull pup in the lines
If you want I can provide you schematics if that's ok?
yep
1 moment
Also we are not sure that the device is showing either in 0x6A or 0x6B
I've tried both i2c addresses in arduino
wait my bad downloading the whole thing
This is the schematic
let me take a look
the rtc is on the same bus with the gyro
maybe they are interfering but it will find one or the other, you could try just one
they do have the pull up resistor
Yep
R24 and R25
I think it's fine because the rtc comes after the gyro i'm not sure
But I can't seem to work with the rtc aswell
well I2C is a bus, so if the rtc and the sensor have the same address they it could collide, but I have not seen that like ever.. ๐
normally it will fin one
the scanner I mean
question, , have you use this scanner with other sensors^
I see
I only have the 2 devices on the i2c bus on this board right now
Nope I haven't
well is strange that the scanner does not found them, so needs mre troubleshooting
Yep
Would it be better if I switch to circuit python?
Maybe it will be easier to troubleshoot
depending on what do you want to do..
I wil stick with arduino if you need speed
I will go to CP if you need to troubleshoot understand, and iterate
Sure lets stick with arduino
Try one of the two alone to see if that works, you could add physical pull-up maybe they are in the schemtaics but not really working
I see
I have an idea, maybe I'll just break the rtc chip off on one of my boards and see if it works
what do you mean in the board^ the rtc is in the board with the sensor
ah, so thsi board has 3 sensors
No actually only 2, the BME680 isn't added yet
no I do not think that is the problem then
I see
are you the maker of the board?
Yeap
got it, so this is a hat, that you will put to a Raspberry pi?
oh boy ๐
Yeap, everything on the board works except the i2c bus to the rp2040
do you have something to see the data in the SDC and SCK lines^
Nope
๐ฆ
This is very complicated now ๐
you could use psygrok using another pico to see what are the messages on the lines
Yes, I agree ๐
I see
There isn't alot of code for this gyro chip
If we switch to circuit python will it be easier to find the issue
I don't mind at the moment
I see
but if the scanner could not find any chip, the problem is with something else, either the sensor or the board
Are you able to find me a better i2c scanner for arduino
you could try the RP20 alone wiht another sensor
Not really, I am a circuipython person ๐
I see let me try to do that
no worries,
๐คฆโโ๏ธ none of the i2c scanner codes I use work
ohhh nooooooooooo
maybe is the pin selection, you need to order a cheap sensor to test, that has already the i2c connector
the pin selection is definitely fine
I do not rememebr if the Pico has DAC, if so you could read if the pin are sending the info
is very strange that the scanner doe snot work, normally that is a connection problem rather than a software problem, but you know, the problem is where you look the least ๐
Whyyou don try this https://discord.com/channels/327254708534116352/1072944426780983406, is cheap and convenient
I've never heard of it before
so you could use your pico as an oscilloscope or siganl decoder...
if you prefer a "commercial solution@ there are signal readers from sparkfun at 25 dollars
let me see