2023-12-12 12:41 PM
Is there an input field for the used shunt value or offset?
If not, where can I manipulate the code?
Solved! Go to Solution.
2023-12-13 10:13 AM
Hi Michael,
The current is read by an internal L9963E register in two complement format. The next step is to convert the current in a float value by specifying the Rshunt value. This is carried-out in:
float AEK_POW_BMS63EN_GetInstCurrentMeasurement( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt)
This function is located in AEK_POW_BMS63EN_id.c and it is invoked from AEK_POW_BMS63EN_VA_Measurement() in AEK_POW_BMS63EN_Appl.c
To avoid overcurrent faults, you need to properly set the threshold based on the chosen Rshunt.
To set the overcurrent threshold you can use the following function:
void AEK_POW_BMS63EN_SetOvercurrentThreshold( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt, float current_th_A)
This function is located in AEK_POW_BMS63EN_id.c and invoked from AEK_POW_BMS63EN_init() present in AEK_POW_BMS63EN_Appl.c
To make sure that voltage and current readings are properly synchronized, the cell has to activate the measurement procedure. This is performed by setting the Start Of Conversion (SOC) routine = 1.
Once this procedure is activated, the best way to read the current value is to use the GetInstCurrentMeasurement() function.
If the high precision is not required, you can rely on a different L9963E register for current reading but the measurement would result to be less precise:
float AEK_POW_BMS63EN_GetCalibCurrentMeasurement( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt)
The choice we made in our application is to use the first function with voltage and current synchronized.
Please note that if you use GetInstCurrentMesurement(), you need to make sure that the Start Of Conversion routine is activated otherwise you would read a wrong current value.
Best Regards,
AutoDevKit Team
2023-12-13 08:49 AM
According to UM3185 Figure 17 there should be a shunt value to change.
But when I open: AEK_POW_BMS63EN_id.c I find:
float AEK_POW_BMS63EN_GetInstCurrentMeasurement( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt) {
So there somewhere else a definition of Rshunt?
Where?
2023-12-13 10:13 AM
Hi Michael,
The current is read by an internal L9963E register in two complement format. The next step is to convert the current in a float value by specifying the Rshunt value. This is carried-out in:
float AEK_POW_BMS63EN_GetInstCurrentMeasurement( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt)
This function is located in AEK_POW_BMS63EN_id.c and it is invoked from AEK_POW_BMS63EN_VA_Measurement() in AEK_POW_BMS63EN_Appl.c
To avoid overcurrent faults, you need to properly set the threshold based on the chosen Rshunt.
To set the overcurrent threshold you can use the following function:
void AEK_POW_BMS63EN_SetOvercurrentThreshold( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt, float current_th_A)
This function is located in AEK_POW_BMS63EN_id.c and invoked from AEK_POW_BMS63EN_init() present in AEK_POW_BMS63EN_Appl.c
To make sure that voltage and current readings are properly synchronized, the cell has to activate the measurement procedure. This is performed by setting the Start Of Conversion (SOC) routine = 1.
Once this procedure is activated, the best way to read the current value is to use the GetInstCurrentMeasurement() function.
If the high precision is not required, you can rely on a different L9963E register for current reading but the measurement would result to be less precise:
float AEK_POW_BMS63EN_GetCalibCurrentMeasurement( unsigned AEK_POW_BMS63EN_devnum, uint16_t Rshunt)
The choice we made in our application is to use the first function with voltage and current synchronized.
Please note that if you use GetInstCurrentMesurement(), you need to make sure that the Start Of Conversion routine is activated otherwise you would read a wrong current value.
Best Regards,
AutoDevKit Team
2023-12-15 12:14 PM
Hi Max,
ahh I see, thanks.
So after having used a beautiful GUI in the BMS config, I shall head over to AEK_POW_BMS63EN_Appl.c to do set the overcurrent in Ampere an the shunt value in mOhms right there in the code?
As well as the NTC value. Wouldn´t it be nice to have all the necessary configs in the GUI?
But how do I set RShunt to 100uOhms, which are 0.1 mOhms when RShunt is a unsigned int?
I guess its milli Ohm in the code, or is it micro ohm?
2023-12-15 12:27 PM - edited 2023-12-15 01:05 PM
Start Of Conversion (SOC) routine = 1.
Maybe a total noob question, but where and how do I set SOC = 1 ?
Shall I work with registers or is there a already a function available?
2023-12-16 01:27 AM
Please see my last answer in the other post:
https://community.st.com/t5/autodevkit-ecosystem/bms63en-diagnostics-how-to/td-p/619392
2023-12-19 12:31 PM
@Orbiter wrote:...
But how do I set RShunt to 100uOhms, which are 0.1 mOhms when RShunt is a unsigned int?
I guess its milli Ohm in the code, or is it micro ohm?
Just to guide other readers:
I found the section in the datasheet, the unit for RSHUNT its actually uOhms.
So setting it to 100 means using a shunt of 100micro (= 0,1milli) Ohm.
The shunt may be changed for use in other current ranges as long as the measurement boundaries are not exceeded +/-150mV
And in case you wonder why it always shows an offset: Its designed to have a 3A offset which is equivalent to a 5/1000 error.