Hello micropython board users,
I would like to know if anyone has evaluated the precision of the funciton "adc.read_timed(buf, freq)" as for how precise the timing of the acquisition is. Any additional information is welcomed. And what is the maximum frequency programmable for this function?
Thank you and best regards,
V.S
ADC function precision
Re: ADC function precision
The adc.read_timed() is clocked by timer 6 and can run up to 84MHz. The accuracy of the timer is dictated by the MCU's crystal spec of 30 ppm. I measured the crystal frequency accuracy on my pyboard at 33 ppm. Ultimately, your adc_read_time() frequency shouldn't exceed the time for the ADC to collect a 12-bit sample. The datasheet wasn't real clear on ADC speed (0.5 to 16 us), so I measured the ADC speed in the firmware's adc.c with the processors cycle counter (SysTick->VAL). My testing showed the ADC was taking about 152 ticks, so @ 168 mhz that's less than a microsecond! So conceivably you could run the read_timed() at 1 MHz. The precision of setting the timer 6 frequency is related to the prescaler divisors of 84mhz and the period -- see firmware timer_tim6_init() in stmhal/timer.c
Re: ADC function precision
Thank you very much for your answer
Concerning the MCU's crystal accuracy, one question raised, if it has 30 ppm accuracy, the RTC of the pyboard could deviate of 78 seconds (2600000 (secs) * 0,999970) per month ? I am working on a standalone project (trancking weather events), so time accuracy is important, even more if the module will stay few months outside. I will perform some testing.
Concerning the MCU's crystal accuracy, one question raised, if it has 30 ppm accuracy, the RTC of the pyboard could deviate of 78 seconds (2600000 (secs) * 0,999970) per month ? I am working on a standalone project (trancking weather events), so time accuracy is important, even more if the module will stay few months outside. I will perform some testing.
Re: ADC function precision
Not exactly - the RTC is driven by a separate crystal from the rest of the MCU; the RTC has a low-power 32.768 KHz crystal versus the 8 MHz crystal which drives the rest of the processor. The RTC peripheral can continue to operate when power is removed from the rest of the pyboard; it can be powered by a small watch battery connected to the VBAT pin.MCU's crystal accuracy, one question raised, if it has 30 ppm accuracy, the RTC of the pyboard could deviate of 78 seconds
There have been numerous reports that the accuracy of the RTC crystal is less than satisfactory (search for 'RTC' related discussions on the forum) but we have recently added support for RTC calibration, which can nominally improve accuracy to < 1 ppm. I don't know if anyone have been that successful yet.
See http://docs.micropython.org/en/latest/l ... alibration
-Bryan