This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • TI Thinks Resolved

ADS7924: failed to read and write the data into through i2c

Prodigy 50 points

Replies: 3

Views: 64

Part Number: ADS7924

Hi ,

I have been trying to read the values from the ADS7924 but each time i read the data from the data register of any channel i get the digital data as 11111111 .

below is the snippet of the code implemented .

can u please help me out in solving this .Am i missing anything.

---------------------------------------------------------------------------------------------code-----------------------------------------------------------------------------

extern void I2CSend_ADC(uint16 slave_addr_adc, uint16 num_of_args_adc, ...);
extern uint8 I2CReceive_ADC(uint16 slave_addr_adc, uint16 reg_adc);

#define ADC_ADD                 0x48
#define ADC_MODE                0x00
#define ADC_INT_CNTRL           0x01
#define ADC_DATA0_U             0x02
#define ADC_DATA0_L             0x03
#define ADC_DATA1_U             0x04
#define ADC_DATA1_L             0x05
#define ADC_DATA2_U             0x06
#define ADC_DATA2_L             0x07
#define ADC_DATA3_U             0x08
#define ADC_DATA3_L             0x09
#define ADC_ULR0                0x0A
#define ADC_LLR0                0x0B
#define ADC_ULR1                0x0C
#define ADC_LLR1                0x0D
#define ADC_ULR2                0x0E
#define ADC_LLR2                0x0F
#define ADC_ULR3                0x10
#define ADC_LLR3                0x11
#define ADC_INT_CONFIG          0x12
#define ADC_RESET               0x16

uint8 data_upper,data_lower,data1_upper,data1_lower,data_interupt,power_config,data2_lower,data2_upper,dev_id;
uint32 data_pd_vmon ,data_aux_vmon,veq_53V_aux,data_53V_aux_vmon;
uint32 veq_pd ,veq_aux;
uint32 voltage_pd,voltage_aux ;


void kk_ADC()
{


    I2CSend_ADC(ADC_ADD, 1, ADC_MODE, 0X80);


    I2CSend_ADC(ADC_ADD, 1, ADC_MODE, 0XCC);


    data_upper = I2CReceive_ADC(ADC_ADD,ADC_DATA0_U);


    kk_printf("\n the upper byte data of pd vmon is %d \n",data_upper);


    data_lower = I2CReceive_ADC(ADC_ADD,ADC_DATA0_L);


    kk_printf("\n the lower byte data of pd vmon is %d \n" ,data_lower);


    data_pd_vmon = (((data_upper<<8)|data_lower)>>4);


    kk_printf("\n the digital data of pd vmon is %d \n ",data_pd_vmon);


    veq_pd = (data_pd_vmon*3300)/4096UL;


    kk_printf("\n the voltage of pd is = %d.%d \n",veq_pd/1000,(veq_pd-(veq_pd/1000)*1000));

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------end--------------------------------------------------------

  • Rohith,

    Our ADS7924 expert is out of the office right now, so I thought I'd jump in and give a few comments.

    I would use an oscilloscope or a logic analyzer to capture the I2C communications. If you look at the SCL and SDA lines, you should see if the ADS7924 responds correctly to the communication. Check that the device sends and ACK with the address. At this point, the data being all 1s may imply that the device is not receiving any commands and not able to communicate at all.

    When you do get the scope shot, post it back here and we can look it over.

    Joseph Wu

  • In reply to Joseph Wu:

    Hi Joseph,

    Thanks for the inputs. i see that there is not transaction happening on the i2c bus.

    The MCU used is TM1431H6PGE . We are using I2C 2 bus for the ADC transaction , when i enable the interrupt of this I2C bus , the bus in getting hanged.

    Can the transaction happen without enabling the interrupt .currently the interrupt is not enabled.

    Master interrrupt is enabled.

    when i talk about interrupt it means Enabling  the interrupt in the NVIC .

    Thanks

    Rohith.

  • In reply to rohith banoth:

    Rohith,


    While I may be able help with communications concerning the ADS7924, I don't know how to set up the I2C for the microprocessor. Can you verify the name of this processor device? If this is a TI device, you could probably post your question about setting up I2C in one of the e2e forums.

    I'll close this question for now, but you should look to post this in one of the other processor forums for TI if this processor is from TI.


    Joseph Wu

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.