What is the model of your router, how your RTC device is connected? No need to mention python for now.
Show the output of logread | grep -i i2c after reboot. Please use forum formatting (</> icon).
Install kmod-rtc-ds1307 and run echo ds3231 0x68 > /sys/bus/i2c/devices/i2c-0/new_device and check the log again.
If the RTC module is recognized then you can access it with hwclock.
If not - install i2c-tools and execute i2cdetect 0.
Check from the OpenWrt GUI what is the right package for ds1307 and load it. Make sure the package list is updated.
Please run i2cdetect -l and show the result.
root@sensorial_new:/# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x08-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
When I execute my program return
root@sensorial_new:/etc/pcf8563# python uprtc.py
Traceback (most recent call last):
File "/etc/pcf8563/uprtc.py", line 80, in
i2c = mraa.I2c(0)
File "/usr/lib/python3.10/site-packages/mraa.py", line 528, in init
this = _mraa.new_I2c(bus, raw)
ValueError: Invalid i2c bus
You don't need kmod-i2c-gpio when you use native I2C interface.
I cannot comment on your program behaviour but now you should be able to access your RTC module by using hwclock.
echo ds3231 0x68 > /sys/bus/i2c/devices/i2c-0/new_device
needs to be re-applied after reboot.
Please repeat logread | grep -i 'i2c\|rtc' afterwards. Please temporary remove your python script(s) from startup.
With kmod-rtc-ds1307 driver loaded you should see a line saying rtc core: registered ... as rtc0
next to the following line: i2c i2c-0: new_device: Instantiated device ds3231 at 0x68
Now I see why someone may need an app to work with RTC module. As far as I understand, the Python application you are trying to use communicates directly with the module, no driver is required and the app only needs to know I²C bus information and module address.
I posted a question in Developers section, so will see...