Since I don't have a fancy storage scope to capture the 50ms lorawan transmission current I am trying to measure, I have been trying to get the BT logging to go as quickly as possible. Using the recent github .ino I changed line 99:
#define BT_REFRESH_INTERVAL 200 //ms - from 200 to 20ms and that seemed to work just fine.
Now I would like to go faster so I am looking at lines 478/479:
//ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_16 | ADC_AVGCTRL_ADJRES(0x4ul); //take 16 samples adjust by 4
ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_1024 | ADC_AVGCTRL_ADJRES(0x4ul); //take 1024 samples adjust by 4
I uncommented 478 and commented out 479. Figuring it was now going 16 times faster I changed the 200 ms to 13.
That also seemed to work better.
If I want to go even faster I seem to need to change line 480:
ADC->SAMPCTRL.reg = 0b100; //0x00 fastest
This ties up with the datasheet, but I don't know whether I can just reduce this 0b100 progressively - and if so what to do with the avgctrl.reg above (there is a line 478 which shows just one sample - but I suspect using that may affect accuracy).
Also I presume I have to keep reducing the BT report interval or I won't see the effect.
If anyone has any guidance it would be most appreciated.