Closed PM490 closed 5 months ago
I was measuring the timing of ADC reading, and saw some spurios results. Most cycles took 7usec with occasional spurious of up to 50usec.
To troubleshoot further, the code of the adc reading was replaced with a busy_wait_us_32(7) and the same behaviour was observed.
The time measured is mostly 7 or 8 usec, with similar spurious jumps. Is there a reason why time_us_64(); would ad up to 40usec occassionally?
uint64_t start_time [200]; uint64_t end_time [200];
void __time_critical_func(Sandbox_time_us_64) (void) { for (int i=0; i<200; i++){ start_time [i]= time_us_64(); busy_wait_us_32(7); end_time[i] = time_us_64(); } }
void Sandbox_time_us_64_Print (void) { for (int i=0; i<200; i++){ printf("ADC0 %04x | ADC1 %04x |Read Time %f usecs\n",adc0_read[i], adc1_read[i], double (end_time[i]-start_time[i])); } }
The issue may be related to interrupts outside the code, for example the USB serial. Closing until I have more info.
I was measuring the timing of ADC reading, and saw some spurios results. Most cycles took 7usec with occasional spurious of up to 50usec.
To troubleshoot further, the code of the adc reading was replaced with a busy_wait_us_32(7) and the same behaviour was observed.
The time measured is mostly 7 or 8 usec, with similar spurious jumps. Is there a reason why time_us_64(); would ad up to 40usec occassionally?
uint64_t start_time [200]; uint64_t end_time [200];
void __time_critical_func(Sandbox_time_us_64) (void) { for (int i=0; i<200; i++){ start_time [i]= time_us_64(); busy_wait_us_32(7); end_time[i] = time_us_64(); } }
void Sandbox_time_us_64_Print (void) { for (int i=0; i<200; i++){ printf("ADC0 %04x | ADC1 %04x |Read Time %f usecs\n",adc0_read[i], adc1_read[i], double (end_time[i]-start_time[i])); } }