Other Parts Discussed in Thread: MOTORWARE
How a c2000 uC is synching the ADC samples to make sure it is sampling when the low side fet is on? I am following lab guides and foc guides. There is no mention of how adc is synching with the low side fet turn on. How is this done, I can't understand.
Here are the codes in Lab01b in Motorware for BoostXL-DRV8301 and 28027F uC.
// acknowledge the ADC interrupt
HAL_acqAdcInt(halHandle,ADC_IntNumber_1);
// convert the ADC data
HAL_readAdcData(halHandle,&gAdcData);
static inline void HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)
{
HAL_Obj *obj = (HAL_Obj *)handle;
_iq value;
_iq current_sf = HAL_getCurrentScaleFactor(handle);
_iq voltage_sf = HAL_getVoltageScaleFactor(handle);
// convert current A
// sample the first sample twice due to errata sprz342f, ignore the first sample
value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_1);
value = _IQ12mpy(value,current_sf) - obj->adcBias.I.value[0]; // divide by 2^numAdcBits = 2^12
pAdcData->I.value[0] = value;