iSensor-SPI-Buffer  1.15
Firmware for the iSensor-SPI-Buffer board to enable full throughput buffered data capture on Analog Devices IMUs
Functions
flash.c File Reference

iSensor-SPI-Buffer flash memory interfacing functions. More...

#include "reg.h"
#include "flash.h"
#include "stm32f3xx_hal.h"
Include dependency graph for flash.c:

Functions

static void PrepareRegsForFlash ()
 Clears all non-volatile registers in RAM and updates reg signature. More...
 
static uint16_t CalcRegSig (uint16_t *regs, uint32_t count)
 Calculate a signature of a block of RAM. Used for verifying flash memory contents. More...
 
void Flash_Update ()
 Flash update command handler. More...
 
void Flash_Load_Registers ()
 Load register values from flash memory to SRAM. More...
 
void Flash_Check_Logged_Fault ()
 Checks for error codes which may have been logged to flash, and sets the status register bit. More...
 
void Flash_Log_Fault (uint32_t faultCode)
 Stores an error code to flash memory. More...
 
void Flash_Fault_Log_Init ()
 Initialize flash error logging. More...
 

Detailed Description

iSensor-SPI-Buffer flash memory interfacing functions.

Copyright (c) Analog Devices Inc, 2020 All Rights Reserved.

Date
4/24/2020
Author
A. Nolan (alex..nosp@m.nola.nosp@m.n@ana.nosp@m.log..nosp@m.com)

Function Documentation

◆ CalcRegSig()

static uint16_t CalcRegSig ( uint16_t *  regs,
uint32_t  count 
)
static

Calculate a signature of a block of RAM. Used for verifying flash memory contents.

Returns
void

◆ Flash_Check_Logged_Fault()

void Flash_Check_Logged_Fault ( )

Checks for error codes which may have been logged to flash, and sets the status register bit.

Returns
void

Loads the previously stored error code from flash memory to the designated flash error register. If the error code is non-zero, sets the status register fault bit.

Here is the caller graph for this function:

◆ Flash_Fault_Log_Init()

void Flash_Fault_Log_Init ( )

Initialize flash error logging.

Returns
void

This function is intended to be called as part of the initialization process. It checks the validity of stored error log. If the log is invalid, error logging has not been initialized, and the log is cleared. Updates the FAULT_CODE and STATUS registers.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Flash_Load_Registers()

void Flash_Load_Registers ( )

Load register values from flash memory to SRAM.

Returns
void

After loading registers from flash, the signature of the loaded registers is compared to the signature stored in flash. If there is a mis-match, the STATUS FLASH_ERROR bit is set. Register values on page 253 - 254 are stored.

Here is the caller graph for this function:

◆ Flash_Log_Fault()

void Flash_Log_Fault ( uint32_t  faultCode)

Stores an error code to flash memory.

Parameters
faultCodeThe error code to store. Should be one of the defined fault types
Returns
void

This function is called when a fatal error is encountered by the system. Data is logged about the source of the error, and then a system reset is triggered. Once an error has been logged, it will be persistent until a fault code clear command is executed. We also don't care about error handling within this routine - as soon as it returns, the system will be reset.

Here is the caller graph for this function:

◆ Flash_Update()

void Flash_Update ( )

Flash update command handler.

Returns
void

Saves all non-volatile registers to flash memory. They will be retrieved on the next system boot. Also saves a signature of the registers, which is used for register contents validation on the next boot. Registers are backed up to flash starting at an offset of 62KB in flash memory

◆ PrepareRegsForFlash()

static void PrepareRegsForFlash ( )
static

Clears all non-volatile registers in RAM and updates reg signature.

Returns
void