Raspberry-93Cx6

Three-Wire Serial EEPROM Access Library for RaspberryPi

MIT License

Stars
6

Raspberry-93Cx6

Three-Wire Serial EEPROM Access Library for RaspberryPi.

I used this as a reference.


Interface

It look like SPI. But CS is ACTIVE HIGH. And data bit is not always 8bit.


Memory size vs Organization

The 93Cx6 memory is organized either as bytes (x8) or as words (x16). If Organization Select (ORG) is left unconnected (or connected to VCC) the x16 organization is selected. When Organization Select (ORG) is connected to Ground (VSS) the x8 organization is selected.

Device Number of Bits Number of 8-bit Bytes Number of 16-bit Words
93C46 1024 128 64
93C56 2048 256 128
93C66 4096 512 256
93C76 8192 1024 512
93C86 16384 2048 1024

Software requirement

WiringPi Library


Build

for 93C46 cc -o main main.c 93Cx6.c -lwiringPi -DC46 [-DWORD/-DBYTE]

for 93C56 cc -o main main.c 93Cx6.c -lwiringPi -DC56 [-DWORD/-DBYTE]

for 93C66 cc -o main main.c 93Cx6.c -lwiringPi -DC66 [-DWORD/-DBYTE]

for 93C76 cc -o main main.c 93Cx6.c -lwiringPi -DC76 [-DWORD/-DBYTE]

for 93C86 cc -o main main.c 93Cx6.c -lwiringPi -DC86 [-DWORD/-DBYTE]

sudo ./main


API

// Open Memory Device
// model:EEPROM model(46/56/66/76/86)
// org:Organization Select(1=8Bit/2=16Bit)
int eeprom_open(int model, int org, int pCS, int pSK, int pDI, int pDO, struct eeprom *dev);

// Erase/Write Enable
void eeprom_ew_enable(struct eeprom *dev);

// Erase/Write Disable
void eeprom_ew_disable(struct eeprom *dev);

// Check Erase/Write Enable
bool eeprom_is_ew_enabled(struct eeprom *dev);

// Erase All Memory
void eeprom_erase_all(struct eeprom *dev);

// Erase Byte or Word
void eeprom_erase(struct eeprom *dev, uint16_t addr)

// Write All Memory with same Data
void eeprom_write_all(struct eeprom *dev, uint16_t value)

// Write Data to Memory
void eeprom_write(struct eeprom *dev, uint16_t addr, uint16_t value)

// Read Data from Memory
uint16_t eeprom_read(struct eeprom *dev, uint16_t addr)

Wireing for x8 Organization

Wireing for x16 Organization

It's insufficient in 3.3V Power supply. You have to supply 5V. So you have to shift level about MISO line.


93C46

93C56

93C66

93C76

93C86