I would start removing one part of the software after the other and measure time needed.
- comment out the CS digitalWrite (although it is needed at the end, just get the time budget)
- comment SPI.beginTransaction, endTransaction(), which is "Initializes the SPI bus" according to the docs, Guess it is needed only once; not in the loop
- comment out the SPI part, just to see what the time budget of this operation is.
- remove the times\[i\] = micros()-startMicros; and measure time from start to end.
side topic: the uint32_t adcRead is a uint32_t, but the mthod returns only uint16_t
side topic: 60MHz clock frequency on a breadboard is perhaps a bit optimistic. Check the signals with an oscilloscope and eventually reduce till waveform is clear.
- comment out the CS digitalWrite (although it is needed at the end, just get the time budget)
- comment SPI.beginTransaction, endTransaction(), which is "Initializes the SPI bus" according to the docs, Guess it is needed only once; not in the loop
- comment out the SPI part, just to see what the time budget of this operation is.
- remove the times\[i\] = micros()-startMicros; and measure time from start to end.
side topic: the uint32_t adcRead is a uint32_t, but the mthod returns only uint16_t
side topic: 60MHz clock frequency on a breadboard is perhaps a bit optimistic. Check the signals with an oscilloscope and eventually reduce till waveform is clear.
Statistics: Posted by ghp — Fri Apr 05, 2024 10:27 pm