Hi All:
I have a AD5522 Evaluation Board,and it's work well on Evaluation Software 1.6.1.
Now I want to use my STM32F103ZE to control the AD5522,but I can't communicate with AD5522 via SPI.
It's Evaluation Software timing,I want to read system control register,so I click READ SYSTEM CONTROL REGISTER ,and then, the software will send 0x10000000 to AD5522,and AD5522 will return 0x00000020 to me, it's work well in anytime.
Write 0x10000000
Read 0x000020 (Default value when AD5522 power on)
Now,I want to use my STM32F103ZE to read system control register,so I connect STM32F103ZE and AD5522,and remove the LK9 to disable USB function.As show below picture.
The first time,STM32F103ZE will send the command 0x10000000 to AD5522,that meaning read system control register
And then,STM32F103ZE will send 0xFFFFFF try to read data from AD5522, but the Busy pin goes low when 19th rising clock edge of SPI-CLOCK? Even so the result is 0x000020,that is true.
But the second time,STM32F103ZE send the command 0x10000000 to AD5522 again,the Busy pin goes low when 5th rising clock edge of SPI-CLOCK and 31th rising clock edge.
And then ,result is 0x000000,that's wrong(0x000020 is true).
Simulation SPI Code:
uint32_t AD5522_SPI(uint16_t bits, uint32_t dat)
{
uint32_t Recvice = 0;
uint8_t i;
AD5522_CS_L;
AD5522_Delay(2);
//bits = 32 when write data to AD5522 and bits = 24 when read data from AD5522
for(i = 0; i < bits; i++)
{
if(dat & 0x80000000) //MSB
{
AD5522_MOSI_H;
}
else
{
AD5522_MOSI_L;
}
//CLOCK High
AD5522_CLK_H;
dat <<= 1;
Recvice <<= 1;
AD5522_Delay(1);
AD5522_CLK_L;
if(AD5522_MISO) //Read data when CLOCK falling edge.
{
Recvice++;
}
AD5522_Delay(3)
}
AD5522_Delay(1);
AD5522_CS_H;
AD5522_CLK_L; //Idle time,CLOCK is low
AD5522_MOSI_L; //Idle time,MOSI is low
return Recvice;
}
This problem puzzle me three days,can you help me?
sorry for my bad English.
thanks.