Skip to content

Commit 370a209

Browse files
committed
Fix low side current sense on B-G431B
1 parent 11ff608 commit 370a209

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/current_sense/hardware_specific/stm32/b_g431/b_g431_mcu.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,11 @@ void* _configureADCInline(const void* driver_params, const int pinA,const int pi
106106
HAL_OPAMP_Start(&hopamp1);
107107
HAL_OPAMP_Start(&hopamp2);
108108
HAL_OPAMP_Start(&hopamp3);
109-
110-
// Check if the ADC DMA is collecting any data.
111-
// If this fails, it likely means timer1 has not started. Verify that your application starts
112-
// the motor pwm (usually BLDCDriver6PWM::init()) before initializing the ADC engine.
113-
_delay(5);
114-
if (adcBuffer1[0] == 0 || adcBuffer1[1] == 0 || adcBuffer2[0] == 0) {
115-
SIMPLEFOC_DEBUG("Current sense init failed, no DMA?");
116-
return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED;
117-
}
118109

119110
Stm32CurrentSenseParams* params = new Stm32CurrentSenseParams {
120111
.pins = { pinA, pinB, pinC },
121-
.adc_voltage_conv = (_ADC_VOLTAGE) / (_ADC_RESOLUTION)
112+
.adc_voltage_conv = (_ADC_VOLTAGE) / (_ADC_RESOLUTION),
113+
.timer_handle = (HardwareTimer *)(HardwareTimer_Handle[get_timer_index(TIM1)]->__this)
122114
};
123115

124116
return params;

0 commit comments

Comments
 (0)