我用的是AT45DB081E Flash
对buffer1,buffer2的读写是没有问题的
buffer到main memory 的写, main memory 到buffer的写 就不对 ,程序如下
void AT45DB081_BuffertoMainmemory(u8 bufferNo,u32 WriteAddr,u16 NumByteToWrite)
{
AT45DB081_CS=0;
SPI2_ReadWriteByte(bufferNo);
SPI2_ReadWriteByte((WriteAddr & 0xFF0000) >> 16);
SPI2_ReadWriteByte((WriteAddr & 0xFF00) >> 8);
SPI2_ReadWriteByte(WriteAddr & 0xFF);
AT45DB081_CS=1;
AT45DB081_Wait_Busy();
}
我看一些例程 在发送三个字节地址的时候会写成 SPI2_ReadWriteByte(WriteAddr >> 7); //·¢?í24bitμ??·
SPI2_ReadWriteByte(WriteAddr<<1 );
SPI2_ReadWriteByte(0x00);
这是为什么呢? |