Post Go back to editing

AD9517-3 SPI cannot work question

Category: Hardware
Product Number: AD9517
Software Version: keil5

We try to use AD9517-3 for generating clock. However we cannot contact this chip by using SPI. Our MCU is STM32F767.

Our TEST CODEs are pasted as followed:


uint8_t AD9517_WriteReg(uint16_t addr,uint8_t data)//
{

uint8_t Txd[4];
Txd[0]=((addr>>8)&0x7F); //
Txd[1]=addr&0xFF;
Txd[2]=data&0xFF;
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_8, GPIO_PIN_RESET);//CS=low,start transmit
HAL_SPI_Transmit(&SPI1_Handler,Txd,3,1000);//SPI transmit
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_8, GPIO_PIN_SET);//CS=high,stop transmit

return 1;
}

uint8_t AD9517_ReadReg(uint16_t addr)//读取寄存器
{

uint8_t Txd[2];
uint8_t Rxd[2];
uint8_t Rdata;
Txd[0]=((addr>>8)&0x7F)|0x80; //
Txd[1]=addr&0xFF;
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_8, GPIO_PIN_RESET);//CS=low,start transmit
HAL_SPI_Transmit(&SPI1_Handler,Txd,2,1000);//SPI transmit
HAL_SPI_Receive(&SPI1_Handler,Rxd,1,1000);//SPI receive
Rdata=Rxd[0];
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_8,GPIO_PIN_SET);//CS=high,stop transmit

return Rdata;


}

AD9517_WriteReg(0x00,0x99); // SPI 4 wire configration
AD9517_WriteReg(0x232,0x01);
AD9517_WriteReg(0x04,0x01); //readback from active register
AD9517_WriteReg(0x232,0x01);
AD9517_WriteReg(0x0017,0xC0);//if this works, STATUS pin will change from LOW to HIGH
AD9517_WriteReg(0x232,0x01);
Rdata = AD9517_ReadReg(0x03); // if this works, rdata=0x53
printf("\r\n0x03:%d",Rdata);

The result of this code is : STATUS PIN is still in low level and Rdata has no valid data(0x03: 0xff)

Our schematic refers to the official design, and during our test: /PD=high,/RESET=high→low→high,/SYNC=high。Are there some errors? Hoping for advices!Thanks!

Parents
  • Hi,

    I recommend putting oscilloscope probes on the SPI signals (CSB, SCLK, SDIO and SDO, not clear if you use the 3-wire or 4-wire SPI mode) and do first a read operation of a register that has a default value that is not 0, like register 0x003 which has 0x53 default value. Verify it matches figure 65 in the AD9517-3 revE data sheet, page 53 and you can read the value correctly. Then, once you get a read operation to be executed reliably, you pass to register write operation. The AD9517-3 registers may be live or buffered. For example, register 0x000 is a live register because it manages the SPI communication. See if the default value of 0x18 is what you need, otherwise you can change it. See if you can then read back the desired value. Put the scope probes on that write operation and see if it matches one of the write operation figures from the data sheet at page 53.

    Then you can begin writing registers as desired, and then executing a write to register 0x232 with value 0x01 to move the value from the buffer into the live register. Then you can read the register back

    Petre

Reply
  • Hi,

    I recommend putting oscilloscope probes on the SPI signals (CSB, SCLK, SDIO and SDO, not clear if you use the 3-wire or 4-wire SPI mode) and do first a read operation of a register that has a default value that is not 0, like register 0x003 which has 0x53 default value. Verify it matches figure 65 in the AD9517-3 revE data sheet, page 53 and you can read the value correctly. Then, once you get a read operation to be executed reliably, you pass to register write operation. The AD9517-3 registers may be live or buffered. For example, register 0x000 is a live register because it manages the SPI communication. See if the default value of 0x18 is what you need, otherwise you can change it. See if you can then read back the desired value. Put the scope probes on that write operation and see if it matches one of the write operation figures from the data sheet at page 53.

    Then you can begin writing registers as desired, and then executing a write to register 0x232 with value 0x01 to move the value from the buffer into the live register. Then you can read the register back

    Petre

Children
No Data