兄弟们,读取flash的JEDEC_ID能够正确发挥0xBF2643,但读取状态寄存器一直返回0xFF。
求助!!!!!!!!!
下面附代码:
static uint8_t Flash_TransferReceiveByte(IN uint8_t TxData)
{
uint16_t spiTxData = (uint16_t)TxData;
uint16_t spiRxData;
spiTransmitAndReceiveData(spiREG4, &g_spi4Config, 1, &spiTxData, &spiRxData);
return (uint8_t)spiRxData;
}
uint32_t Flash_GetJEDEC_ID(void){
uint32_t ID1, ID2, ID3, ID;
CS_ENABLE();
Flash_TransferReceiveByte(JEDEC_ID);
ID1 = Flash_TransferReceiveByte(DUMMY);
ID2 = Flash_TransferReceiveByte(DUMMY);
ID3 = Flash_TransferReceiveByte(DUMMY);
CS_DISABLE();
ID=((ID1<<16)|(ID2<<8)|ID3);
return ID;
}
uint8_t Flash_ReadStaReg(void){
uint8_t StaReg;
CS_ENABLE();
Flash_TransferReceiveByte(RDSR);
Flash_TransferReceiveByte(RDSR);
StaReg = Flash_TransferReceiveByte(DUMMY);
CS_DISABLE();
return StaReg;
}
|