-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to capture adc signal at 8ksps when using nrf52840dk board. #28469
Comments
Here the timer always generate the interrupt in ms to sample the adc signal. zephyr/drivers/adc/adc_context.h Line 98 in 1342d12
zephyr/drivers/adc/adc_context.h Line 96 in 1342d12
ceiling_factor also result the time in ms. That why it captures only 1000 samples per second. |
@Navin-Sankar I apologize it took me so long to get to this issue. As you already correctly figured out, the problem is in the routine that sets up the kernel timer. I created #28841 to solve it. |
@anangl By default nrf52840dk board uses LFCLK(rtc) as a system clock. How to switch the clock to HFCLK(systick timer)? |
@Navin-Sankar Try to use this in your configuration:
|
@anangl working perfectly. |
@anangl Although this is closed ticket, I would like to ask here as it makes sense. |
Describe the bug
When trying to capture adc signal at 8ksps it captures only 1000 samples per second.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
nrf52840 should capture 8000 samples
Impact
Cannot capture 8000 samples. It capture's only 1000 samples per second
Code
In the above code channel 0 is initialized to capture adc signal at 125us as a sampling interval. Theroritically it should capture 8000 samples, but it capture's only 1000 sample. If I change the buffer size to 12000 and time period to 83us, that time also it capture's only 1000 samples.
when setting sampling interval_us as 0, it capture's all samples based on the buffer size at 180ms. Can't achieve the precision when trying to sample particular frequency.
By default nrf52840dk board uses low frequency clock(32KHz) as system clock.
How to switch the clock from LF to HF to capture more samples precisely.
The text was updated successfully, but these errors were encountered: