Hi,
1. there is code below in "ILPFC_Base-Settings.h". I suppose it's to convert the number to Q24 format, but why we are multiplying 4095, not 4096?
#define VBUS_OVP_THRSHLD ((int32)((435.0/VBUS_MAX_SENSE)*4095*4095))
2.In ILPFC-DPL-ISR.asm, for voltage and current loop control(INCR_BUILD = 3) the software flow can be concluded as:
read ADC result --> PFC ICMD --> CNTL_2P2Z current control --> PWM1 register update --> calculate 1/(Vrms*Vrms)--> calculate average Vbus --> CNTL_2P2Z voltage control --> calculate Vrect.
The sequence seems unreasonable, because we have to first implement CNTL_2P2Z voltage control and get the output, and then we can implement the CNTL_2P2Z current control . And we have to calculate Vrect before CNTL_2P2Z voltage control.
3. For sine analyzer, why don't we set Threshold=0, what's the benefit of such a threshold?
//sine analyzer initialization
sine_mainsV.Vin=0;
sine_mainsV.Iin=0;
sine_mainsV.SampleFreq=_IQ15(10000.0);
sine_mainsV.Threshold=_IQ15(0.1);//(0.015);//(0.02);