Board logo

标题: STM32-FSMC-NOR FLASH (11) [打印本页]

作者: yuyang911220    时间: 2014-8-24 16:59     标题: STM32-FSMC-NOR FLASH (11)

/* Write/read to/from FSMC SRAM memory *************************************/
/* Enable the FSMC Clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);/* Configure FSMC Bank1 NOR/SRAM2 */
FSMC_NOR_Init();

/* 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)
{
}
}




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0