Date
1 - 2 of 2
1-32khz sensor-sampling loop
Nathan T <nathan@...>
hi all, 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? best, nathan |
|
Michael Hope
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, -- Michael On Fri, 2 Feb 2018 at 17:36 Nathan T <nathan@...> wrote:
|
|