Handling Powerfail (Trizeps VI)

This sample shows how to register a gpio-pin as PowerFail-interrupt and how to store process-data to the XIP-region of flash when this event occurs. It will only work for Trizeps VI RAM-images (nk.nb0), because XIP-images (xip.bin) use the XIP-region to store the OS-image. 1 block = 64 pages, 1 page = 2048 bytes.

Application flow:

  1. Initialize flash.

  2. Get the position of reserved flash region.

  3. Read one block (= 64 pages) and one page and output read performance. ( ~14ms for 1 block, <220us for 1 page)

  4. Ask for new data…

  5. Register interrupt and wait for PowerFail to occur. Which GPIO to use is defined by POWERFAIL_GPIO.

  6. After 10 seconds or after PowerFail-event has occurred wait another 10ms and write one block and one page. ( ~27ms for 1 block, <440us for 1 page).

Download

See Also