Hi, I am trying to do the phase calibration od ADE7953 using arduino and internal registers.
wrote the formula:
in C
#define CAL_ANGLE_RADIANS(x) (x*PI/180) AENERGYactual = (int32_t)ade7953.i2c_Read_32(AENERGYA_32); AENERGYexpected = (int32_t)(((double)VRMS * (double)IRMS * (double)cos(CAL_ANGLE_RADIANS(CALIBRATION_ANGLE_DEGREES)) * CALIBRATION_ACC_TIME) / ((double)WhLSB*(double)3600)); PHCALX = (int16_t)( (( (double)acos( (double)AENERGYactual * (double)cos(CAL_ANGLE_RADIANS(CALIBRATION_ANGLE_DEGREES)) / (double)AENERGYexpected )  (double)CAL_ANGLE_RADIANS(CALIBRATION_ANGLE_DEGREES) ) / ((double)CAL_ANGLE_RADIANS(360) * (double)INPUT_FREQUENCY) ) * (double)893850);
But I have some issues, the calibration is not correct and need to work also on the 10bit signed registers to manage the negative calibration values.
Could you provide the calibration code in C/C++?
thanks.
Domenico

[edited by: dome1980 at 2:13 PM (GMT 4) on 15 Aug 2023]