Serial EEPROM API Supported Serial EEPROM parts Serial EEPROM API introduction Detailed Serial EEPROM API Function presentation Serial EEPROM example application NET+OS Software Group 1-1
Supported Serial EEPROM Parts • Atmel AT25080/160/320/640 family of SPI serial EEPROMs. • EEPROM sizes are 1KB, 2KB, 4KB and 8KB respectively. • Driver uses four NET+50 GPIO lines to interface with the serial EEPROM to free up a chip select (CS) line and the SPI interface. • PortC, PortD, PortF, PortG and PortH GPIO lines are supported and I/O lines from different Ports can be mixed and matched. • Driver supports the burst mode read and page mode write features of the serial EEPROM for optimal performance.
Supported Serial EEPROM Parts (continued) • Driver supports the write protection features of the serial EEPROM.
Serial EEPROM API • NASEInit() • NASECreateSemaphores() • NASEWrite() • NASERead() • NASEMemset() • NASEBlockWriteProtect()
NASEInit() • int NASEInit (unsigned long eepromType, unsigned long chipSelectLine, unsigned long clockLine, unsigned long serialIn, unsigned long serialOut); • Specifies the EEPROM part and the GPIO lines used to interface the EEPROM. Also initializes global variables and the GPIO ports used to interface with the EEPROM part. • Called ONCE after power up. • eepromType can be: • AT25080, AT25160, AT25320 or AT25640
NASEInit() (continued) • chipSelectLine, clockLine and serialIn can be: • PORTC_BITx, PORTD_BITx, PORTF_BITx • “serialOut” can be: • PORTC_BITx, PORTD_BITx, PORTF_BITx, PORTG_BITx, PORTH_BITx
NASECreateSemaphores() • int NASECreateSemaphores(); • Creates the semaphores used to synchronize access to the serial EEPROM driver API. • Called by the user application ONCE after power up. • NASEWrite(), NASERead(), NASEMemset() and NASEBlockWriteProtect() are semaphore protected.
NASEWrite() • int NASEWrite(unsigned long offset, char * buffer, unsigned long length); • Writes data starting from the specified offset location in the serial EEPROM memory.
NASERead() • int NASERead(unsigned long offset, char * buffer, unsigned long length); • Reads data from the serial EEPROM starting at the specified offset location in the serial EEPROM memory.
NASEMemset() • int NASEMemset (unsigned long offset, char data, unsigned long length); • Initializes sections of the serial EEPROM with the specified character.
NASEBlockWriteProtect() • int NASEBlockWriteProtect (unsigned char protectionLevel); • Sets the write protect level for the serial EEPROM. • protectionLevel can be: • WRITE_PROTECT_LEVEL0 – write protection disabled • WRITE_PROTECT_LEVEL1 – write protection enabled for last ¼ of the address range • WRITE_PROTECT_LEVEL2 – write protection enabled for the second ½ of the address range • WRITE_PROTECT_LEVEL3 – write protection enabled for the entire address range.
NASEBlockWriteProtect() (continued) • Write protection settings are “non-volatile”. Thus, the write protection setting will remain until it is changed.
Serial EEPROM Example Application • \netosx\src\examples\naseeprom • Configured to access a AT25640 serial EEPROM using I/O lines from various GPIO ports. • Verifies the functionality of the serial EEPROM’s write protection feature. • Allows reading / writing entire serial EEPROM memory 1 byte per NASERead() / NASEWrite() call to reading / writing 8KB with one NASERead() / NASEWrite() call.