RP2040 I2C port 0

Hello all,

I am new to the RP2040, but I am using it (for the first time) on a board with an EEPROM connected to the I2C0 on GPIO0 and GPIO1.
I see that the relevant default pins in the pins_arduino.h file are

// Serial
#define PIN_SERIAL_TX (0ul)
#define PIN_SERIAL_RX (1ul)

and

// Wire
#define PIN_WIRE_SDA (4u)
#define PIN_WIRE_SCL (5u)

I have tried to switch these pins around so that serial is on 4/5 and Wire is on 0/1, but the board now no longer registers as a COM port on one of my prototype boards.

I use a microUSB port connected to RP2040 pins 46 and 47. I am thinking that this is connected to serial and I cannot use serial and i2c 0 at the same time? Can anyone confirm this?

Is there a way for me to use i2c 0 and serial at the sale time?

Udklip2

Changing those code lines doesn't change the configuration of the chip. The configuration of the chip was set when the chip was designed and cannot be altered in this way.

Some chips allow limited re-configuration of the functions of some the pins. I don't think you can do that here.

Hi Paul,

Then I don't quite understand the meaning of "Programmable IO" as per the datasheet "Programmable IO for extended peripheral support"

I clarify that I have no experience with the Nano Connect but with Pi Pico.
The Tx and Rx pins refer to Serial1, they are not used for communication with the console so from the code you can change their assignment.
Check the RP2040 core documentation for how to reassign the I2C and UART pins.
For example, in Pi Pico setRX() and setTX() are used to reassign the pins of a serial port.

Regards

This is the pinout of the RP Pico2040

Yes the alternate use of pins is an option shown by the different colours and yo can only use one of those options at any one time.

Yes just use one set of pins for I2C 0 and another set for Serial.

So you can use pins GP20 & 21for I2C0 and GP7 & 8 for serial. The pins do not even have to be in the pairs shown.

However I am wondering exactly what you have here because pins 46 an 47 do not exist on an RP Pico2040.

Edit:- So it seems you do not have a RP Pico2040, but a Nano Connect. This is more complex to use because only certain pins are connected to the Pico 2040 processor. You need to study the schematic of the Nano Connect to see what pins you actually have access to.

Pins 46 and 47 are the pins of the RP2040 connected to the USB port, they are not user accessible pins.

Hi all and thank you for your input.

I have designed a board (and am working with the first physical version) that uses the RP2040, so I have access to all pins on the IC.
The schematic in my post above shows how it is connected, as per the "minimal" dev board from RPi foundation.

Pins 46/47 are dedicated USB port pins and is what is routed to the microUSB connectos on the Pico.

Would have been good to know this in your original post.

I have it working now, thanks everybody!

I had to add to the code,

#include <Wire.h> // was not added by the library I used

// in setup
Wire.setSDA(0);
Wire.setSCL(1);
Wire.begin();

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