Skip to main content
Associate II
August 21, 2025
Solved

Bus voltage acquisition

  • August 21, 2025
  • 3 replies
  • 432 views

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.

Best answer by GMA

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.

3 replies

Senior III
August 21, 2025

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
August 21, 2025

 

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
Technical Moderator
August 21, 2025

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
CeddAuthor
Associate II
August 22, 2025

Hello GMA,

 

Thanks for this answer, it's all good.