Wrong frequency and power factor read from ATM90E26

Go To Last Post
3 posts / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,


I have difficulty reading the correct voltage frequency (reg 49H)  and power factor (reg 4DH) values from the ATM90E26 meter.


The meter calibration parameters are as follows:

const uint16_t _plConstH = 0x001f;
const uint16_t _plConstL = 0x534f;
const uint16_t _lGain = 0x1475;
const uint16_t _lPhi = 0x0000;
const uint16_t _nGain = 0x0000;
const uint16_t _nPhi = 0x0000;
const uint16_t _pStartTh = 0x08bd;
const uint16_t _pNolTh = 0x0000;
const uint16_t _qStartTh = 0x0aec;
const uint16_t _qNolTh = 0x0000;
const uint16_t _mMode = 0x1422;

const uint16_t _uGain = 0xc702;
const uint16_t _iGainL = 0x3c5d;
const uint16_t _iGainN = 0x0000;
const uint16_t _uOffset = 0x0000;
const uint16_t _iOffsetL = 0x0000;
const uint16_t _iOffsetN = 0x0000;
const uint16_t _pOffsetL = 0x08bd;
const uint16_t _qOffsetL = 0x0000;
const uint16_t _pOffsetN = 0x0aec;
const uint16_t _qOffsetN = 0x0000;

The calibration sequence is:

//Software reset	
writeMeterReg(METER_CMD_SOFT_RESET, 0x789A);	
//Set Voltage sag irq=1, report on warnout pin=1, energy dir change irq=0
writeMeterReg(METER_CMD_FUNC_EN, _funcEn);	
//Set Voltage sag threshold
writeMeterReg(METER_CMD_SAG_TH, _sagTh);	
//Set metering calibration values
//Metering calibration startup command. Register 21 to 2B need to be set	
writeMeterReg(METER_CMD_CAL_START, 0x5678);	
writeMeterReg(METER_CMD_PL_CONST_H, _plConstH); //PL Constant MSB	
writeMeterReg(METER_CMD_PL_CONST_L, _plConstL); //PL Constant LSB		
writeMeterReg(METER_CMD_L_GAIN, _lGain);		//Line gain
writeMeterReg(METER_CMD_L_PHI, _lPhi); 			//Line calibration angle	
writeMeterReg(METER_CMD_N_GAIN, _nGain);		//Neutral gain
writeMeterReg(METER_CMD_N_PHI, _nPhi); 			//Line calibration angle
writeMeterReg(METER_CMD_P_START_TH, _pStartTh); //Active Startup Power Threshold	
writeMeterReg(METER_CMD_P_NOL_TH, _pNolTh); 	//Active No-Load Power Threshold	
writeMeterReg(METER_CMD_Q_START_TH, _qStartTh); //Reactive Startup Power Threshold	
writeMeterReg(METER_CMD_Q_NOL_TH, _qNolTh); 	//Reactive No-Load Power Threshold	
writeMeterReg(METER_CMD_M_MODE, _mMode); 		//Metering Mode Configuration. PGA = 4
//CS1 calculation
writeMeterReg(METER_CMD_CS_ONE, cs);
//Set measurement calibration values
writeMeterReg(METER_CMD_ADJ_START, 0x5678); 	//Measurement calibration startup command, registers 31-3A 		
writeMeterReg(METER_CMD_U_GAIN, _uGain);    	//Voltage rms gain	
writeMeterReg(METER_CMD_I_GAIN_L, _iGainL);   	//L line current gain	
writeMeterReg(METER_CMD_I_GAIN_N, _iGainN);		//N line current gain	
writeMeterReg(METER_CMD_U_OFFSET, _uOffset);	//Voltage offset
writeMeterReg(METER_CMD_I_OFFSET_L, _iOffsetL);	//Line current offset
writeMeterReg(METER_CMD_I_OFFSET_N, _iOffsetN);	//Neutral current offset
writeMeterReg(METER_CMD_P_OFFSET_L, _pOffsetL);	//Line active power offset
writeMeterReg(METER_CMD_Q_OFFSET_L, _qOffsetL);	//Line reactive power offset
writeMeterReg(METER_CMD_P_OFFSET_N, _pOffsetN);	//Neutral active power offset
writeMeterReg(METER_CMD_Q_OFFSET_N, _qOffsetN);	//Neutral reactive power offset
//CS2 calculation
writeMeterReg(METER_CMD_CS_TWO, cs);
//Stop Calibration
writeMeterReg(METER_CMD_CAL_START, 0x8765); //Checks correctness of 21-2B registers and starts normal metering if ok	
writeMeterReg(METER_CMD_ADJ_START, 0x8765); //Checks correctness of 31-3A registers and starts normal measurement  if ok	


With this calibration I read the voltage RMS (reg 49H) and the L line current RMS value (reg 48H) correctly but I read 24.98Hz (0x09C2) for the voltage frequency (reg 4CH) and 16.435 (0x4033) for the L line power factor (reg 4DH). The power factor is completely out of range and I don't understand why!


I tried to check the frequency with a multimeter by positioning the test leads on VP and VN of the meter and the multimeter reads 49.985Hz.


Has anyone had a similar problem?




Last Edited: Fri. Dec 13, 2019 - 02:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you using the SPI interface or the UART? The SPI interface uses data mode 3. Using the wrong mode could result in data shifted by a factor of two. If using UART, check for framing error and use CHKSUM to validate.


It's possible a shifted write to the calibration registers and a shifted read cancel out and to give the correct voltage and current.


Use an oscilloscope or logic analyzer to verify your serial timing matches the datasheet timing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the reply.


I'm using the SPI interface with data mode 3. I checked the timings with a logic analyzer and it all seems ok.


This is a screenshot with the signals when reading the voltage frequency: