AD7770 Always runs in low resolution mode

I am trying to connect AD7770 (on Eval-AD777xCMZ board) to ARM M4 microcontroler on STM32F407 board and use it in HIGH RES mode. So far I managed to read and write to registers on AD7770 but the problem is AD7770 gives me 8kHz signal on DRDY pin regardless of any configuration I put in the code. 

Here is parts of init code:

AD7770_init.ctrl_mode = AD7779_SPI_CTRL;
AD7770_init.spi_crc_en = AD7779_DISABLE;
AD7770_init.state[0] = AD7779_ENABLE;
...
AD7770_init.state[7] = AD7779_ENABLE;

AD7770_init.gain[0] = AD7779_GAIN_1;
...
AD7770_init.gain[7] = AD7779_GAIN_1;


AD7770_init.dec_rate_int = 64; // 2048 kHz (MOD_CLK) / 32 kSPS (ODR) = 64
AD7770_init.dec_rate_dec = 0;
AD7770_init.ref_type = AD7779_INT_REF;
AD7770_init.pwr_mode = AD7779_HIGH_RES;
AD7770_init.dclk_div = AD7779_DCLK_DIV_2;

memset(AD7770_init.sync_offset,0,sizeof(uint8_t)*8);
memset(AD7770_init.offset_corr,0,sizeof(uint32_t)*8);
memset(AD7770_init.gain_corr,0,sizeof(uint32_t)*8);

AD7770_init.ref_buf_op_mode[0] = AD7779_REF_BUF_DISABLED; //ad7779_ref_buf_op_mode
AD7770_init.ref_buf_op_mode[1] = AD7779_REF_BUF_DISABLED; //ad7779_ref_buf_op_mode

AD7770_init.sinc5_state = AD7779_DISABLE;

ret = ad7779_init(&pAD7770, AD7770_init);

ad7779_init function returns SUCESS, after this I change the reading mode to delta-sigma mode:

ad7779_set_spi_op_mode(pAD7770, AD7779_SD_CONV);

from here I only get 8kHz signal on DRDY pin which I assume it is low resolution mode. Can someone point where I am doing something wrong?

*The board is in the default configuration (SPI control mode).

*I have tested the writing and reading both in the code and by oscilloscope.

 

  • 0
    •  Analog Employees 
    on Jun 18, 2018 8:06 AM

    Hi Keivan,

    If you read the GENERAL_USER_CONFIG1, is the powermode bit properly set to HighRes?

    When you change the ODR, are you toggling the SRC_LOAD_UPDATE bit located in reg0x064? If so, can you check different ODR and measure the /DRDY frequency again?

    Thanks,

    Lluis.

  • Hi,

    I was trusting the driver I got from GitHub, but it seems there are many bugs and problems in that file. 
    Actually powermode was never set! also "ad7779_set_power_mode" had a bug (I will clean up and make pull request for the github repo). 

    As well, toggling SRC_LOAD_UPDATE bit was missing from "ad7779_init" function. Now after fixing everything I get around 27200 SPS in debug mode, unfortunately I don't have oscilloscope at the moment to measure actual DRDY frequency. I guess the problem now is the debug mode itself and it's overhead. I think I will get 32kSPS if I run the app in normal mode.

    Thank you for you help

    Keivan    

  • Hello,

    I share the same point with Keivan and I confirm also that this driver has multiple bugs and I am wondering how it is possible since this driver is there for such long time! 

    just two examples:

    1) line 205 is wrong since it is not doing the masked data (it should be  reg_data |= data & mask).

    2) line 713 the clock div has nothing to do with the register "AD7779_REG_CH_DISABLE"!

    And...

    I hope that such complex device (alot of functionality) will be handled by a good driver for ARM µC.

    Bests 

  • 0
    •  Analog Employees 
    on Aug 24, 2018 12:51 PM
    This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin