Hi everyone,
I’m working on a custom FOC motor controller using the DRV8316CRQRGFRQ1, and I have some questions regarding how to properly implement current sensing with the SimpleFOC library.
The DRV8316 uses low-side current sensing with integrated current sense amplifiers, and outputs an analog voltage of the form:
SOx = Vref/2 ± Gain × Iout
So from what I understand, I need to:
-
Read the SOx signals using ADC
-
Subtract the offset (Vref/2)
-
Divide by gain (and shunt resistor?) to get current in amps
However, I’m a bit unsure about how this maps into SimpleFOC:
-
Should I use
LowsideCurrentSenseorGenericCurrentSense?
Since the DRV8316 already includes current sense amplifiers, I’m wondering ifGenericCurrentSenseis more appropriate, where I manually convert ADC readings to current. -
What should I use as the shunt resistance in
LowsideCurrentSense?
The driver doesn’t include internal shunt resistors (as far as I understand), so this depends on my external hardware. But since the output is already amplified, I’m unsure how to correctly set the parameters (gain vs shunt value). -
Timing / synchronization:
For low-side sensing, I assume ADC sampling needs to be synchronized with PWM (when low-side MOSFETs are on).
Does SimpleFOC handle this internally when usingLowsideCurrentSense, or do I need to manage ADC triggering manually?
If anyone has experience using DRV83xx drivers (especially DRV8316) with SimpleFOC, I’d really appreciate some guidance or example setups.
Thanks!