orgua / shepherd

Synchronized Energy Harvesting Emulator and Recorder
MIT License
2 stars 2 forks source link

Time Sync between PRU and Kernel-module needs improvement #19

Open orgua opened 1 year ago

orgua commented 1 year ago

The SPI - Chip select (CS) delay between two nodes is oscillating with ~ 0.2 Hz -> see this picture

PTP shows stable sync so the problem must be after that.

Current progress is documented here

orgua commented 8 months ago

latest tests show that asking for kernel-time already takes ~ 300ns on BB Black - which explains the amplitude of the oscillation. Nevertheless this can be optimized with the proper tuning-variables.

the new BB AI 64 only takes 30 ns to get the timestamp.

orgua commented 4 months ago

Update: using a realtime-kernel (-rt) allows for improved timing, important kernel sync routines can also switch to HRTIMER_MODE_ABS_HARD, while _HARD is not available on normal 4.19.94-ti-r74. Downside: higher overall load for normal processed (also shepherd-sheep)