Closed Kamilcuk closed 7 years ago
Not sure to have a correct answer, but is your system clock correct with regards to GPS time? According to your log, I understand you have a GPS attached to the system. This provide time to the packet received. However, as you've noticed, the log's time stamps are not aligned. I would suspect a clock synchronisation issue.
Yes, i have checked it multiple times, to be sure that it isn't my machine fault. ntpd synchronizes time with both external ntp servers and gps time. ntpq -p reports offset of ~20 miliseconds. To receive gps nmea messages by both packet-forwarder and gpsd, i have duplicated gps nmea stream using socat ('/usr/bin/gpspipe -r | /usr/bin/socat - PTY,link=/dev/%i,raw'). This could alter time, but packet-forwarder uses read(..) to read from socket, and this shouldn't change rxpk[0].time every 60 seconds in repeatable way. For every "rxpk" line in my logs I have calculated the difference between system time and the time reported in rxpk[0].time. The difference raises up to about 60 seconds, then the thread_timersync() runs ( there is wait_ms(60000) in thread_timersync() ), and then the difference goes back to about 0. This repeats every 60 seconds. It seems for me, like the difference is rising "one second per second" after every thread_timesync() run. I can try to post more logs, probably on hastebin, if You wish. My idea: if there's no PPS signal connected to iC880A, when lgw_reg_w(LGW_GPS_EN, x) is toggled, than the internal iC880A clock is changing, and somehow this value is added to the rxpk.time (?)...
For the conversion from sx1301timestamp to UTC time to work, the PPS signal has to be connected to the SX1301.
I have iC880A connected to my device. I am running packet-forwarder on it. I have an external GPS connected via usb to my device and I have added "gps_tty_path" to local_conf.json. Packet-forwarder correctly connects to GPS device. However the GPS PPS signal is not conected to iC880A. Machine time is synchronized with GPS time, GPS has fix. My timezone is UTC+1. The problem i have, is that packets received by packet-forwarder have wrong rxpk[0].time value, usually many seconds in the future and those values are not in chronological order. Here are example of my logs:
Packet received on 19:34:28 has "time":"2017-01-26T18:35:25.023600Z", that is 57 seconds in the future. Packet received on 19:34:33 has "time":"2017-01-26T18:34:35.041228Z", that is only 2 seconds in the future, and the value is before "2017-01-26T18:35:25.023600Z". The second packet was received (and sended) AFTER the first one, but the "time" field in jsons are not chronological (and are in the future). I discovered that this "time difference" lowers whenever the loop in thread_timersync() runs. Will connecting PPS signal to iC880A fix the issue?