Post Go back to editing

Self Test Read back issue ad7616

Greetings!

I'm using an AD7616 in SPI serial mode.

I've put the AD7616 into digital interface self-test by writing a 0x86BB to the Channel Register. But When I'm trying to read back the value from the same location it always returns a 0x0 value. Initially, my goal is to run a self-test and read the values as said in the datasheet. So, not using any scope to check the waveforms.

I read many threads on this page but I'm unable to sort them out. Maybe my approach is wrong. The following is the main code.

int main(void){

struct ad7616_dev *dev;

uint32_t* buf = XPAR_PS7_DDR_0_S_AXI_BASEADDR;

Xil_ICacheEnable():
XilDCahceEnable();

Printf("AD7616 Reference Design.\n");

uint16_t     reg_data;

ad7616_setup(&dev, &init_param);

ad7616_reset(dev);

ad7616_write(dev, AD7616_REG_CHANNEL, 0x86BB) ;

uint16_t     temp = ad7616_read(dev, AD7616_REG_CHANNEL, &reg_data)

printf("0x%X", temp);


XilDCahceDisable();

Xil_ICacheDisable();

return 0;

}

  • Hello Moris,

    Are you getting 0x00 back as the ADC code? If so, it's like the ADC is in Reset state? Have you released the reset line prior to reading ADC data?

    Also, you may need to trigger conversions through CNVST before reading ADC data though.

    Regards,

    Lluis.

  • Yes, the result is always 0x0. Excuse me, how to toggle the CNVST pin? I'm sorry, I tried to toggle the CNVST pin through writing on the REG_UP_CTRL register but not succeeded. any suggestions, please. it's maybe a very easy thing but I'm totally messed up right now. 

  • Hi Lluis,

    I hope you're doing well.

    I released the reset pin and make it high. 

    I toggled the Cnvst signal using the following command 

    axi_io_write(dev->core_baseaddr, AD7616_REG_UP_CTRL, AD7616_CTRL_RESETN | AD7616_CTRL_CNVST_EN);

    mdelay(150);

    axi_io_write(dev->core_baseaddr, AD7616_REG_UP_CTRL, AD7616_CTRL_RESETN);

    after this I give the write command then toggle again as like above. Then write 0x0000 and toggle and finally read the register value but the result is same, it's always 0x0.

  • Hi Moris,

    I should be let the microcontroller no-OS driver team answer your question given I am not familiar with the axi functions. Microcontroller no-OS Drivers

    Meanwhile, for clarification, when you say you read 0x0000 back do you mean from the register or from the ADC code? A 0x0000 read back will point to me as to either the write operation did not take properly, the device is at reset state or the digital supply is not correct. Are you able to write and read other registers?

    I wrote a document some time ago about debugging the EVAL-AD7616SDZ board when used as standalone, not sure it may be of use for you case but it could light the spark. You may want to check even with a multimeter some of the steps shown there: (+) AD7616 Evaluation board in Standalone mode - Documents - Precision ADCs - EngineerZone (analog.com)

    Regards,

    Lluis.

  • Hi Lluis,

    Thanks for your response. 

     when you say you read 0x0000 back do you mean from the register or from the ADC code?

     I don't know if it's the register value or it's from the ADC code. Maybe there's a problem in my write operation and that's I already mentioned above. I tried to write and read through ad7616_spi_write(), ad7616_spi_read() commands respectively but unfortunately, the result is the same (0x0).

    I read your recommended document before and I'm sorry I forgot to mention that all the voltages are as expected and mentioned in the referred document. 

    The following is the screenshot of the logic analyzer.  

    A2(0) = CNVST 

    A2(1) = Busy

    A2(2) = CS

    A2(3) = SCLK

    A2(4) = DOUT1

    A2(5) = DIN

    A2(6) = RESET

     

  • Hi Moris,

    As I said before, I'd let Microcontroller no-OS Drivers comment on the axi functions. 

    What I can see from the scope shot is that the part is operative, you issue a CNVST and the BUSY signal responds. However the SPI lines are not doing anything, so the host controller is not sending any clock cycle to read the data. I guess the serial interface is properly selected both on the software drivers and on AD7616 hardware through SER/PAR pin.

    Regards,

    Lluis.

  • Hi,

    I'm still waiting for the response from Microcontroller no-OS Drivers team. I checked the SPI signal remains high always and that's not toggling. Kindly suggest me any solution as I'm stuck on it for many days.

  • Hi  , I'm going through old unresolved threads, is this still relevant ?