wiki:EEPROM_onewire

Version 2 (modified by bratton, 18 years ago) (diff)

--

The EEPROM

Basic Functionality

  • 1024-bit memory space divided into 4 pages.
    • 3 of these have unlimited user read and write capabilities
    • the other page is used for storing calibration values and MAC addresses
    • Reading and writing these values requires 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 libaries are divided into OneWire_l.c and OneWire.c -- The latter contains everything the User needs to use the EEPROM.
  • The OneWire.c library provides the following functionality:
    • 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

The header file of OneWire.c library is given below.

short WarpOneWire_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 ONEWIRE device
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 WarpOneWire_WriteRadioCal(unsigned int* baseaddr, char RxNTx, char val_select, char I_val, char Q_val);
This functions writes a calibration value to the EEPROM
baseaddr is the base address of the ONEWIRE device
RxNTx specifies whether the values are the Rx or Tx values. 1 indicates Rx[BR? 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 if all goes well, FAILURE otherwise

void WarpOneWire_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 ONEWIRE device
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 WarpOneWire_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 ONEWIRE device
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 WarpOneWire_ReadWARPSerial(unsigned int* baseaddr);
Returns the the 2-byte serial number assigned by Rice WARP

void WarpOneWire_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 ONEWIRE device
returns a memory array containing the 1 byte family code, 6 byte serial
serial number and 1 byte CRC value
Assumes the OneWire master has been intialized.

char WarpOneWire_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 ONEWIRE device
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 must be an 8 byte array[BR? Returns SUCCESS if no error, otherwise FAILURE

char WarpOneWire_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 ONEWIRE device
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 must be an 8 byte array