最近在开发AFE4490,读出 写过的寄存器,发现读数一直为0;有用过的小伙伴知道为什么吗?、
uint32_t AFE4490_SPIReadReg(uint8_t addr)
{
AFE4490_SPIWriteReg(CONTROL0,0x00000001); // CONTROL0最低位写1,SPI read is enabled !!必须在STE enable之前
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_12,GPIO_PIN_RESET); // STE enable
AFE4490_SendByte(addr); // Send lower register address
PPG_temp[2]=AFE4490_SendByte(0xff);
PPG_temp[1]=AFE4490_SendByte(0xff);
PPG_temp[0]=AFE4490_SendByte(0xff);
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_12,GPIO_PIN_SET);// STE disable
AFE4490_SPIWriteReg(CONTROL0,0x00000000); // CONTROL0最低位写0,SPI read is disabled
return (PPG_temp[2]*65536+PPG_temp[1]*256+PPG_temp[0]);
}
|