2025-11-18 10:37 PM
Hi there,
I generate a project using MCSDK 6.4.1 without any errors. (Find the project file in attachments)
However, when I compile my MDK project, it shows some errors as follows:
The details about the definition:
```c
#define VBUS_PARTITIONING_FACTOR 10.989010989010989 /*!< It expresses how
much the Vbus is attenuated
before being converted into
digital value */
#define NOMINAL_BUS_VOLTAGE_V 24U
#define ADC_REFERENCE_VOLTAGE 3.3
```
Why did these errors happen? Does that mean there are some errors in my MCSDK project file?
2025-11-18 11:02 PM - edited 2025-11-18 11:04 PM
The VBUS_PARTITIONING_FACTOR can never be greater than 1 it is R2/(R2 + R1)
#define UNDERVOLTAGE_THRESHOLD_d (uint16_t)((UD_VOLTAGE_THRESHOLD_V * 65535) /\
((uint16_t)(ADC_REFERENCE_VOLTAGE / VBUS_PARTITIONING_FACTOR)))
ADC_REFERENCE_VOLTAGE / VBUS_PARTITIONING_FACTOR) = 3.3 / 10.9 which will be 0
#define UNDERVOLTAGE_THRESHOLD_d (Undervoltage Value) / 0 for which it is showing error.
You have to ensure that the VBUS_PARTITIONING_FACTOR is correct.
If you verify the B-G431B-ESC1 schematic the voltage divider will be
18/(18+ 169) = 0.096