yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
STM32F103RCT6 Core board📖
Basic introduction of core board
  • Basic introduction
Experimental documents
  • 1.Turn on RGB light
  • 2.Drive LCD
  • 3.Detect external Flash
  • 4.Read IMU raw data
  • 5. Key control
  • 6. External interruption experiment
  • 7. ADC acquisition
  • 8. PWM Breathing Lamp Experiment
  • 9. Serial communication
Download
  • Source code
  • Environment building tools
  • Hardware data
Download ZIP

Welcome to STM32F103RCT6 Core board repository

3.Detect external Flash

Detect external flash

Detect external flash1.Brief introduction to external flash2.Principle of external flash3.Important code analysis for detecting external flash4.Experimental result

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

​x
void 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);
    }

}
  • detcet_flash():This function reads the ID number of the external flash to determine whether the external flash is online.
  • flash_test():This function is used to read and write external flash, provided that the external flash is online.

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

Drive LCD
Read IMU raw data

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文