Record doesn't finish with warning "Timed out in publish" on RPi

Hi, I tried to record using pyjoulescope_driver on RPi, but it gives warnings and it doesn’t finish so that I need to kill process.

It generates jls file, but it’s slightly shorter than expected duration (ex. 28.8 sec, expected 30 sec).
The warning seems to occur at the end of recording. (it’s same with different duration setting).
And it seems to depend on number of signals setting.

On Windows, it completes successfully without any warning using same versions of Python and joulescope modules.

Any limitation on RPi?

With setting three signals, get warnings for each signals and doesn’t finish. Generated jls file has shorter (28.8 sec) than expected.

(myenv) test@raspberrypi:~/test_js $ python -m pyjoulescope_driver record --set "s/i/range/select=128" --duration 30 --frequency 1000000 --signals current,voltage,power ./test.jls
Start recording.  Press CTRL-C to stop.
WARNING:2024-02-29 09:32:48,169:record.py:231:pyjoulescope_driver.record:Timed out in publish: s/i/ctrl <= 0
WARNING:2024-02-29 09:32:48,420:record.py:231:pyjoulescope_driver.record:Timed out in publish: s/v/ctrl <= 0
WARNING:2024-02-29 09:32:48,671:record.py:231:pyjoulescope_driver.record:Timed out in publish: s/p/ctrl <= 0

With setting two signals, it works with different warning and generated jls file has 29.95 sec data (expected).

(myenv) test@raspberrypi:~/test_js $ python -m pyjoulescope_driver record --set "s/i/range/select=128" --duration 30 --frequency 1000000 --signals current,power ./test.jls
Start recording.  Press CTRL-C to stop.
WARNING:2024-02-29 10:32:04,049:threaded_writer.c:186:pyjls.c:thread msg 3:fsr took 678 ms
(myenv) test@raspberrypi:~/test_js $

With setting one signal, it works without any warning and generated jls file has 29.94 sec data (expected).

(myenv) test@raspberrypi:~/test_js $ python -m pyjoulescope_driver record --set "s/i/range/select=128" --duration 30 --frequency 1000000 --signals power ./test.jls
Start recording.  Press CTRL-C to stop.
(myenv) test@raspberrypi:~/test_js $

Note: I checked duration in jls file using vertical annotation on joulescope UI on Windows.

environment:

  • JouleScope JS110
  • Raspberry Pi 4B (1.5GHz-64bit quad-core CPU, 8GB RAM)
  • Raspberry Pi OS 12 (bookworm), Linux 6.1.0-rpi8-rpi-v8 aarch64
  • Python 3.11.2
  • joulescope 1.1.12
  • pyjoulescope_driver 1.4.8
  • pyjls 0.9.2

Based upon your description, it sounds like the storage media that you are using for recording the JLS file is unable to keep up with the data rates. At 1 Msps with i,v,p, the data rate is almost 14 MB/s. The writes are not entirely sequential, either, since the JLS format has to update the next chunk pointers on previous chunks.

You have two options:

Increase write speed

I am guessing you are writing to the SD card. What are the specs on the SD card? Can you use one that can handle non-sequential writes with at least 20 MB/s? Alternatively, you can use an external HDD or SSD over superspeed USB.

Another potential option is to increase the file system buffering so that most non-sequential accesses are handled in RAM by the OS. Not sure what controls Linux has for this…

Reduce data rate

Only enable the channels you need. If you need three channels (i,v,p), can you get by with 250 ksps?

Thank you for prompt response.

I use micro SD UHS Speed class 1 (10MB/sec).
This spec is not enough then.

I ran SD card speed test.
Sequential write is 20MB/s, but Random write may not be enough…?

Raspberry Pi Diagnostics - version 0.13
Thu Feb 29 15:10:26 2024

Test : SD Card Speed Test
Run 1
prepare-file;0;0;20745;40
seq-write;0;0;20917;40
rand-4k-write;0;0;2848;712
rand-4k-read;11059;2764;0;0
Sequential write speed 20917 KB/sec (target 10000) - PASS
Random write speed 712 IOPS (target 500) - PASS
Random read speed 2764 IOPS (target 1500) - PASS
Test PASS

Thank you for suggestions. I will consider them.