cancel
Showing results for 
Search instead for 
Did you mean: 

Bus voltage acquisition

Cedd
Associate II

Hello everybody,

 

I would like to know when the VBUS voltage measurement is updated. I am using the functions to read the voltage:

VBS_GetBusVoltage_d
VBS_GetAvBusVoltage_V

I am using the threads startMediumFrequencyTask, StartSafetyTask, and my own thread.

At system startup, I want to load a buffer. But the measurements taken are incorrect or zero at the board startup.

Is there any documentation on the acquisitions?

 

MCSDK : 6.4.1

Best regards.

1 ACCEPTED SOLUTION

Accepted Solutions
GMA
ST Employee

Hello @Cedd,

The raw VBUS value is obtained at the medium-frequency task in mc_tasks.c:

    uint16_t rawValueM1 =  RCM_GetRegularConv(&VbusRegConv_M1);
    CodeReturn |= errMask[bMotor] & RVBS_CalcAvVbus(&BusVoltageSensor_M1, rawValueM1);

The latest conversion is then available in VbusRegConv_M1.data.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

View solution in original post

4 REPLIES 4
STuser2
Senior II

Which MCSDK version you are using there are some differences in 6.4.0 compared to previous versions for acquiring the regular channels ADC data.

Cedd
Associate II

 

Might be a bug in the library...

I do see the variable AvBusVoltage_d increasing over time, but LatestConv always stays at 0.

Cedd_0-1755760240240.png

 

GMA
ST Employee

Hello @Cedd,

The raw VBUS value is obtained at the medium-frequency task in mc_tasks.c:

    uint16_t rawValueM1 =  RCM_GetRegularConv(&VbusRegConv_M1);
    CodeReturn |= errMask[bMotor] & RVBS_CalcAvVbus(&BusVoltageSensor_M1, rawValueM1);

The latest conversion is then available in VbusRegConv_M1.data.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
Cedd
Associate II

Hello GMA,

 

Thanks for this answer, it's all good.