#LSM6

1 messages ยท Page 1 of 1 (latest)

sacred karma
#

@merry maple lets continue here to avoid the noise in the chat

merry maple
#

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

sacred karma
#

are the RP2040 using arduino right?

merry maple
#

yeap

sacred karma
#

ahhh got it. do you have the adafruit arduino library link?

merry maple
#

One moment

sacred karma
#

thanks I do not use Arduino very often ๐Ÿ™‚

merry maple
#

I think the code is wrong with the i2c scanner ๐Ÿคฆโ€โ™‚๏ธ this is the output in serial monitor

sacred karma
#

Are these sensor from adafruit, I am asking because if they are not sometimes they require a pull pup in the lines

merry maple
#

If you want I can provide you schematics if that's ok?

sacred karma
#

yep

merry maple
#

1 moment

sacred karma
#

Also we are not sure that the device is showing either in 0x6A or 0x6B

merry maple
#

I've tried both i2c addresses in arduino

sacred karma
#

wait my bad downloading the whole thing

merry maple
#

This is the schematic

sacred karma
#

let me take a look

merry maple
#

the rtc is on the same bus with the gyro

sacred karma
#

maybe they are interfering but it will find one or the other, you could try just one

#

they do have the pull up resistor

merry maple
#

Yep

sacred karma
#

R24 and R25

merry maple
#

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

sacred karma
#

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^

merry maple
#

I see

#

I only have the 2 devices on the i2c bus on this board right now

#

Nope I haven't

sacred karma
#

well is strange that the scanner does not found them, so needs mre troubleshooting

merry maple
#

Yep

#

Would it be better if I switch to circuit python?

#

Maybe it will be easier to troubleshoot

sacred karma
#

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

merry maple
#

Sure lets stick with arduino

sacred karma
#

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

merry maple
#

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

sacred karma
#

what do you mean in the board^ the rtc is in the board with the sensor

merry maple
#

Yes it's soldered on if I just remove it

#

It looks like this

sacred karma
#

ah, so thsi board has 3 sensors

merry maple
#

No actually only 2, the BME680 isn't added yet

sacred karma
#

no I do not think that is the problem then

merry maple
#

I see

sacred karma
#

are you the maker of the board?

merry maple
#

Yeap

sacred karma
#

got it, so this is a hat, that you will put to a Raspberry pi?

merry maple
#

No this is a full dev board actually ๐Ÿ˜„

#

It has an rp2040 and esp32

sacred karma
#

oh boy ๐Ÿ™‚

merry maple
#

Yeap, everything on the board works except the i2c bus to the rp2040

sacred karma
#

do you have something to see the data in the SDC and SCK lines^

merry maple
#

Nope

sacred karma
#

๐Ÿ˜ฆ

merry maple
#

This is very complicated now ๐Ÿ˜„

sacred karma
#

you could use psygrok using another pico to see what are the messages on the lines

#

Yes, I agree ๐Ÿ˜†

merry maple
#

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

sacred karma
#

yes easier

#

but we have the same tool, we use the scanner

merry maple
#

I see

sacred karma
#

but if the scanner could not find any chip, the problem is with something else, either the sensor or the board

merry maple
#

Are you able to find me a better i2c scanner for arduino

sacred karma
#

you could try the RP20 alone wiht another sensor

#

Not really, I am a circuipython person ๐Ÿ™‚

merry maple
#

I see let me try to do that

sacred karma
#

no worries,

merry maple
#

๐Ÿคฆโ€โ™‚๏ธ none of the i2c scanner codes I use work

sacred karma
#

ohhh nooooooooooo

#

maybe is the pin selection, you need to order a cheap sensor to test, that has already the i2c connector

merry maple
#

the pin selection is definitely fine

sacred karma
#

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 ๐Ÿ˜†

merry maple
#

I've never heard of it before

sacred karma
#

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

merry maple
#

let me see