Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default with RTC driver and hwclock...; #11

Open
lebardix opened this issue Jan 31, 2017 · 8 comments
Open

default with RTC driver and hwclock...; #11

lebardix opened this issue Jan 31, 2017 · 8 comments

Comments

@lebardix
Copy link

i have post an issue on http://www.bananapi.com/bbs/Show.aspx?tid=909&page=2
hwclock return bad date, confusing day and seconde.
I am testing with release tohax@bdf9584 , the same problem exist.
the rtc device is DS1337S in schematic bananapi-D1

datasheet of DS1337S https://datasheets.maximintegrated.com/en/ds/DS1337-DS1337C.pdf
with tool i2c-test i can read rtc device

[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6
Open i2c device successfully !
Set slave addr to 0x68!
Read 0x0039 from 0x68[0x00]            <-- seconde in rtc device [00-59]
Read 0x0046 from 0x68[0x01]            <-- minute   in rtc device [00-59]
Read 0x0001 from 0x68[0x02]            <-- hour       in rtc device [00-23 or 00-11]
Read 0x0004 from 0x68[0x03]            <-- day       in rtc device [1-7]
Read 0x0011 from 0x68[0x04]            <-- date       in rtc device [1-31]
Read 0x0001 from 0x68[0x05]            <-- mounth  in rtc device [1-12]
Read 0x0000 from 0x68[0x06]            <-- year       in rtc device [00-99]

[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6; date -u; hwclock
Open i2c device successfully !
Set slave addr to 0x68!
Read 0x0005 from 0x68[0x00]
Read 0x0021 from 0x68[0x01]
Read 0x0002 from 0x68[0x02]
Read 0x0004 from 0x68[0x03]
Read 0x0011 from 0x68[0x04]
Read 0x0001 from 0x68[0x05]
Read 0x0000 from 0x68[0x06]
Fri Jan 13 01:21:10 CST 2017          **<-- GMT system date**
Sat Jan  5 02:21:05 2002  0.000000 seconds   **<-- hwclock**

decoding rtc registers say : [04]=Fri [01]=Jan [11]=13 [00]=2000 [02][21][05]=02:21:05
content register was set by ntpd -q -p pool.ntp.org (error on year ...?),

But when read register with hwclock more errors ( seem read register 00 as day and register 01 as month and register 02 as year ......)

[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6; date -u ; hwclock
Open i2c device successfully !
Set slave addr to 0x68!
Read 0x0005 from 0x68[0x00]
Read 0x0043 from 0x68[0x01]
Read 0x0002 from 0x68[0x02]
Read 0x0004 from 0x68[0x03]
Read 0x0011 from 0x68[0x04]
Read 0x0001 from 0x68[0x05]
Read 0x0000 from 0x68[0x06]
Fri Jan 13 01:43:09 UTC 2017
Tue Mar  5 02:43:05 2002  0.000000 seconds
[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6; date -u ; hwclock
Open i2c device successfully !
Set slave addr to 0x68!
Read 0x0006 from 0x68[0x00]
Read 0x0043 from 0x68[0x01]
Read 0x0002 from 0x68[0x02]
Read 0x0004 from 0x68[0x03]
Read 0x0011 from 0x68[0x04]
Read 0x0001 from 0x68[0x05]
Read 0x0000 from 0x68[0x06]
Fri Jan 13 01:43:11 UTC 2017
Wed Mar  6 02:43:06 2002  0.000000 seconds
[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6; date -u ; hwclock
Open i2c device successfully !
Set slave addr to 0x68!
Read 0x0007 from 0x68[0x00]
Read 0x0043 from 0x68[0x01]
Read 0x0002 from 0x68[0x02]
Read 0x0004 from 0x68[0x03]
Read 0x0011 from 0x68[0x04]
Read 0x0001 from 0x68[0x05]
Read 0x0000 from 0x68[0x06]
Fri Jan 13 01:43:12 UTC 2017
Thu Mar  7 02:43:07 2002  0.000000 seconds
[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6; date -u ; hwclock
Open i2c device successfully !
Set slave addr to 0x68!
Read 0x0031 from 0x68[0x00]
Read 0x0043 from 0x68[0x01]
Read 0x0002 from 0x68[0x02]
Read 0x0004 from 0x68[0x03]
Read 0x0011 from 0x68[0x04]
Read 0x0001 from 0x68[0x05]
Read 0x0000 from 0x68[0x06]
Fri Jan 13 01:43:35 UTC 2017
Sun Mar 31 02:43:31 2002  0.000000 seconds
[root@Lamobo-D1 ~]$ /mnt/local/bin/i2c-test r 0x68 0 0x6; date -u ; hwclock
Open i2c device successfully !/mnt/local/bin/i2c-test r 0x68 0 0x6
Set slave addr to 0x68!
Read 0x0038 from 0x68[0x00]
Read 0x0043 from 0x68[0x01]
Read 0x0002 from 0x68[0x02]
Read 0x0004 from 0x68[0x03]
Read 0x0011 from 0x68[0x04]
Read 0x0001 from 0x68[0x05]
Read 0x0000 from 0x68[0x06]
Fri Jan 13 01:43:43 UTC 2017
hwclock: RTC_RD_TIME: Invalid argument <-- **not exist March 38 !!!!!!!!**

Can you help me ?

@tohax
Copy link

tohax commented Apr 5, 2017

did you try this? tohax@2c0afb1

@lebardix
Copy link
Author

Hi tohax
Sorry for responsive long time...
I try your option, it's better, i can load htc time to sys very well (default init), but i cant store sys to htc, also i clone your repository to test.
other question, have you used or tested power from a lion battery ?
Best regards

@tohax
Copy link

tohax commented Aug 16, 2017

Yes. My cameras run on battery for a long time. And both hwclock --systohc and hwclock --hctosys work.

@lebardix
Copy link
Author

Hi, i am using your master

  • after build, program, start (with lithium batt \o o// \o) first video files was registered in /mnt ... very good...
  • hwclock work ( but i do valid echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device in rc.local, else hwclock: can't open '/dev/misc/rtc': No such file or directory )

bravo et merci

But i can't connect to my AP
loading module 8192cu --> OK
modified /etc/init.d/wifi.sh with my AP network parameters ( not used /mnt/setup.txt because i have no found sample...)

dmesg say

..................................................Scan disk finish, spend time:1560ms.
usbcore: registered new interface driver rtl8192cu
usbcore: deregistering interface driver rtl8192cu

if i start manually /etc/init.d/wifi.sh

[root@test ~/init.d]# /etc/init.d/wifi.sh
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
ifconfig: SIOCSIFADDR: No such device
route: SIOCADDRT: Network is unreachable
[root@test ~/init.d]# lsusb 
Bus 001 Device 001: ID 1d6b:0002

what do you think about ?
thank's
using rsync to send/save video-files is better..

@tohax
Copy link

tohax commented Aug 16, 2017

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
hwclock --hctosys

it's my old firmware. Now i'm working on Gadget firmware. I commented it for testing purpose, but you need this 2 string for hwclock working.

As for AP. I am currently not using AP mode. wifi.sh is for connecting to AP named Avtobus. My firmware is highly modified. I think you need to go back to source from Lamobo D1 github and edit files in init.d directory for your purpose.

As for 8192cu driver ... this driver for my wifi adapter. Yours may be different. Maybe you need 8188.ko or other. What wifi adpter do you use?

@tohax
Copy link

tohax commented Aug 16, 2017

/mnt/setup.txt
IP=10.10.10.10
HOST=Y576PC

it is just for ip and hostname of camera.

Also you need /etc/localtime file for your timezone. my for YEKT +5, as i am in Russia.

@lebardix
Copy link
Author

Hi,
As you, i want connect D1s to my own AP not in APmode, also i can use your conf.
i use a usb dongle wifi Bus 001 Device 002: ID 0bda:8179

USB: 0BDA:0179 Realtek Semiconductor Corp. RTL8188ETV Wireless LAN 802.11n Network Adapter
8188ko seem correct i go test
for localtime, i stay in France and i have timezone corresponding ...

Bonsoir

@tohax
Copy link

tohax commented Aug 16, 2017

everything should work fine with 8188ko driver. You can write me directly to [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants