Post Go back to editing

AD7949 Eval hardware setup

Hi team,

i tried to read the AD7949 values visa SPI protocol but i am not getting proper data ,

please find the hardware configuration

SL No Description Voltage in V
1 VDDR 5
2 VDD 5
3 VIO 3.3
4 REF 4
5 REFIN 2.1
6 COM 0
7 REG Config 0x3C40
8 INCH1 3.3
9 SPI Baud Rate 25kbps

please help me any hardware setting is required?

Software Code :

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET);
SPI_Status = HAL_SPI_Transmit(&hspi1, (uint8_t *)&Data[0], 2, 10);//for channel 0
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_SET);

HAL_Delay(20);

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET);
__NOP();
__NOP();

HAL_SPI_Receive(&hspi1, (uint8_t *)&receiveBuffer[0], 2, 10);

__NOP();
__NOP();
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_SET);

let me know for any clarification.

thanks

krishna

  • Krishna,

    Can you first clarify what you are attempting to read back?   Is it the conversion result you are looking for or the configuration word you are attempting to varify?

    I'm not sure which processor and library you are using so I'm not 100% sure what all the variables in the SPI_TX and SPI_RCV function are doing but from what I can gather is that you are sending two bytes (starting at data address 0) followed by a delay followed by a read back of what looks like two more bytes.

    Assuming you are correctly aligning the configuration word 0x3C40 to the MSB of the transmission (such that the output looks like (0xF100, left justified), then the next thing you'll want to do is add another two read sequences.  If you want to read the configuration word you will also need to extend the number of bytes read from 2 to 4.  As mentioned in the datasheet, you need two conversion cycles to load the data from the interface into the internal memory space of the part. 

    Aligning the operations to your current code consider the following:

    1) During the SPI_Transmit call you are shifting the data into the internal shift register and initiating a conversion which completes during the idle time.

    2) During your second read you first read out the result of the previous "dummy" conversion and then initiate the second conversion.  One conversion period later the word you wrote into memory is ready such that on the next conversion it will be applied.

    3) During the first read I've suggested you add you'll be reading out the result of the second "dummy" conversion and starting the first conversion with the applied 0x3C40 code.  So you'll need one more transaction to see the result of that applied for the first time.

    Hope that makes sense

    Sean

  • Thanks for quick Reply  Skowalik!!

    i tried to read the ADC conversion data and i had seen the converted data.

    i used STM32f303 controller, in this controller have a inbuilt SPI library  functions,i called HAL_SPI_transmit(); functions   

    0x3C40

    Data[0] = 0x40

    Data[1] = 0x3C

     HAL_SPI_Transmit(&hspi1, (uint8_t *)&Data[0], 2, 10);//for channel 0

    Please share your email iD , i share code

    Thanks

    Krishna

  • Krishna,

    I don't believe you have the code left justified which could be your problem.   Try making data[1] 0xF1 and data[0] = 0x00.  Also make sure you are sending data[1] first.

    Sean