25Q64写函数如下:
void Flash_Read_Array(unsigned long nAddr, unsigned char *pData, unsigned short nCount)
{
unsigned char *pAddr;
pAddr = (unsigned char *)&nAddr;
// printf(".......................2\r\n");
FLASHCSLow();
Flash_Send_Byte(FLASH_CMD_READ);
Flash_Send_Byte(*(pAddr + 2));
Flash_Send_Byte(*(pAddr + 1));
Flash_Send_Byte(*(pAddr + 0));
while(nCount--)
{
*pData++ = Flash_Get_Byte();
}
// printf(".......................3\r\n");
FLASHCSHigh();
}
如果按以下操作,会卡住:文章来源:https://www.toymoban.com/news/detail-510716.html
sInnerRecord *tespRecord;
Flash_Read_Array(INNER_FLASH_RECORD_START + index * sizeof(sInnerRecord), (uint8_t *)tespRecord, sizeof(sInnerRecord));
以下操作则可正常写入:文章来源地址https://www.toymoban.com/news/detail-510716.html
sInnerRecord tespRecord;
Flash_Read_Array(INNER_FLASH_RECORD_START + index * sizeof(sInnerRecord), (uint8_t *)&tespRecord, sizeof(sInnerRecord));
到了这里,关于STM32读写25Q64遇到的BUG的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!