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!