ADS131A02初始化失败

1.  问题:ADS131A02初始化时,发送RESET指令后,可以接收到其响应FF02;但是接下来发送UNLOCK指令后,去接收不到其响应0655,用NULL指令去读取响应,也得不到。这是为什么?
2.. 条件:STM32F030CCT6驱动ADS131A02,ADS131A02采用SPI同步从模式、32位数据帧格式、开启汉明码(M0: 悬空,M1:上拉,M2:上拉)
我按照数据手册的时序图写的代码。
```
//读写命令函数
uint16_t ADS131A02_Write_CMD(uint16_t command)
{
uint16_t receive = 0X0000;

SPI2_CS_LOW();
receive = SPI2_Write_Read((uint8_t)(command>>8));
receive <<= 8;
receive |= SPI2_Write_Read((uint8_t)(command&0X00FF));
SPI2_Write_Read(0X00);
SPI2_Write_Read(0X00);
SPI2_CS_HIGH();
delay_us(10);
}
//ADS初始化
void ADS131A02_Init(void)
{
uint16_t receive_ack = 0x0000;

ADS_RESET_HIGH();//初始化时,复位引脚必须拉高
ADS131A02_Write_CMD(0X0011);发送RESET指令
do
{
delay_ms(6);//需要延时4.5ms以上才能完成复位周期
receive_ack = ADS131A02_Write_CMD(0X0000);//发送NULL指令,读取RESET命令的响应
}while(receive_ack != 0XFF02);
printf("Receive RESET Command Ack is:%#X\n",receive_ack);

ADS131A02_Write_CMD(0X0655);发送UNLOCK指令
do
{
delay_ms(6);
receive_ack = ADS131A02_Write_CMD(0X0000);//发送NULL指令,读取UNLOCK命令的响应
}while(receive_ack != 0X0655);
printf("Receive UNLOCK Command Ack is:%#X\n",receive_ack);//这里接收不到0X0655,直接卡死在while循环这。

while(1);
}

10 个回复