还有就是页编程函数:
void SPI_FLASH_Page_Write(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite)
{
//Enable the write access to the FLASH
SPI_FLASH_Write_Enable();
//Select the FLASH: Chip Select low
SPI_FLASH_CS_LOW();
//Send "Write to Memory " instruction
SPI_FLASH_SendByte(MX25L4_PP);
//Send WriteAddr high nibble address byte to write
SPI_FLASH_SendByte((u8)((WriteAddr & 0xFF0000) >> 16));
//Send WriteAddr medium nibble address byte to write
SPI_FLASH_SendByte((u8)((WriteAddr & 0xFF00) >> 8));
//Send WriteAddr low nibble address byte to write
SPI_FLASH_SendByte((u8)(WriteAddr & 0xFF));
while(NumByteToWrite--)
{
SPI_FLASH_SendByte(*pBuffer);
pBuffer++;
}
//Deselect the FLASH: Chip Select high
SPI_FLASH_CS_HIGH();
SPI_FLASH_Wait_Busy(); //Waiting for end of writing
}
=====================================================
读取的Flash ID都是正确的,以下是我写入后读出的数据(首先写入的是一个这样的结构体
typedef struct{
unsigned char style;
u8 did;
u16 PulseTab[200];
}IR_Data; 且初始化为0)
这次是写入是正常的,但是下面就是写入256个字节,剩下的数据应该为0才对,为何是65535(即flash初始化的值呢)
请教一下,这是什么原因呢