ADI iSensor FX3 Firmware  v2.9.4-pub
Firmware for the Analog Devices EVAL-ADIS-FX3 IMU Evaluation Platform. This firmware can be compiled using the Cypress EZ USB Suite IDE
Macros | Functions
Flash.h File Reference

Header file for FX3 flash interfacing module. More...

#include "cyu3dma.h"
#include "cyu3error.h"
#include "cyu3i2c.h"
#include "main.h"

Go to the source code of this file.

Macros

#define FLASH_PAGE_SIZE   0x40
 
#define FLASH_TIMEOUT_MS   5000
 

Functions

CyU3PReturnStatus_t AdiFlashInit ()
 Initializes flash memory interface module. More...
 
void AdiFlashDeInit ()
 De-init the flash memory interfacing module. More...
 
void AdiFlashWrite (uint32_t Address, uint16_t NumBytes, uint8_t *WriteBuf)
 Write a block of memory to flash, at the specified byte address. More...
 
void AdiFlashRead (uint32_t Address, uint16_t NumBytes, uint8_t *ReadBuf)
 Read a block of memory from flash, at the specified byte address. More...
 
void AdiFlashReadHandler (uint32_t Address, uint16_t NumBytes)
 Handles flash read requests from control endpoint. More...
 

Detailed Description

Header file for FX3 flash interfacing module.

Copyright (c) 2018-2020 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog Devices, Inc. and its licensors.

THIS SOFTWARE UTILIZES LIBRARIES DEVELOPED AND MAINTAINED BY CYPRESS INC. THE LICENSE INCLUDED IN THIS REPOSITORY DOES NOT EXTEND TO CYPRESS PROPERTY.

Use of this file is governed by the license agreement included in this repository.

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

Macro Definition Documentation

◆ FLASH_PAGE_SIZE

#define FLASH_PAGE_SIZE   0x40

Page size for attached i2c flash memory (64 bytes)

◆ FLASH_TIMEOUT_MS

#define FLASH_TIMEOUT_MS   5000

Flash operation timeout

Function Documentation

◆ AdiFlashDeInit()

void AdiFlashDeInit ( )

De-init the flash memory interfacing module.

Returns
void

This functions destroys the DMA channels used for interfacing with the I2C module, and re-inits the I2C controller to operate in register mode, with the previously selected bitrate.

◆ AdiFlashInit()

CyU3PReturnStatus_t AdiFlashInit ( )

Initializes flash memory interface module.

Returns
Status code indication the success of the flash init operation

The FX3 board features a ST m24m02-dr I2C EEPROM. This function initializes the FX3 I2C block to operate in DMA mode with the max supported I2C clock. It then configures the I2C Rx and Tx channels to perform a transfer

◆ AdiFlashRead()

void AdiFlashRead ( uint32_t  Address,
uint16_t  NumBytes,
uint8_t *  ReadBuf 
)

Read a block of memory from flash, at the specified byte address.

Parameters
AddressThe start address (in flash) to perform the read operation from
NumBytesThe number of bytes to read from the flash
ReadBufRAM buffer to read flash data into
Returns
void

This function leaves the I2C EEPROM write functionality disabled. This prevents inadvertent writes from being processed.

◆ AdiFlashReadHandler()

void AdiFlashReadHandler ( uint32_t  Address,
uint16_t  NumBytes 
)

Handles flash read requests from control endpoint.

Parameters
AddressThe byte address in flash to start reading at
NumBytesThe number of bytes to read. Max 4KB
Returns
void

The data read from flash is returned over the control endpoint. This limits a single read to 4KB. If greater than a 4KB read is needed, multiple transactions should be sent. Managing this limit is left to the higher level software sending USB commands.

◆ AdiFlashWrite()

void AdiFlashWrite ( uint32_t  Address,
uint16_t  NumBytes,
uint8_t *  WriteBuf 
)

Write a block of memory to flash, at the specified byte address.

Parameters
AddressThe start address (in flash) to perform the write operation to
NumBytesThe number of bytes to write to flash
WriteBufRAM buffer containing data to be written to flash
Returns
void

This function controls the flash write enable signal. This write enable signal is used to prevent un-intended writes the flash from user space, via I2C functions. This write enable signal is only present on the iSensor FX3 board rev C or newer, but there shouldn't be any downside to asserting it on older hardware models.