Where can I find the usage example program for the built-in charging management module of sf32l52? I didn’t find any related examples under sdk/example.
I only found the following content in pmu.md and the official SDK programming guide:
void config_charger(void)
{
PMU_ChgCalParamTypeDef cal_param;
uint32_t current;
uint32_t volt;//config calibration data for charger, calibration is saved in EFUSE //cal_param.cc_mn = xxx; //cal_param.cc_mp = xxx; //cal_param.bg = xxx; //cal_param.cv_vctrl = xxx; //cal_param.rep_vctrl = xxx; status = HAL_PMU_ChgInit(&pmu_chg_handle, &cal_param); // config CC current current = 300; //300mA current = HAL_PMU_ChgConfigCcCurrent(&pmu_chg_handle, current); // config target voltage volt = 4300; //4300mV volt = HAL_PMU_ChgConfigTargetVolt(&pmu_chg_handle, volt); // enable IRQ and register callback HAL_PMU_ChgRegisterCallback(&pmu_chg_handle, pmu_chg_callback); status = HAL_PMU_ChgConfigIRQ(&pmu_chg_handle, PMU_CHG_IRQ_VBUS_RDY, PMU_CHG_IRQ_TRIG_MODE_DOUBLE_EDGE); RT_ASSERT(HAL_OK == status); status = HAL_PMU_ChgConfigIRQ(&pmu_chg_handle, PMU_CHG_IRQ_VBAT_HIGH, PMU_CHG_IRQ_TRIG_MODE_POS_EDGE); RT_ASSERT(HAL_OK == status); status = HAL_PMU_ChgConfigIRQ(&pmu_chg_handle, PMU_CHG_IRQ_EOC, PMU_CHG_IRQ_TRIG_MODE_POS_EDGE); RT_ASSERT(HAL_OK == status); HAL_NVIC_SetPriority(PMUC_IRQn, 5, 0); HAL_NVIC_EnableIRQ(PMUC_IRQn);}
Can this code be used directly? Could you please provide a complete official example program for battery voltage configuration?
Additionally, we noticed that this configuration includes settings for full-charge voltage and charging current. Could you please provide the available setting ranges for these two parameters? Can any value within the range be set, or are they limited to specific steps?