/* Read NOR memory ID */
FSMC_NOR_ReadID(&NOR_ID);
FSMC_NOR_ReturnToReadMode();
/* Erase the NOR memory block to write on */
FSMC_NOR_EraseBlock(WRITE_READ_ADDR);
/* Write data to FSMC NOR memory */
/* Fill the buffer to send */
Fill_Buffer(TxBuffer, BUFFER_SIZE, 0x3210);
FSMC_NOR_WriteBuffer(TxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read data from FSMC NOR memory */
FSMC_NOR_ReadBuffer(RxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read back NOR memory and check content correctness */
for (Index = 0x00; (Index < BUFFER_SIZE) && (WriteReadStatus == 0); Index++)
{
if (RxBuffer[Index] != TxBuffer[Index])
{
WriteReadStatus = Index + 1;
}
}
if (WriteReadStatus == 0)
{ /* OK */
/* Turn on LD1 */
GPIO_SetBits(GPIOF, GPIO_Pin_6);
}
else
{ /* KO */
/* Turn on LD2 */
GPIO_SetBits(GPIOF, GPIO_Pin_7);
}
while (1)
{
}
}