Detect external flash1.Brief introduction to external flash2.Principle of external flash3.Important code analysis for detecting external flash4.Experimental result
The board is equipped with an 8M external flash, model W25Q64, which is controlled by SPI. This flash is 8M, that is to say, the consumption is divided into 128 blocks, each block size is 64K, and each block is divided into 16 sectors, each sector is 4K. Each time the flash is erased, it needs to take one sector as the minimum unit. A total of 2048 sectors on board can be obtained from 128 blocks.
According to the hardware data manual and schematic diagram of external flash
The following results can be obtained:
xvoid show_flash(void)
{
char flash_buf[]="This is test";
u8 flash_flag = 0;
//flash Test
flash_flag = detcet_flash();
if(flash_flag == 0)
{
//find flash
sprintf(flash_buf,"W25Q64 normal!");
LCD_ShowString(10,15,(u8*)flash_buf,BLACK,WHITE,16,0);
//Read and write normally
flash_test();
}
else
{
sprintf(flash_buf,"W25Q64 fail....!");
LCD_ShowString(10,15,(u8*)flash_buf,BLACK,WHITE,16,0);
}
}
If you want to understand the read and write operation of flash, please study this experimental project by yourself
When the external flash is detected to be online and the read/write operation is successful, the on-board LED will flash continuously and display the following effects