Arduino Nano RP2040 connect not reading I2C from sensor

Hello Arduino,

I am connecting a RP2040 to a Level shifter that connects to a I2C expander (At the very bottom) that receives data from a sensor. Running the set up with other boards works fine but not with the nano RP2040. Please help! Here is a picture. Also I am using the Mega 2560 5V to power the I2C expander chip.

Connecting one single sensor to the I2C on the nano board works fine.

Thank you in advance

A low resolution picture where you can’t see the pin labels is not sufficient description of your circuit. You need to post a schematic, not a physical layout program.

You also need to post your code.

Have you done an I2C scan?
Are you addressing the correct I2C bank?
Have you tried pull up resistors, not sure if your level shifter will supply that.

Try and build things up slowly, just start with a 3V3 I2C device connected directly to the nano. Get that working before connecting your level shifter, attach a 5V I2C device to that and see if that works, and so on. Build up slowly then you can see what works and what doesn’t.

Or look at the signals on an oscilloscope and see where they stop.

Perhaps this deserves its own thread, but I saw this post and wanted to ask here, to make sure that my logic is correct. I may be facing the same problems with the Nano RP2040 Connect. I saw that the post here is more or less what I plan to do, using the Nano RP2040 as a replacement for the Nano Every.

When I looked at the specs of the RP2040, I saw that the processor operates at 3.3 volts (while the Nano Every's ATMEGA runs at 5 volts). The RP2040 has no level-shifter on board, only pull-up resistors to 3.3 volts. Thus, if an I2C sensor operates at +5 volts (or takes in +5 volts and steps it down to 3.3 volts), you absolutely cannot connect it directly to the RP2040 without damaging it, right? That's why you need the off-board level shifter?

Not correct.
A 5volt master/sensor usually works fine on a 3.3volt I2C bus.
You just don't pull it up to 5volt, with software (wire library) or hardware (resistors).

Only a 3.3volt master/sensor can't be pulled up to 5volt.

Thanks for replying, but I just want to make sure. From what you say, you would just simply connect the I2C SCL/SDA lines with no pull-up resistors then?

If the sensor in question (Adafruit Sensor Modules) had pull-up resistors to 5 volts, would you need level shifters in that case? Looking at the sensor that I linked to (here is the schematic), there are 10k pull-ups to VCC (presumed to be +5 volts) as well as to 3.3V on the other side of the on-board level shifter. However, these components are supposed to make the sensor work with 3-5 volts for the sensor regardless of the master.

Looking at the documentation for the RP 2040, it looks like the max voltage for the GPIO pin is 3.6 volts. They can't handle 5 volts. So, if you're powering the sensor with 5 volts, and all you have are the pull ups via the sensor to 5 volts, wouldn't that damage the board?

The Adafruit module you linked has built-in level shifters,
so can directly connect to 5volt or 3.3volt MCUs.

The Adafruit module you linked has built-in level shifters,
so can directly connect to 5volt or 3.3volt MCUs.

I get that, but here's my concern. Please let me elaborate a bit. With the MOSFET level shifter on-board the Adafruit Module, the module can connect to +5 or +3.3 at its VCC pin, and the on-board regulator will take that voltage and output 3.3 volts for the on-board sensor usage.

Now, say you use the Arduino Nano Every. You connect +5 volts from the Nano to the module, module works, everything works. Now, say you just simply replace the Nano with the RP2040. Since the RP2040 operates at 3.3 volts, you can't just wire +5 volts from the RP2040 to VCC on the module, because the pull-up resistors on the Adafruit module will then pull the SCL/SDA lines to +5 volts. Since the RP2040 has no protection for +5 volt voltages, that would damage the processor, right? The right way to do it is to hook up +3.3 volts from the RP2040. That would power the Adafruit module at the correct voltage for the RP2040 to work correctly?
My concern is not whether or not the module can be powered correctly, but about the correct voltages so that the RP2040 doesn't become damaged.

What I'm saying here is that the RP2040 can't be simply used as a drop-in replacement for the Nano Every if your connections are fixed. (Speaking of which, I noticed that the RP2040 Connect has a jumper for VUSB at pin 12 of their header on the bottom of the board; assuming that's +5 volts, since its unpopulated, you wouldn't get a voltage there normally. You would need to short it to get +5 volts on that pin?)

I think you're right there. There seem to be a design error in that module.
The level shifter (MCU side) is pulled up to the input of the regulator (which could be 5volt).
MCU side of an I2C level converter should be powered from MCU VCC.
You can fix that by connecting both VCC and 3.3volt of the module to the 3.3volt supply of the RP.
Or just the VCC pin to 3.3volt (the built-in regulator has a very low dropout voltage).

Thanks for the reply. So, I'm not totally crazy in thinking about this it seems.

So, if my PCB was hard-wired for the Nano Every to power the Adafruit module with +5 volts, replacing it with the RP2040 Connect won't work. Ultimately, as you said, I'll have to connect VCC of the Adafruit Module (which will 'step' it down to 3.3V) to +3.3V on the RP2040.

I guess this shows what needs to be paid attention to. I think Adafruit meant for the module to be used on a breadboard, so VCC can be whatever the MCU's acceptable voltage is at, whether it is set for 3.3/5 volts, or can tolerate both. In this case, the RP2040 is a 3.3V master, so it can't have SCL/SDA pulled to +5 volts.

1 Like

Strictly speaking it would work perhaps for a time, but it eventually it would fail because when the bus is off it would try and pull the I2C lines to 5V. However, the static protection diodes would kick in and limit the voltage on the RP2040 input to the Vcc. However the static protection diodes are not designed for this sort of thing and depending on the impedance of the pull up resistors would fail sooner or later.

This would lead beginners to believe it was fine and would spawn a host of crap tutorials showing no consideration for this problem.

Happily @jchan5 you are made of sterner stuff, well done.

I appreciate the compliment, but this wasn't the first time I had to deal with this issue. Previously, I was concerned about the Portenta, as it was also operating at 3.3 volts. I asked about it, and one guy was especially adamant that that for I2C, the Portenta can't operate at 5 volts. I cut some traces and used a wire to jump pads to 3.3 volts, but that didn't work. More digging showed me that the JST connector for I2C on the Portenta used a 5-volt voltage, which doesn't make sense for the 3.3-volt processor (no level shifters or anything). Then, I looked at the processor's datasheet, and the GPIO pins specified for I2C are 5-volt tolerant, even though the processor operates at 3.3 volts.

It's not so much about me not being a beginner, but more or less me trying to not repeat the same mistakes. You would think that Arduino would put better instructions for this sort of thing, but I hardly see anything about I2C and inter-operability.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.