question

Pete avatar image

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)
1 comment
2 |3000 characters needed characters left characters exceeded

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

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

rtc.zip (1.6 KiB)
2 Answers
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 characters needed characters left characters exceeded

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

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! ;-)

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

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

1 comment
2 |3000 characters needed characters left characters exceeded

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

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?

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)