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() {
164
164
false , // We won't see the ERR bit because of 8 bit reads; disable.
165
165
true // Shift each sample to 8 bits when pushing to FIFO
166
166
);
167
- samples_per_second = 20000 ;
168
167
if (samples_per_second<1 || samples_per_second>=500000 ) {
169
168
samples_per_second = 0 ;
170
169
adc_set_clkdiv (0 );
Original file line number Diff line number Diff line change 22
22
* Inline sensing is supported by offering a user-selectable fixed ADC sampling rate, which can be set between 500kHz and 1Hz.
23
23
* After starting the engine it will continuously sample and provide new values at the configured rate.
24
24
*
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
+ *
25
28
* Low-side sensing is currently not supported.
26
29
*
27
30
* 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 {
74
77
75
78
ADCResults getLastResults (); // TODO find a better API and representation for this
76
79
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
78
81
float adc_conv = (SIMPLEFOC_RP2040_ADC_VDDA / SIMPLEFOC_RP2040_ADC_RESOLUTION); // conversion from raw ADC to float
79
82
80
83
// int triggerPWMSlice = -1;
You can’t perform that action at this time.
0 commit comments