关于写W25X16的一些问题想咨询。
我安照原子大哥给程序写FLASH,结果写一部分大约10K的数据是对的。如果持续不断地写入数据,最后反而内部数据都是0xFF了。
请大家帮忙指点一下。谢谢
void W25X_Write_Bytes(uint32_t nSector,u8* pBuffer, u8 nBytes)
{
int i;
FLASH_CS_0();
W25X_Write_Enable();
FLASH_CS_0();
SPI_Write_Byte(W25X_PageProgram);
SPI_Write_Byte((u8)(nSector >> 16));
SPI_Write_Byte((u8)(nSector >> 8));
SPI_Write_Byte((u8) nSector);
for(i=0;i<nBytes;i++)
{ SPI_Write_Byte(pBuffer);
}
FLASH_CS_1();
W25X_Wait_Busy();
}
void USART1_IRQHandler(void)
{
if(USART_GetITStatus(USART1,USART_IT_RXNE)!=RESET) //直接发送十六进制花费时间70S 发送字符花费140S (baud 115200)
{
result = USART_ReceiveData(USART1);
W25X_Write_Bytes(pAddr++,&result,1);
USART_ClearITPendingBit(USART1, USART_IT_RXNE); /* Clear the USART Receive interrupt*/
}
}
|