File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
src/current_sense/hardware_specific/rp2040 Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,6 @@ bool RP2040ADCEngine::init() {
164164 false , // We won't see the ERR bit because of 8 bit reads; disable.
165165 true // Shift each sample to 8 bits when pushing to FIFO
166166 );
167- samples_per_second = 20000 ;
168167 if (samples_per_second<1 || samples_per_second>=500000 ) {
169168 samples_per_second = 0 ;
170169 adc_set_clkdiv (0 );
Original file line number Diff line number Diff line change 2222 * Inline sensing is supported by offering a user-selectable fixed ADC sampling rate, which can be set between 500kHz and 1Hz.
2323 * After starting the engine it will continuously sample and provide new values at the configured rate.
2424 *
25+ * The default sampling rate is 20kHz, which is suitable for 2 channels assuming you a 5kHz main loop speed (a new measurement is used per
26+ * main loop iteration).
27+ *
2528 * Low-side sensing is currently not supported.
2629 *
2730 * The SimpleFOC PWM driver for RP2040 syncs all the slices, so the PWM trigger is applied to the first used slice. For current
@@ -74,7 +77,7 @@ class RP2040ADCEngine {
7477
7578 ADCResults getLastResults (); // TODO find a better API and representation for this
7679
77- int samples_per_second = 0 ; // leave at 0 to convert in tight loop
80+ int samples_per_second = 20000 ; // 20kHz default (assuming 2 shunts and 5kHz loop speed), set to 0 to convert in tight loop
7881 float adc_conv = (SIMPLEFOC_RP2040_ADC_VDDA / SIMPLEFOC_RP2040_ADC_RESOLUTION); // conversion from raw ADC to float
7982
8083 // int triggerPWMSlice = -1;
You can’t perform that action at this time.
0 commit comments