wiki:EEPROM_onewire

The EEPROM

Basic Functionality

  • 1024-bit memory space divided into 4 pages.
    • 3 of these are given unlimited user read and write capabilities
    • the other page is used for storing calibration values and MAC addresses
    • Each page is divided into 4 sectors of 8-bytes each. Read or write functions must be performed on an entire sector.
    • These functions require the user to provide a pointer to an 8-byte data array
  • Readable 64-bit lasered ROM containing 8-bit family code, 48-bit serial code, and 8-bit Cyclic Redundancy check (CRC).
  • Readable 16-bit serial code given by WARP
  • The provided libaries are divided into EEPROM_l.c and EEPROM.c -- The latter contains everything the User needs to drive the EEPROM.
  • The EEPROM.c library provides the following functionality:
    • Select a radio to be affected by subsequent reads/writes
    • Read valid calibration values that have been stored to a radio's EEPROM
    • Write calibration value to a radio's EEPROM
    • Read valid MAC addresses of the FPGA board and radios from the FPGA's EEPROM
    • Write MAC addresses of the FPGA board and radios to the FPGA's EEPROM
    • Read the 16-bit serial number given by WARP
    • Read the 64-bit lasered ROM written by the EEPROM manufacturer
    • Read data from the EEPROMs data pages
    • Write data to the EEPROMs data pages

A part of the header file EEPROM.h is given below.

char WarpEEPROM_EEPROMSelect(unsigned int* baseaddr, char EEPROM_select)

  • Choose the EEPROM to be affected by subsequent reads/writes
  • baseaddr is the base address of the EEPROM peripheral
  • EEPROM_select selects the appropriate EEPROM to drive
    0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4
  • Returns SUCCESS if clock set correctly
  • Returns FAILURE otherwise

short WarpEEPROM_ReadRadioCal(unsigned int* baseaddr, char RxNTx, char val_select)

  • This function checks to see if a valid calibration value is stored on the EEPROM
    and returns the value if so.
  • baseaddr is the base address of the EEPROM peripheral
  • RxNTx specifies whether the values are the Rx or Tx values. 1 indicates Rx
  • val_select selects which value to write
    0: DC offset 1: Gain IQ 2: Phase IQ
  • Returns a short where the most significant byte is the Q-value and
    the least significant byte is the I-value.

char WarpEEPROM_WriteRadioCal(unsigned int* baseaddr, char RxNTx, char val_select, char I_val, char Q_val)

  • This function writes a calibration value to the EEPROM
  • baseaddr is the base address of the EEPROM peripheral
  • RxNTx specifies whether the values are the Rx or Tx values. 1 indicates Rx
  • val_select selects which value to write
    0: DC offset 1: Gain IQ 2: Phase IQ
  • I_val is the I-component to be stored
  • Q_val is the Q-component to be stored
  • Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise

void WarpEEPROM_ReadMACAddress(unsigned int* baseaddr, char dev_select, char *MAC)

  • This function writes a 6-byte MAC address into a 6-byte array addressed by a pointer.
  • baseaddr is the base address of the EEPROM peripheral
  • dev_select specifies which device's MAC address to read
    0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4
  • *MAC is a pointer to a 6-byte array

char WarpEEPROM_WriteMACAddress(unsigned int* baseaddr, char dev_select, char *MAC)

  • This function writes a 6-byte MAC address into the EEPROM.
  • baseaddr is the base address of the EEPROM peripheral
  • dev_select specifies which device's MAC address to read
    0: FPGA Board 1: Radio1 2: Radio2 3: Radio3 4: Radio4
  • *MAC is a pointer to a 6-byte array containing the address
  • Returns SUCCESS if all goes well, FAILURE otherwise

short WarpEEPROM_ReadWARPSerial(unsigned int* baseaddr)

  • Returns the the 2-byte serial number assigned by Rice WARP
  • baseaddr is the base address of the EEPROM peripheral

void WarpEEPROM_ReadDSSerial(unsigned int* baseaddr, unsigned char *Serial)

  • Get Serial number from a EEPROM device. Assumes it is the only device on the bus.
  • baseaddr is the base address of the EEPROM peripheral
  • *Serial is a pointer to an 8 byte array
  • returns a memory array containing the 1 byte family code, 6 byte serial
    serial number and 1 byte CRC value

char WarpEEPROM_ReadUserMem(unsigned int* baseaddr, char page, char sector, unsigned char *array)

  • This function reads from a specified memory location in the 1024-bit memory.
  • Returns an 8-byte sector of the EEPROM.
  • baseaddr is the base address of the EEPROM peripheral
  • page must be 1-3, and refers to memory pages on the device
  • sector must be 1-3, and refers to the appropriate sector on the device
  • *array is a pointer to an 8-byte array[BR?
  • Returns SUCCESS (0x00) if no error, otherwise FAILURE (0xff)

char WarpEEPROM_WriteUserMem(unsigned int* baseaddr, char page, char sector, unsigned char *array)

  • Writes a given 8-byte array to a designated location in memory.
  • Essentially a wrapper of the WriteScratch, ReadScratch and Scratch2Mem functions
  • baseaddr is the base address of the EEPROM peripheral
  • page must be 1-3, and refers to memory pages on the device
  • sector must be 1-3, and refers to the appropriate sector on the device
  • *array is a pointer to an 8-byte array
  • Returns SUCCESS (0x00) if all goes well, FAILURE (0xff) otherwise

See a mapping of the memory space here:

Last modified 11 years ago Last modified on Aug 4, 2006, 10:55:33 AM