Detect external flash

1.Brief introduction to external flash

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.

2.Principle of external flash

According to the hardware data manual and schematic diagram of external flash image-2023022700001

The following results can be obtained:

  1. The SPI communication mode is used for control. In this experiment, the SPI mode of hardware is used for control.
  2. Each time W25Q64 is erased, it needs to take 1 sector as the unit, and the erasing time of each sector needs at least 150ms
  3. The maximum number of bytes per sector is 4096
  4. The ID number of w25Q64 is 0XEF16
  5. W25Q64 is an independent device. It will work automatically when powered on, so it does not need to be configured

3.Important code analysis for detecting external flash

If you want to understand the read and write operation of flash, please study this experimental project by yourself

4.Experimental result

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 image-2023022700002