Timeline for Arduino fast ADC sampling--which burst control is best?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 15, 2022 at 0:07 | history | edited | Dave X | CC BY-SA 4.0 |
Switch code to Timer-controlled pulse and achieve 6.5us sampling.
|
Jan 11, 2022 at 15:44 | comment | added | Dave X |
... The pulse length control is sloppy because the pulse is started out of sync with the sampling, and finishes in sync with the sampling. I like the end synchronization with the samples for my particular application, but it would be nicer to configure a timer as a one-shot and trigger it in the ISR when the sample == 0 , then you could get higher resolution pulse lengths with both the start and end of the pulse synced with the sampling. Maybe it could reach 6.5us/sample with 8-9 bit resolution.
|
|
Jan 11, 2022 at 15:36 | history | edited | Dave X | CC BY-SA 4.0 |
Edit logic based on EdgarBonet's suggestion.
|
Jan 11, 2022 at 15:30 | comment | added | Dave X |
@EdgarBonet -- With the ADIF=1 trick, ADCSRA |= bit(ADIF) | bit(ADIE) would clear any pending interrupt and enable future interrupts. Sounds good. I could then use the ADCSRA & bit(ADIE) instead of burst as my "sampling" state variable and save a test. I've been tweaking things to get down to the 13us/sample threshold that I can get for the ADPS2:0=0b100 /16 1MKz speed that has full 10bit accuracy, but I haven't trimmed the ISR down enough for the /8 clock. I like the pulse control in the ISR for the sync in my use case, but it's sloppy. Maybe pulse on sample vs micros() state var?
|
|
Jan 10, 2022 at 19:39 | comment | added | Edgar Bonet |
Re "I left free-running automatic ADC enabled and switched the data recording on and off.": I think you could do that by toggling just ADIE , without touching ADSC . Maybe clear the interrupt flag when setting ADIE , to avoid getting an interrupt from the last conversion of the previous burst.
|
|
Jan 9, 2022 at 21:33 | history | edited | Dave X | CC BY-SA 4.0 |
Update code
|
Jan 7, 2022 at 14:01 | vote | accept | Dave X | ||
Dec 8, 2021 at 3:56 | history | edited | Dave X | CC BY-SA 4.0 |
added 270 characters in body
|
Dec 8, 2021 at 3:50 | history | edited | Dave X | CC BY-SA 4.0 |
added 270 characters in body
|
Dec 8, 2021 at 3:23 | history | answered | Dave X | CC BY-SA 4.0 |