cancel
Showing results for 
Search instead for 
Did you mean: 

may be a bug in the MC workbench

Ywang.3
Associate II

Hello, in the code I generated using MC workbench 5 or 6, there is something wrong with the part of the code that calculates the phase current value.

You can easily find it by searching in the generated code
PHandle->PhaseAOffset >>= 3;
PHandle->PhaseBOffset >>= 3;
PHandle->PhaseCOffset >>= 3;


I feel that the 3 here is wrong, it should be 4
Because NB_CONVERSIONS is 16, that is, the PhaseAOffset, B, and C obtained by adding and summing the values measured 16 times. This can be seen from the following code
if ( pHandle->PolarizationCounter < NB_CONVERSIONS )
{
pHandle->PhaseAOffset += *pHandle->pParams_str->ADCDataReg1[pHandle->CalibSector];
pHandle->PhaseBOffset += *pHandle->pParams_str->ADCDataReg2[pHandle->CalibSector];
PHandle->PolarizationCounter++;
}


Thanks.

1 REPLY 1
cedric H
ST Employee

Hello @Ywang.3 ,

Could you please detail your configuration, and specifically the STM32 you are using. Some ADCs have their own particularities, I am thinking in particular of the STM32F4.

Regards

Cedric