STM32 SPI与FLASH通信有关函数问题
为什么上位机上单独返回temp1是0xEFtemp2是0x40temp3是0x15最后做了个运算temp=(temp1<<16)|(temp2<<8)|temp3;为什么...
为什么上位机上单独返回 temp1 是 0xEF temp2 是0x40 temp3是0x15
最后做了个运算temp = (temp1 << 16) | (temp2 << 8) | temp3;
为什么最后上位机返回的temp是0x15?
u8 SPI_FLASH_ReadID(void)
{
u32 temp1 = 0;
u32 temp2 = 0;
u32 temp3 = 0;
u32 temp = 0;
SPI_FLASH_CS_LOW();
SPI_FLASH_SendByte(W25Q_JEDECID);
temp1 = SPI_FLASH_SendByte(0xff);
temp2 = SPI_FLASH_SendByte(0xff);
temp3 = SPI_FLASH_SendByte(0xff);
SPI_FLASH_CS_HIGH();
temp = (temp1 << 16) | (temp2 << 8) | temp3;
return temp;
} 展开
最后做了个运算temp = (temp1 << 16) | (temp2 << 8) | temp3;
为什么最后上位机返回的temp是0x15?
u8 SPI_FLASH_ReadID(void)
{
u32 temp1 = 0;
u32 temp2 = 0;
u32 temp3 = 0;
u32 temp = 0;
SPI_FLASH_CS_LOW();
SPI_FLASH_SendByte(W25Q_JEDECID);
temp1 = SPI_FLASH_SendByte(0xff);
temp2 = SPI_FLASH_SendByte(0xff);
temp3 = SPI_FLASH_SendByte(0xff);
SPI_FLASH_CS_HIGH();
temp = (temp1 << 16) | (temp2 << 8) | temp3;
return temp;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询