Date 1 - 2 of 2
1-32khz sensor-sampling loop
Nathan T <nathan@...>
i'd like to sample a sensor (actually several sensors) in precise intervals at speeds up to 32khz.
it seems timer and sleep functions only have millisecond resolution and I cannot busy wait.
anyone have suggestions on the best way to go about this?
toggle quoted message Show quoted text
- Uses the SAM0 DMA unit to read the ADC and write to memory when the ADC conversion complete event triggers
- Uses the SAM0 event system to hook the timer into the ADC trigger
- Sets up a 32 kHz hardware timer
Hi Nathan. I'm fairly new to Zephyr, but if you're looking for hard real time-ish at 32 kHz then I'd talk straight to the hardware.For example, say I needed to read an ADC channel at 32 kHz on the ATSAMD21. I'd use the Zephyr drivers to initialise the ADC and DMA units and then do custom iniitalisation that:
The DMA can work in ping-pong mode and fire an interrupt when the buffer is half full. This can then set a semaphore and wake up your task.
Hope that helps,
On Fri, 2 Feb 2018 at 17:36 Nathan T <nathan@...> wrote:
|1 - 2 of 2|