vogelchr / radioclkd2 Goto Github PK
View Code? Open in Web Editor NEWQuick and dirty fork of http://www.jonatkins.com/page/software/radioclkd2 adding Linux GPIO pin support.
Quick and dirty fork of http://www.jonatkins.com/page/software/radioclkd2 adding Linux GPIO pin support.
Now that sysfs has been deprecated and is unavailable on certain distros, how would one go about and have radioclkd2 read a pin using chardev?
Please can you give an example of using this with a GPIO pin on a pi
I needed to use SHM channel 2 so modified shm.h as shown below...
// ntpd shared memory reference clock driver structure
#define SHM_KEY 0x4e545032
Easy enough, but perhaps making this a command line argument would help put this parameter in a calling start script rather than hard coded into the binary.
Are there any parameters i can change to make the decoder less sensitive.
I have successfully received the time using dcf77pi in under and hour, so the signal is good enough.
i ran radioclkd2 for over a week and its has not synchronised.
radioclkd2 -t dcf77 -d -v -s gpio /sys/class/gpio/gpio25/value:DCD
user@ntp2:~$ tail -20 nohup.out
pulse end: length 0.802928 - # Bits: 41: Pulse Width (10ths): 8
pulse start: at 1511538792.123542
pulse end: length 0.908992 - # Bits: 42: Pulse Width (10ths): 9
pulse start: at 1511538793.123914
pulse end: length 0.909745 - # Bits: 43: Pulse Width (10ths): 9
pulse start: at 1511538794.220051
pulse end: length 0.805939 - # Bits: 44: Pulse Width (10ths): 8
pulse start: at 1511538795.130036
pulse end: length 0.907033 - # Bits: 45: Pulse Width (10ths): 9
pulse start: at 1511538796.126900
pulse end: length 0.900076 - # Bits: 46: Pulse Width (10ths): 9
pulse start: at 1511538797.126491
pulse end: length 0.904047 - # Bits: 47: Pulse Width (10ths): 9
pulse start: at 1511538798.223344
pulse end: length 0.806069 - # Bits: 48: Pulse Width (10ths): 8
pulse start: at 1511538799.128995
pulse end: length 0.899354 - # Bits: 49: Pulse Width (10ths): 9
pulse start: at 1511538800.223239
pulse end: length 0.804273 - # Bits: 50: Pulse Width (10ths): 8
pulse start: at 1511538801.131402
user@ntp2:~$ cat nohup.out | wc -l
3113647
user@ntp2:~$ cat nohup.out | grep DCF | wc -l
81
Hi, Just wanted to let you know how I did systemd. Just a suggestion, there might be even more native methods.
root@acerola:~# cat /etc/systemd/system/radioclkd2.service
[Unit]
Description=Radio Clock service
Before=chrony.service
[Service]
EnvironmentFile=/etc/default/radioclkd2
ExecStart=
ExecStart=/usr/local/bin/radioclkd2 $OPTS
[Install]
WantedBy=multi-user.target
Alias=radioclkd2
root@acerola:~# cat /etc/systemd/system/radioclkd2.service.d/set-gpio.conf
[Service]
ExecStartPre=/usr/local/bin/setgpio.sh 13
root@acerola:~# cat /usr/local/bin/setgpio.sh
#!/bin/sh
if [ ! -f /sys/class/gpio/gpio$1/value ]; then
echo $1 > /sys/class/gpio/export
fi
echo both > /sys/class/gpio/gpio$1/edge
I also adjusted some things in main.c; because I don't want to daemonize for systemd. Maybe there's a better way to integrate into systemd more natively.
root@acerola:~/radioclkd2# git diff
diff --git a/decode_dcf77.c b/decode_dcf77.c
index 132560a..45e7022 100644
--- a/decode_dcf77.c
+++ b/decode_dcf77.c
@@ -156,7 +156,7 @@ dcf77Decode ( clkInfoT* clock, time_f minstart )
if ( dectime.tm_min > 60 )
return -1;
/* year mon mday wday hour min TZ-info-leap-ant */
- loggerf ( LOGGER_DEBUG, "DCF77 time: %04d-%02d-%02d (day %d) %02d:%02d %s%s%s%s\n",
+ loggerf ( LOGGER_INFO, "DCF77 time: %04d-%02d-%02d (day %d) %02d:%02d %s%s%s%s\n",
dectime.tm_year+1900, dectime.tm_mon+1, dectime.tm_mday,
dectime.tm_wday, dectime.tm_hour, dectime.tm_min,
GET(17) ? "CEST" : "CET", GET(16) ? " timezone change soon":"",
diff --git a/main.c b/main.c
index aab6a9d..a0c8360 100644
--- a/main.c
+++ b/main.c
@@ -390,7 +390,7 @@ main ( int argc, char** argv )
loggerSyslog ( 1, LOGGER_DEBUG );
break;
}
- setDemon();
+ //setDemon();
setRealtime();
}
else
@@ -478,7 +478,7 @@ StartClocks ( serDevT* serdev )
{
if ( serWaitForSerialChange ( serdev ) < 0 )
{
- loggerf ( LOGGER_DEBUG, "no serial line change\n" );
+ loggerf ( LOGGER_INFO, "no serial line change\n" );
continue;
}
diff --git a/shm.c b/shm.c
index 75c42ce..521bef2 100644
--- a/shm.c
+++ b/shm.c
@@ -56,7 +56,7 @@ shmStore ( shmTimeT* volatile shm, time_f radioclock, time_f localrecv, time_f t
{
struct timeval radioclocktv,localrecvtv;
- loggerf ( LOGGER_DEBUG, "shm: storing time "TIMEF_FORMAT" local "TIMEF_FORMAT" err "TIMEF_FORMAT" leap %d\n", radioclock, localrecv, time_err, leap );
+ loggerf ( LOGGER_INFO, "shm: storing time "TIMEF_FORMAT" local "TIMEF_FORMAT" err "TIMEF_FORMAT" leap %d\n", radioclock, localrecv, time_err, leap );
time_f2timeval ( radioclock, &radioclocktv );
time_f2timeval ( localrecv, &localrecvtv );
I run 3x https://github.com/beta-tester/RPi-GPS-PPS-StratumOne boxes with radioclkd2 added to it, pics https://imgur.com/a/CLW7pzF
Hi,
This clock works very well. I see the --help options show...
fudgeoffs: fudge time, in seconds
This is an important feature that should be added to the command list on the main page of this github project.
Hi,
I noticed that the log message is of by 1 month, while decoded time was right:
Dec 26 20:14:00 moonclock radioclkd2: DCF77 time: 2016-11-26 (day 1) 20:14 CET main ant
Dec 26 20:14:00 moonclock radioclkd2: clock: radio time 1482779640.000000, pc time 1482779640.944847
Dec 26 20:14:00 moonclock radioclkd2: shm: storing time 1482779640.000000 local 1482779640.944847 err 0.005000 leap 0
cheers, muetze
I have submitted a working Pull Request #11 this incorrect behaviour.
The problem was noticed with a Raspberry Pi 3 running Debian Bullseye (32bit and 64bit) which comes with GCC v10.2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.