Measuring Speed of Light with Arduinos and no moving parts

Hello there

The SPI solution proposed by racemaniac with SPI AHB DMA is clearly the fastest method , although Peripheral to Memory AHB DMA is a bit tricky to implement. It seems that by chance a library exists (with 1 master and 2 slaves in your case ?).

I noticed 2 details in your trials with ADC.
1/ You tried the 10 bits resolution, but the correct implementation is this one (datasheet 43.7.2):
ADC-ADC_MR = ADC_MR_FREERUN_ON | ADC_MR_LOWRES_BITS_10;
With ADC_MR_FREERUN_ON | ADC_MR_LOWRES_BITS_10 = 0x80 | 0x10 = 0x90
I don't know if it changes something but should be tried.

2/And if I understand your manip, you observed a 21 clock cycles offset after the rising edge, which seems logic because the 12 bits resolution takes 20 clock cycles, plus one to register by the PDC, and this rising edge comes (512 + 6) Half Words after PDC starting, right ?

Suppose this was done when your sensor was at location of sensor 1, now when you place your sensor at the location of sensor 2 and do the manip again, you will observe a rising edge coming after (512 + 6 + X) Half Words.

So when you subtract the 2 results, the offset is discarded, including the 21 clock cycles , rest the X Half Words. And thanks to calibration, you know the timing correspondence.