![]() |
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
|
FX3 I2C EEPROM (model m24m02-dr) interfacing module. More...
#include "Flash.h"
Functions | |
static uint16_t | GetFlashDeviceAddress (uint32_t ByteAddress) |
Gets the flash devices address, based on the requested byte address. More... | |
static CyU3PReturnStatus_t | FlashTransfer (uint32_t Address, uint16_t NumBytes, uint8_t *Buf, CyBool_t isRead) |
Performs a transfer from the I2C flash memory. More... | |
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... | |
Variables | |
uint8_t | USBBuffer [4096] |
BoardState | FX3State |
static CyU3PDmaChannel | flashTxHandle |
static CyU3PDmaChannel | flashRxHandle |
FX3 I2C EEPROM (model m24m02-dr) 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.
void AdiFlashDeInit | ( | ) |
De-init the flash memory interfacing module.
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.
CyU3PReturnStatus_t AdiFlashInit | ( | ) |
Initializes flash memory interface module.
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
void AdiFlashRead | ( | uint32_t | Address, |
uint16_t | NumBytes, | ||
uint8_t * | ReadBuf | ||
) |
Read a block of memory from flash, at the specified byte address.
Address | The start address (in flash) to perform the read operation from |
NumBytes | The number of bytes to read from the flash |
ReadBuf | RAM buffer to read flash data into |
This function leaves the I2C EEPROM write functionality disabled. This prevents inadvertent writes from being processed.
void AdiFlashReadHandler | ( | uint32_t | Address, |
uint16_t | NumBytes | ||
) |
Handles flash read requests from control endpoint.
Address | The byte address in flash to start reading at |
NumBytes | The number of bytes to read. Max 4KB |
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.
void AdiFlashWrite | ( | uint32_t | Address, |
uint16_t | NumBytes, | ||
uint8_t * | WriteBuf | ||
) |
Write a block of memory to flash, at the specified byte address.
Address | The start address (in flash) to perform the write operation to |
NumBytes | The number of bytes to write to flash |
WriteBuf | RAM buffer containing data to be written to flash |
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.
|
static |
Performs a transfer from the I2C flash memory.
Address | The flash byte address to start the read/write operation from. Valid range 0x0 - 0x40000 |
NumBytes | The number of data bytes to transfer to/from the flash |
Buf | RAM data buffer. Write data must be placed here. Read data is returned here. |
isRead | Bool indicating if operation is read or write |
This function performs all interfacing with the ST m24m02-dr I2C EEPROM which is included on the iSensor FX3 board (and FX3 explorer kit). Before each transaction, AdiFlashInit is called to ensure the flash and DMA are configured properly. Then, for each transaction, the read/write is split into 64 byte (or less) chunks, which are each performed using a single I2C<->Mem DMA transfer. Once all required transfers have been performed, the flash is de-initialized.
|
static |
Gets the flash devices address, based on the requested byte address.
For the EEPROM, byte address bits 16-17 are encoded into the device address
|
static |
I2C Rx DMA channel handle
|
static |
I2C Tx DMA channel handle
|
extern |
FX3 state (from main)
Struct. which stores all run time configurable FX3 settings
|
extern |
Global USB Buffer, from main