Skip to main content
Associate II
Solved

Bus voltage acquisition

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.

This topic has been closed for replies.
GMA
GMABest answer
ST Technical Moderator

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 'Best answer'.Best regards.GMA

4 replies

Senior III

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.

CeddAuthor
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
GMABest answer
ST Technical Moderator

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 'Best answer'.Best regards.GMA
CeddAuthor
Associate II

Hello GMA,

 

Thanks for this answer, it's all good.