Hi!
I liked the "maximum performance" example because it is driven by a timer and the measurements are on absolutely regular basis:
So, I configured it (below is what I've changed compared to the example's original code) and run it (results are below).
My question is - how can I easily re-trigger new burst of measurements from the while loop?
I'm sampling at 50kHz, ADC is done, buffers are full, process the buffer and then I want in the main while loop (on a regular basis - after a pause of e.g. 10 seconds) to trigger a new measurement burst.
I tried as below by 'nrfx_gppi_channels_enable(NRFX_BIT(m_gppi_channels[SAADC_START_ON_END]));' but it does not trigger a new burst...
/** @brief Symbol specifying maximal possible SAADC sample rate (see SAADC electrical specification). */
#define MAX_SAADC_SAMPLE_FREQUENCY 50000UL
/**
* @brief Symbol specifying the number of sample buffers ( @ref m_sample_buffers ).
* Two buffers are required for performing double-buffered conversions.
*/
#define BUFFER_COUNT 2UL
/** @brief Symbol specifying the size of singular sample buffer ( @ref m_sample_buffers ). */
#define BUFFER_SIZE 20UL
/** @brief Symbol specifying the number of SAADC samplings to trigger. */
#define SAMPLING_ITERATIONS 1UL // was 3UL
int main(void)
{
// ...
k_sleep(K_MSEC(1000));
for (;;) {
k_sleep(K_MSEC(10000));
// NB - unfortunately this does NOT trigger a new measurement iteration:
nrfx_gppi_channels_enable(NRFX_BIT(m_gppi_channels[SAADC_START_ON_END]));
//... do my Bluetooth and application stuff
printk(".\n");
}
}
13:16:29:042 -> *** Booting Zephyr OS build v3.2.99-ncs2 *** 13:16:30:050 -> SAADC event: CALIBRATEDONE 13:16:30:052 -> SAADC event: READY 13:16:30:054 -> SAADC event: BUF_REQ 13:16:30:056 -> SAADC event: DONE 13:16:30:058 -> Sample buffer address == 0x200099d6 13:16:30:061 -> [Sample 0] value == 13748 13:16:30:063 -> [Sample 1] value == 13768 13:16:30:066 -> [Sample 2] value == 13776 13:16:30:068 -> [Sample 3] value == 13768 13:16:30:070 -> [Sample 4] value == 13740 13:16:30:073 -> [Sample 5] value == 13752 13:16:30:075 -> [Sample 6] value == 13760 13:16:30:077 -> [Sample 7] value == 13784 13:16:30:080 -> [Sample 8] value == 13776 13:16:30:082 -> [Sample 9] value == 13772 13:16:30:084 -> [Sample 10] value == 13772 13:16:30:087 -> [Sample 11] value == 13740 13:16:30:089 -> [Sample 12] value == 13780 13:16:30:092 -> [Sample 13] value == 13800 13:16:30:094 -> [Sample 14] value == 13768 13:16:30:097 -> [Sample 15] value == 13776 13:16:30:099 -> [Sample 16] value == 13756 13:16:30:101 -> [Sample 17] value == 13760 13:16:30:104 -> [Sample 18] value == 13756 13:16:30:106 -> [Sample 19] value == 13772 13:16:30:109 -> FINISHED 13:16:40:112 -> . 13:16:50:114 -> . 13:17:00:115 -> . 13:17:10:116 -> .