The 400kHz sample rate is the maximum, according to the documentation.
After some investigation, I can confirm that most of the time in spectrum acquisition is spent
on i2c transfers, not so much on the FFT itself.
Typically, one fft takes 28milliseconds and reading its data takes about 240 ms.
However the code was not optimal and I could reduce that reading time to 155ms.
So that saves about 30% of the time in that part of the code. With these changes,
both polarisations and the high/low bands can then be scanned in 55 seconds.
The existing code also read some data that is not used afterwards. After removing needless
reads, I managed to get some more speedup, leading to only 40s for scanning the 4 bands.
The code also reads the spectrum with 32 bit precision, whereas probably 16 bits is more than
enough. I now implemented an experimental 16 bit mode, which can be activated with
Code:
sudo su
echo 0 > /sys/module/stid135/parameters/fft_mode32
This new code now only takes 27 seconds for the 4 bands. If I remember correctly, with the older code
(before any of the optimisations) it took 80 seconds. So that would mean that the new code is almost three
times faster, which is not a bad result.
About sepctrum acquisition on multiple demods in parallel: It appears that locking in the
code made one scan block until the other was finished. This also means that no other
activity, like tuning to a new channel, is possible while spectrum scan was running.
I removed those locks, but there is still some other problem (corruption of spectra), but that might
be solvable.
The i2c bus will remain the bottleneck: only 1 demod can use it at the same time. The good news is that the new code already uses the i2c bus a lot less, and while one demod is reading fft data, the other can compute a new fft. So some parallelisation will be
possible and the total parallel spectrum acquisition time will still be less than double the time for one scan