I am using my Raspberry Pi Pico (and have tried it with Pico 2 and Pimoroni Pico Plus 2W)
Using an I2C scan script it shows the PiicoDev RTC ( RV-3028, and the precision temperature sensor):
from machine import Pin, I2C
i2c = I2C(0, sda=Pin(8), scl=Pin(9))
print(i2c.scan())
prints: [72, 82]
But when I try to use the RTC with the following code (or any code):
from PiicoDev_RV3028 import PiicoDev_RV3028
rtc = PiicoDev_RV3028()
I get the following error:
PiicoDev could not communicate with module at address 0x52, check wiring
Traceback (most recent call last):
File "<stdin>", line 28, in <module>
File "/lib/PiicoDev_RV3028.py", line 84, in __init__
File "/lib/PiicoDev_RV3028.py", line 81, in __init__
OSError: [Errno 5] EIO
I have the Unified and RV3028 library files (and the temperature sensor’s one too, but that works fine) on the Pico.
I have no idea what could be going wrong. I have tried both connectors, reinstalling the necessary libraries and only the RTC doesn’t work. All my other PiicoDev ‘things’ work.
Thank is advance for any support.
1 Like
You could try specifying the I2C pins (as per below) although you should not have to do this as the default is 8,9 in the Unified Library.
rtc = PiicoDev_RV3028(sda=Pin(8), scl=Pin(9))
i2c.scan
is very basic and is not a clear indication of the I2C address working.
ie it does not attempt to communicate with the device just checks to see if the level changes when it addresses it.
Regards
Jim
PS The code I use to check I2C devices. Gives decimal and hex addresses.
from machine import I2C, Pin
i2c=I2C(0,sda=Pin(8),scl=Pin(9),freq=400000)
print('I2C address:')
print('Dec Hex')
devices = i2c.scan()
for i in devices:
print(i,hex(i))
2 Likes
Thank you for the reply, but
Using your script, it confirms that is shows up:
I2C address:
Dec Hex
72 0x48 # Precision Temp
82 0x52 # RTC
But communication with it still fails.
PiicoDev could not communicate with module at address 0x52, check wiring
Traceback (most recent call last):
File "<stdin>", line 10, in <module>
File "/lib/PiicoDev_RV3028.py", line 84, in __init__
File "/lib/PiicoDev_RV3028.py", line 81, in __init__
OSError: [Errno 5] EIO
2 Likes
Hey @Jeremy204988,
It’s good that you can detect the I2C address of this module, but that isn’t always a guarantee that everything else is set up correctly.
I would try to simplify your setup as much as possible to test this by temporarily disconnecting anything else connected to the Pico except for the RTC module. If you could share a few photos of the setup, that would also be super helpful.
That particular error seems to be indicating that it can detect the RTC but can’t correctly communicate data back and forth with it. This could be an issue with the physical wiring, low power to the module, issues with the code on the Pico and a few other things. If you can isolate this module in your setup and post a few photos, we can try and get to the bottom of this. 