Good Morning:
I'm having some trouble using the i2c bus from my ItsyBitsy RP2040 on Arduino.
I will tell my problem in case someone has happened something similar or can provide a solution or idea.
Thanks in advance:
Background:
I am using the INA3221 module, a voltage and current sensor i2c connection.
I have loaded the Scanner_I2C sample code into ItsyBitsy RP2040 and then connected the INA3221 sensor. Recognizes the I2C address as 0x40. So far everything works as expected.
Then I load an example code from the INA3221 library but it does not work correctly, there is no communication with the sensor. To rule out electrical error or breakage due to static electricity, I have populated several of the ItsyBitsy RP2040 boards that I have (I have tried 3 different boards).
The point is that all the same steps I have tested on the Raspberry PICO board and it works correctly! The Scanner_i2c finds the sensor address 0x40 and later when loading the sample code from INA3221, it communicates and works great.
Why does it work on Raspberry pico board and not ItsyBitsy RP2040 if they both have the same RP2040 microcontroller?
Which one exactly?
The obvious cause would be that the library isn't compatible with the RP2040 core, which wouldn't be a big surprise to me. You could try a different library to see if that works, or alternatively implement very basic functionality in a self-made sketch to verify you can 'talk to' the INA3221 from the RP2040. I'd probably go that route myself but I'm not sure if it's within your skills to do so.
I have tried, with other I2C modules and it happens exactly the same with ItsyBitsy RP2040. But with Raspberry PICO, which has the same RP2040 microcontroller it works wonderfully. So I rule out the incompatibility of the library with the RP2040 kernel.
Ok, I missed that part; you're right, that's strange!
But I don't quite get this part:
Does that mean other I2C devices also don't work with your ItsyBitsy RP2040?
It's a bit of a guess, but it may be related to inappropriate pullups. Many modules have 10k pullups onboard, which is on the weak side. Have you tried putting something like 3k3 or 4k7 pullups between both SCL and SDA and Vdd?
That looks good; I have no clue unfortunately as to why it won't work while the address seems to be detected OK. It sounds like a problem with data corruption to me, but I don't have this hardware around to test it for you.