-
• #2
Just quickly looking at the datasheet:
Do you set CS to high?
Is your wiring good?
Is the I2C address correct?For example, have a bunch of INA226 modules that don't use the default I2C address, and SDA and SCL markings on the breakout board are swapped...
-
• #3
Thanks for your help,
1) CS is set to high according to my schematic
2) Wiring is good as far as I can tell
3) I2C address is correct as far as I can tell too, although I have tried many different ones and still get the WHO_AM_I check fail -
• #4
Hi! Which Espruino board are you using? And do you have a link to the accelerometer breakout?
I2C write error is usually because the chip isn't responding - so wrong address, or not wired up right.
It may be that your breakout board doesn't have any pullup resistors on I2C so you could try adding some ~10k resistors to each of the 2 lines.
Of course it's probably a combination of things, so after you added the pullups I'd try setting addr:0x18 as well in case it was the different address that was the issue.
-
• #5
Using Puck.js :)
Yeah so I've polled every address on the I2C bus - the only thing that responds is the humidity sensor. From this I can assume that there must be something wrong with the wiring to the accelerometer.
I'm going to look further into the wiring here and let you know. For those interested in checking whether your sensor(s) can be contacted through I2C:let i2c = new I2C(); i2c.setup({sda: D25, scl: D26}); for (i=0; i<128; i++) { i2c.writeTo(i, 0x0F); console.log("I2C addr is: " + i + ", response: " + i2c.readFrom(i, 1)[0]); }
Espruino version: 2v03
Using LIS2DH12 Module, I2C
Hi Gordon,
I'm struggling to read from the LIS2DH12 accelerometer. The error I get when using the hardware I2C is a bit cryptic (only info I found on this was an old forum post), but when I use software I2C I get a more descriptive error: WHO_AM_I check failed. I have confirmed that I've specified the correct pinouts when instantiating I2C... Was hoping you could give me more information on the errors?
I'm just using the sample code, but here's what I have anyway:
When using hardware I2C, I get a write error:
When using software I2C, I get a who_am_i error:
Thanks!