硬件上是接的8位的NAND FLASH NAND128
下面是一段读ID的程序
/****************************************************************************** * Function Name : FSMC_NAND_ReadID * Description : Reads NAND memory's ID. * Input : - NAND_ID: pointer to a NAND_IDTypeDef structure which will hold * the Manufacturer and Device ID. * Output : None * Return : None *******************************************************************************/ void FSMC_NAND_ReadID(NAND_IDTypeDef* NAND_ID) { u32 data = 0;
/* Send Command to the command area */ *(vu8 *)(Bank_NAND_ADDR | CMD_AREA) = 0x90; //写读ID命令 *(vu8 *)(Bank_NAND_ADDR | ADDR_AREA) = 0x00;
/* Sequence to read ID from NAND flash */ data = *(vu32 *)(Bank_NAND_ADDR | DATA_AREA); //读ID
NAND_ID->Maker_ID = data & 0xFF; NAND_ID->Device_ID = (data & 0xFF00)>>8; NAND_ID->Third_ID = (data & 0xFF0000)>>16; NAND_ID->Fourth_ID = (data & 0xFF000000)>>24; }
/* Sequence to read ID from NAND flash */ data = *(vu32 *)(Bank_NAND_ADDR | DATA_AREA);
//这句就看不懂了,为什么 能一次读32位 |