Files
microchip-application-pec93…/Examples/flash/flash_prog_erase

flash_prog_erase

This example is a demo project to P/E (Program/Erase) main-area of eFlash.

The execute-bin will occupy front area of eFlash, as the result P/E the other area of eFlash

There are 3-case in this example

  • word data
  • half-word data
  • byte data

The execute-flow of every case:

  • Erase eFalsh (secotr by sector) and verify word-data is 0xFFFFFFFF or not

    If the word-data is NOT 0xFFFFFFFF, it will stop procedure and log error message

  • Program word/hword/byte-data to eFlash and verify the result value of eFlash

    If the data is NOT match, it will stop procedure and log error message

It also supports fix/random pattern

  • Fix pattern is 0x5A5A5A5Aul
  • Random pattern

    User should modify CONFIG_USE_RAND_DATA as below

    // at main.c
    /**
     *  Use random data as pattern
     */
    #define CONFIG_USE_RAND_DATA        1
    

If user wants to get more detail message, unmark CONFIG_MORE_MESSAGE definition

// at main.c
/**
 *  Get more log message
 */
#define CONFIG_MORE_MESSAGE

Log

Use serial port with baudrate 115200, 8bit, no parity check.

Oct 13 2025 14:12:47
This is eFlash Erase/Program/Read (0x00003400 ~ 0x00008000) example
## P/E with word value
  done~
## P/E with half-word value
  done~
## P/E with byte value
  done~
## P/E with data stream (32-bits valule and 4-aling length)
  done~
done ~~~~~~