SAMV71 Xplained Ultra Software Package 1.4

EEFC programming example

Purpose

This basic example shows how to use the Enhance Embedded Flash (EEFC) peripheral available on the newest Atmel samv7 Microcontrollers. It details steps required to program the internal flash, and manage secure and lock bits.

Requirements

This package can be used with SAM V71 Xplained Ultra board.

Description

The samv7 ROM code embeds small In Application Programming Procedure. Since this function is executed from ROM, this allows Flash programming (such as sector write) to be done by code running in Flash.

Note

The IAP function entry point is retrieved by reading the NMI vector in ROM (). This function takes two argument in parameter: bank index (0 or 1) and the command to be sent to the EEFC.

    static uint32_t  (*IAP_PerformCommand)(uint32_t, uint32_t);
    IAP_PerformCommand = (uint32_t (*)(uint32_t, uint32_t)) *((uint32_t *)
    0x00100008);
    IAP_PerformCommand(0, (0x5A << 24) | (argument << 8) | command);

IAP function returns the value of the MC_FSR register. The required steps are:

The samv7 features a security bit, based on a specific General Purpose NVM bit 0. When the security is enabled, any access to the Flash, SRAM, Core Registers and Internal Peripherals either through the ICE interface is forbidden. This example will reproduce this scene.

Usage

  1. Build the program and download it inside the SAM V71 Xplained Ultra board. Please refer to the Getting Started with SAM V71 Microcontrollers.pdf
  2. On the computer, open and configure a terminal application (e.g. HyperTerminal on Microsoft Windows) with these settings:
    • 115200 baud rate
    • 8 bits of data
    • No parity
    • 1 stop bit
    • No flow control
  3. Start the application.
  4. In the terminal window, the following text should appear:
         -- EEFC Programming Example xxx --
         -- xxxxxx-xx
         -- Compiled: xxx xx xxxx xx:xx:xx --
         -I- Unlocking last page
         -I- Writing last page with walking bit pattern
         -I- Checking page contents .................. ok
         -I- Locking last page
         -I- Try to program the locked page...
         -I- Please open Segger's JMem program
         -I- Read memory at address 0x0043FF00 to check contents
         -I- Press any key to continue...
         -I- Good job!
         -I- Now set the security bit
         -I- Press any key to continue to see what happened...
         -I- Setting GPNVM #0
         -I- All tests done
    

References

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines