question

Pete avatar image
Pete asked

echo: write error: Invalid argument hwclock:

Hi all,

Complete error message is...

echo: write error: Invalid argument
hwclock: can't open '/dev/misc/rtc': No such file or directory

Would appreciate any help/info and suggestions!

Thanks,

Pete.

Venus OSmodifications
127.jpg (51.3 KiB)
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

powerace avatar image powerace commented ·

Hi Pete,

I hope you have the RTC working by now. I got it working in the end but it took me quite some effort. Nevertheless i made a small step by step guide again it might be helpfull for other people.

In the picture above i see you are trying to run rc.local from /data. It should be located in /etc and should have the right permissions ofcourse. Furthermore before you use the command "i2cdetect -y 1" you always have to execute "modprobe i2c-dev" else i2cdetect won't work.

RTC.zipSteps to install RTC.txtconfig.txt

0 Likes 0 ·
rtc.zip (1.6 KiB)
sarah1331 avatar image sarah1331 powerace commented ·

please help me i have tried everything on the web and you sound knowlageable

step 5 i get no UU



screenshot-2023-12-20-152903.png

rtc DS3231 connected to pin 1,3,5,7,9



0 Likes 0 ·
2 Answers
jeroend avatar image
jeroend answered ·

allright, so what is exactly defined in the rc.local file? For the hardware clock (expander pi I believe you have) the line in rc.local should look like this;
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -s

In the /u-boot/overlays folder should be the following file;
ds1307-rtc-overlay.dtb

It should also be called in the config.txt eg like this (in the [all] section):
dtoverlay=mcp3208:spi0-0-present,i2c-rtc,ds1307-rtc

Last but not least, did you install the the module? If not:
opkg install kernel-module-rtc-ds1307

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Pete avatar image Pete commented ·

Hi,

rc.local =

/u-boot/overlays/ =

config.txt =

opkg kernel =

mesg =

[    1.468997] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

[    7.800661] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[    7.800672] F2FS-fs (sda): Can't find valid F2FS filesystem in 1th superblock
[    7.808865] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[    7.808874] F2FS-fs (sda): Can't find valid F2FS filesystem in 2th superblock
[    7.816481] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[    7.816489] F2FS-fs (sda): Can't find valid F2FS filesystem in 1th superblock
[    7.824109] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[    7.824117] F2FS-fs (sda): Can't find valid F2FS filesystem in 2th superblock

[   11.551147] i2c i2c-1: new_device: Instantiated device ds1307 at 0x68
[   11.564314] rtc-ds1307: probe of 1-0068 failed with error -5

Found some other errors while checking with mesg?

0 Likes 0 ·
128.jpg (97.3 KiB)
129.jpg (74.9 KiB)
130.jpg (72.9 KiB)
131.jpg (44.0 KiB)
115.jpg (871.8 KiB)
nighteagle avatar image nighteagle commented ·

If i want to install via opkg install kernel-module-rtc-ds1307

I became the message:

No packages installed or removed.


0 Likes 0 ·
jeroend avatar image
jeroend answered ·

The relevant section is here I think:

[ 11.551147] i2c i2c-1: new_device: Instantiated device ds1307 at 0x68
[ 11.564314] rtc-ds1307: probe of 1-0068 failed with error -5

what does it do if you manually 'read' the clock? e.g. by simply typing the command

hwclock

(you did double check the content of the .dtb file right? ;-))

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Pete avatar image Pete commented ·

Hi,

I get the same no file or directory message...

I've either got something connected wrong or it's not working as intended?

.dtb file checked and double checked... All good! ;-)

0 Likes 0 ·
jeroend avatar image jeroend Pete commented ·

It should 'just' work. To check myself I took an older image of my rpi setup on v2.58 release and checked again, the hwclock command returns the expected line with the time. Since you cannot execute the command from the prompt, it makes sense you also cannot execute it automatically via the rc.local so lket's step through the items 1-by-1;
- there is a (working) battery installed in the explander pi
- the expander pi is connected to the raspberry pi correctly
- .dtb file is correct and in the right place (you already checked that)
- config.txt has the line in the [all] section for the ds1307
dtoverlay=mcp3208:spi0-0-present,i2c-rtc,ds1307-rtc

0 Likes 0 ·

Related Resources

Victron Venus OS Open Source intro page

Venus OS GitHub (please do not post to this)

Experiments, Modifications and Adaptions. Mods (Modifications) can be made to Victron Software by the Community. Please use the modifications space for enthusiasts who want to push what is possible, without official Victron Support.