Hi there
I have the following issue.
-
Setup:
Stack with Pico WH / Display Pack 2.0 / Waveshare Pico-RTC-DS3231
https://shop.pimoroni.com/products/pico-display-pack-2-0
https://www.waveshare.com/pico-rtc-ds3231.htm -
Pimoroni build of Micropython:
pimoroni-picow-v1.22.2-micropython.uf2 -
The RTC module works fine without the Display Pack attached. Time can be set and read.
-
As soon as the Display Pack is attached I either get this error message:
Traceback (most recent call last): File "<stdin>", line 27, in <module> File "<stdin>", line 23, in PicoRTCReadTime OSError: [Errno 110] ETIMEDOUT
-
Or, for whatever reason I managed exactly once to read the time, but it was faulty.
-
I have tried machine.I2C and machine.SoftI2C
-
According to to the schematics both modules use GP20 and GP21, could that be the issue?
I very much appreciate your help!
This is the code for the RTC module:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from machine import I2C, SoftI2C, Pin
import time
address = 0x68
register = 0x00
#sec min hour week day month year
CurrentTime = b'\x00\x42\x21\x01\x19\x05\x24'
week = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
# I2C-Pins
i2c_sda = Pin(20)
i2c_scl = Pin(21)
# Initialisation
bus = I2C(0,sda=i2c_sda,scl=i2c_scl,freq=400000)
def PicoRTCSetTime():
bus.writeto_mem(int(address),int(register),CurrentTime)
def PicoRTCReadTime():
return bus.readfrom_mem(int(address),int(register),7);
# PicoRTCSetTime() #You can remove this line once time is set
while 1:
data = PicoRTCReadTime()
a = data[0]&0x7F #sec
b = data[1]&0x7F #min
c = data[2]&0x3F #hour
d = data[3]&0x07 #week
e = data[4]&0x3F #day
f = data[5]&0x1F #month
g = data[6]&0x3F #year
print("20%x/%02x/%02x %02x:%02x:%02x %s" %(g,f,e,c,b,a,week[d-1])) #year,month,day,hour,min,sec,week
time.sleep(1)