Skip to content

nopnop2002/esp-idf-93Cx6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp-idf-93Cx6

Three-Wire Serial EEPROM Driver for esp-idf.

Software requirements

ESP-IDF V5.0 or later.
ESP-IDF V4.4 release branch reached EOL in July 2024.
ESP-IDF V5.1 is required when using ESP32C6 and ESP32H2.

Installation

git clone https://github.com/nopnop2002/esp-idf-93Cx6
cd esp-idf-93Cx6
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6/esp32h2}
idf.py menuconfig
idf.py flash

Configure

You have to set this config value with menuconfig.

  • CONFIG_MODEL
  • CONFIG_CS_GPIO
  • CONFIG_SK_GPIO
  • CONFIG_DI_GPIO
  • CONFIG_DO_GPIO
  • CONFIG_ORG

config-1 config-2 config-3 config-4

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

API

// Open Memory Device
// model:EEPROM model(46/56/66/76/86)
// org:Organization Select(1=8Bit/2=16Bit)
int eeprom_open(EEPROM_T * dev, int16_t model, int16_t org, int16_t GPIO_CS, int16_t GPIO_SK, int16_t GPIO_DI, int16_t GPIO_DO)

// Erase/Write Enable
void eeprom_ew_enable(EEPROM_T *dev)

// Erase/Write Disable
void eeprom_ew_disable(EEPROM_T *dev);

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

// Erase All Memory
void eeprom_erase_all(EEPROM_T *dev);

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

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

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

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

Wireing for x8 Organization

# 93Cx6 ESP32 ESP32-S2/S3 ESP32-C2/C3/C6/H2
1 CS -- GPIO12 GPIO12 GPIO0 (*1)
2 SK -- GPIO13 GPIO13 GPIO1 (*1)
3 DI -- GPIO14 GPIO17 GPIO2 (*1)
4 DO -- GPIO15 GPIO18 GPIO3 (*1)(*2)
5 GND -- GND GND GND
6 ORG -- GND GND GND
7 DC -- N/C N/C N/C
8 Vcc -- 5V 5V 5V (*2)

(*1)
You can change any GPIO using menuconfig.

(*2)
It's insufficient in 3.3V Power supply.
You have to supply 5V.
So you have to shift level about DO line.

esp32-93cx6-byte

Wireing for x16 Organization

# 93Cx6 ESP32 ESP32-S2/S3 ESP32-C2/C3/C6/H2
1 CS -- GPIO12 GPIO12 GPIO1 (*1)
2 SK -- GPIO13 GPIO13 GPIO2 (*1)
3 DI -- GPIO14 GPIO17 GPIO9 (*1)
4 DO -- GPIO15 GPIO18 GPIO10 (*1)(*2)
5 GND -- GND GND GND
6 ORG -- 5V 5V 5V (*2)
7 DC -- N/C N/C N/C
8 Vcc -- 5V 5V 5V (*2)

(*1)
You can change any GPIO using menuconfig.

(*2)
It's insufficient in 3.3V Power supply.
You have to supply 5V.
So you have to shift level about DO line.

esp32-93cx6-word

93C46

93c46-bytes

93c46-word

93C56

93c56-bytes

93c56-word

93C66

93c66-bytes

93c66-word

93C86

93c86-bytes

93c86-word

Note

esp-idf provides a similar sample here.
But it only supports 93C46.