Hi,
As part of preliminary phase for a smart meter board i am putting together a quick setup for SPI communication, i used an Atmega32u4 AVR directly connected to the ADUM1401 of a commercial samrt meter we used in the system previously, i also connected a rogowski coil to the first channel, there is nothing else connected yet since the goal is only do do the most possible basic setup of AD7880 and get reasonnable raw values from it, actual calibration and everythign else will come later.
My problem is that at the moment i only get constant values from registers AIRMS BIRMS CIRMS, i would expect that at least one of the channels get not constant value (since it has the rog. coil connected, actually even the others channels should have some varying value with the noise). Instead i got totally constant values for all 3 channels regardless if the rog. coil is connected or not, which is a clear sign that my setup is wrong.
As for the AD7880 i can get the silicon revision (0x01) and read COMPMODE (0x01FF) so the basic SPI communication is working fine. Here are the steps i used for initialisation : enable SPI (toggle CS), set PGA gain (16 for each), enable integrators, enable DSP. I know i should also clear all other registers and provide calibration values etc but at the moment i only want to get some meaninfull raw data out of the AD7880, clearly i must be missing a step.
here is an example of the datas i get (AIRMS BIRMS CIRMS, each 200mS)
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
0x0D068179 0x08365142 0x0D582C5B
this is consistent, i can reset and i will get the same values. Here is the firmware, i dont add all the registers definition (ade78xx.h) since i directly used the header from the official ADE7858 board to which i added the register for integrators which was missing for some reason.
EDIT : the problem has been solved, it was due to mistake in the SPI function (wrong bit order, must be LSB first).
update after solving
[edited by: Hoel at 12:07 AM (GMT 0) on 8 Nov 2019]