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.

Full Source file Request of AD7124-4 using TMS320F28027

Other Parts Discussed in Thread: TMS320F28027, C2000WARE

Hello, I am Han Tae Soo.

 

I am searching for source code about AD7124-4 A/D Converter in DSP( TMS320F28027) environment as you mention how to use AD7124-4 in STM32 web page( https://wiki.analog.com/resources/tools-software/product-support-software/ad7124-stm32  ).

Could you send me source code whitch is initializing and sending measured data via SPI communication?

Especially I want to attain source code how to use 7124-4 chip step by step measuring A/D data (reading and writing AD data with SPI communication).

 I want to know how to use registers of initializing and measuring, sending datas via SPI communication.

 I want full sour codes. Please send me it via e-mail.

My E-mail is  hts2046@naver.com and hts2046@daum.net.

I wrote down as bellows but MISO of SPI communication from AD7124-4 which does not reply. 

//=======================================================================================================================

void main(void)

{

uint16_t sdata, rdata;     

------------

spia_init();  // SPI baudrate is set to 2.5MHz as ad7124_app_initialize in ad7124_console_app.c

sdata = 0x0000;

ad7124_app_initialize(AD7124_CONFIG_A);     // AD7124_CONFIG_A = 0 . Initialize  --- (1)

sdata = AD7124_COMM_REG_WEN | AD7124_COMM_REG_WR | AD7124_ADC_CTRL_REG;   

// Select control register   --- (2)  

SPI_write(mySpi, sdata);   // this code is used in DSP of default mode


sdata = 0x0000;


sdata = AD7124_ADC_CTRL_REG_REF_EN | AD7124_ADC_CTRL_REG_POWER_MODE(0x2) | AD7124_ADC_CTRL_REG_MODE(0x1) | AD7124_ADC_CTRL_REG_CLK_SEL(0x0);

// Internal Ref. enable, Full Power Mode, Single Conversion, Internal 614.4KHz clock with not available CLK pin.   Set control register contents..   --- (3)

SPI_write(mySpi, sdata);  // mySpi is SPI handle. Write Control register to AD7124-4 via SPI comm.

sdata = 0x0000;

sdata = AD7124_COMM_REG_WEN | AD7124_COMM_REG_WR | AD7124_IO_CTRL1_REG;

// Select I/O control_1 register  --- (4)


SPI_write(mySpi, sdata);


sdata = 0x0000;

sdata =AD7124_IO_CTRL1_REG_IOUT1(0x0) | AD7124_IO_CTRL1_REG_IOUT0(0x0) | AD7124_IO_CTRL1_REG_IOUT_CH1(0x2) | AD7124_IO_CTRL1_REG_IOUT_CH0(0x2);
// IOut1/2=off, IOUT1/2_ch : reserved.   Set  I/O control_1 register --- (5)


SPI_write(mySpi, sdata);

sdata = 0x0000;


sdata = AD7124_COMM_REG_WEN | AD7124_COMM_REG_WR | AD7124_IO_CTRL2_REG;

  // Select I/O control_2 register --- (6)

SPI_write(mySpi, sdata);

sdata = 0x0000;


sdata = AD7124_IO_CTRL2_REG_GPIO_VBIAS0; // Bias 0 to channel0. Set  I/O control_2 register  --- (7) 


SPI_write(mySpi, sdata);

sdata = 0x0000;


sdata = AD7124_COMM_REG_WEN | AD7124_COMM_REG_WR | AD7124_CH0_MAP_REG;

//  Communication enable, write enable, Channel0. Select channel0 --- (8)

 
SPI_write(mySpi, sdata);


sdata = 0x00000;


sdata = AD7124_CH_MAP_REG_CH_ENABLE | AD7124_CH_MAP_REG_SETUP(0x0) | AD7124_CH_MAP_REG_AINP(0x0) | AD7124_CH_MAP_REG_AINM(0x01);

// Channel 0 enable, setupl=0, AINP=0, AINM= 1.  Set Channel 0  --- (9)

// AIN0 is positive and AIN1 is negative of channel 0.

SPI_write(mySpi, sdata);

for (; ; )

 {

   sdata = 0x0000;


   sdata = AD7124_COMM_REG_WEN | AD7124_COMM_REG_RD | AD7124_DATA_REG;

// Select Data register --- (10) 

   SPI_write(mySpi, sdata);

  rdata = SPI_read(mySpi);  // Data read.. but MISO of SPI do not reply.. MISO value is always 0.

  delay_loop();  // 1ms delay..

 }

}

//=======================================================================================================================

I am sorry that source code is too long.

I am referred to sour code ( https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_stm32_example.zip) but I can not find out fault point of no reply from AD7124-4 SPI (MISO).

I want to know how to initialize and transfer A/D data to Processor (DSP) via SPI communication, So I need real source code or sequence of programming.

I am appreciate at your comment.

Thank you.

Tae Soo, Han

  • Han,

    The driver you have referenced is for an Analog Devices ADC(AD7124) which they created a driver for the ST Micro STM32 MCU. 

    Neither of these devices are affiliated with Texas Instruments Inc and we have no working knowledge of these devices.

    I would recommend downloading C2000Ware; inside you will find device support for the F28027 device and some driver based examples for all the peripherals including the SPI.  You will need to comprehend the protocol of the AD7124  to add on to this driver to create a new on to interface with the AD7124.

    I would also look at the F28027 TRM specifically the SPI chapter  There are formulas to calculate the baud rate and how to set specific baud rates to match the AD7124.

    Best,
    Matthew

  • Thanks a lot sir,

    I will refer to this link and try to understand ad7124-4.

    Thank you