已回答假定已回答

ADE7878 有效值数据读取失败

chenr@eastups.com 在 2015-7-6 詢問的問題
最後回覆由Yiyi於2015-7-16提供

目前在做一个项目用到ADE7878芯片,调试过程中遇到以下几点问题:

 

1、实测AVDD无输出,DVDD输出2.5V;

2、采用内部ref基准,但是REF管脚只输出0.8V;如图所示,本来是采用外部基准,但是外部Ref参考电压设计成2.5V,已经割线,并外接4.7uf去耦电容。

3、VAP/VBP/VCP调理电路前输入市电227V左右,调理后实际峰值为450mV左右,但是AVRMS/BVRMS/CVRMS读取全为0;

 

 

软件上按照官网参考demo,初始化完成后,IRQ1中断上电后产生一次中断,IRQ0中断每隔一段时间产生一次,这些都没有问题,另外SPI通讯确认没有问题;主要问题就是读取有效值没有数据产生;

 

App_WriteReg()函数已经对寄存器的读写的数据长度 做了处理;   

 

void App_InitConfig(void)
{
App_WriteReg(GAIN,0x0000);      //config the  Gain of the PGA , which is before the ADC of ADE7878
App_WriteReg(CONFIG2,0x00);     //
App_WriteReg(HPFDIS,0x0000);     //enabled high-pass filters
App_WriteReg(VLEVEL,491520);

App_WriteReg(AIGAIN,0x00000000);    //calibration
App_WriteReg(AVGAIN,0x00000000);
App_WriteReg(BIGAIN,0x00000000);
App_WriteReg(BVGAIN,0x00000000);
App_WriteReg(CIGAIN,0x00000000);
App_WriteReg(CVGAIN,0x00000000);
App_WriteReg(NIGAIN,0x00000000);
  App_WriteReg(AIRMSOS,0x00000000);
App_WriteReg(AVRMSOS,0x00000000);
App_WriteReg(BIRMSOS,0x00000000);
App_WriteReg(BVRMSOS,0x00000000);
App_WriteReg(CIRMSOS,0x00000000);
App_WriteReg(CVRMSOS,0x00000000);
App_WriteReg(NIRMSOS,0x00000000);
  App_WriteReg(AWGAIN,0x00000000);
App_WriteReg(AWATTOS,0x00000000);
App_WriteReg(BWGAIN,0x00000000);
App_WriteReg(BWATTOS,0x00000000);
App_WriteReg(CWGAIN,0x00000000);
App_WriteReg(CWATTOS,0x00000000);
App_WriteReg(APHCAL,0x0000);
App_WriteReg(BPHCAL,0x0000);
App_WriteReg(CPHCAL,0x0000);
App_WriteReg(CF1DEN,0x00A7);    //configure the ENERGY-TO-FREQUENCY
App_WriteReg(CF2DEN,0x00A7);
App_WriteReg(CF3DEN,0x00A7);
App_WriteReg(CFMODE,0x0E88);   //CF1-total active power, disable; CF2-total reactvie power, disable; CF3- fundamental avtive power, disable
App_WriteReg(ACCMODE,0x0000);
App_WriteReg(COMPMODE,0x01FF);
App_WriteReg(MMODE,0x00);
App_WriteReg(WTHR0,0x007BBE61);  //PMAX = 33,516,139   0.001WH/LSB  //page 47 datasheet Rev. E           
App_WriteReg(WTHR1,0x00000017);
App_WriteReg(VATHR0,0x007BBE61); //PMAX = 33,516,139
App_WriteReg(VATHR1,0x00000017);
App_WriteReg(VARTHR0,0x007BBE61); //PMAX = 33,516,139
App_WriteReg(VARTHR1,0x00000017);

App_WriteReg(LCYCMODE,0x0F);   //phase A is selected for zero cross
App_WriteReg(LINECYC,0x0064);

App_WriteReg(MASK0,0x00020020);  //IRQ0 interru enable
App_WriteReg(MASK1,0x00000000);  
App_WriteReg(MASK1,0x00000000);
App_WriteReg(MASK1,0x00000000);
}

 

#define TaskMeasure_Release_Ticks  10//ÈÎÎñÊÍ·ÅCPUµÄtickÊý
void  MeasureTask (void  *parg)
{
//INT8U *msg;
unsigned char i = 0;

OSTimeDly(100);

Ade7878_SPIInit();
App_InitConfig();
App_WriteReg(RUN,0x0001);
delay_ms(100);

    while(1)
    { 
  if(ucIRQ0Flag == 1)
  {
   ucIRQ0Flag = 0;
   Ade7878_CheckSTATUS0();                  //这里可以进去
   App_ReadUserData();
  }

  IWDG_Feed();//feed dog
  OSTimeDly(TaskMeasure_Release_Ticks);   /*  ÊÍ·ÅCPU  */
    }
}

 

結果