请问各位大侠,在红牛的读写AT45DB161D程序中,能够读出ID号,
FLASH_ID = SPI_FLASH_ReadID();
/* Check the SPI Flash ID */
if (FLASH_ID == AT45DB161D_FLASH_ID)
{
/* OK: Set GPIO_LED pin 6 */
GPIO_WriteBit(GPIO_LED, GPIO_Pin_6, Bit_SET);
}
else
{
/* Error: Set GPIO_LED pin 7 */
GPIO_WriteBit(GPIO_LED, GPIO_Pin_7, Bit_SET);
}
但是在下面的读写时候,最后一句printp("go");都没有执行到。
SPI_FLASH_PageErase(FLASH_SectorToErase);
/* Write Tx_Buffer data to SPI FLASH memory */
SPI_FLASH_BufferWrite(Tx_Buffer, FLASH_WriteAddress, BufferSize);
/* Read data from SPI FLASH memory */
SPI_FLASH_BufferRead(Rx_Buffer, FLASH_ReadAddress, BufferSize);
/* Check the corectness of written dada */
TransferStatus1 = Buffercmp(Tx_Buffer, Rx_Buffer, BufferSize);
printp("go");
而且在检测标志位TransferStatus1,if(TransferStatus1==PASSD)或者if(TransferStatus1==FAILED)都好,它都会进入该语句并点亮一个灯,求各位大侠指教指教。。添加的判断语句都是在原有程序上面添加的,原有的代码是没有改动过的。 |