CAT24C512 is a 65,536words × 8 bits EEPROM (Electrically Erasable Programmable Read-Only Memory) chip manufactured by onsemi. This posting will provide the OSS-ECAL(Open Source Software for Electronic Components Abstraction Layer) for CAT24C512.
MCU interface : I2C
CAUTION:Please be sure to refer to the latest version of the Datasheet prior to actual design.
CAT24C512
General description
The CAT24C512 is a EERPOM Serial 512−Kb I2C internally organized as 65,536 words of 8 bits each.
It features a 128−byte page write buffer and supports the Standard (100 kHz), Fast (400 kHz) and Fast−Plus (1 MHz) I2C protocol.
Write operations can be inhibited by taking the WP pin High (this protects the entire memory).
External address pins make it possible to address up to eight CAT24C512 devices on the same bus.
On−Chip ECC (Error Correction Code) makes the device suitable for high reliability applications.
Feature
- Supports Standard, Fast and Fast−Plus I2C Protocol
- 1.8 V to 5.5 V Supply Voltage Range
- 128−Byte Page Write Buffer
- Hardware Write Protection for Entire Memory
- Schmitt Triggers and Noise Suppression Filters on I2C Bus Inputs (SCL and SDA)
- Low Power CMOS Technology
- 1,000,000 Program/Erase Cycles
- 100 Year Data Retention
- Industrial and Extended Temperature Range
- 8−pin, SOIC, TSSOP, 8−pad UDFN and 8−ball WLCSP Packages
- These Devices are Pb−Free, Halogen Free/BFR Free and are RoHS Compliant
OSS-ECAL specification
API Function
etSTS oCAT24C512_BYTE_WRITE( etCMP cmp, uint16 mem_adr, uint8 val )
The oCAT24C512_BYTE_WRITE function is an API function that writes the value of val to the specified address mem_adr for the CAT24C512. This function returns the return value eSTS_EXE until the time to complete the write (iCAT24C512_WRITE_TIME [ms]) has elapsed.
NOTE :
The iCAT24C512_WRITE_TIME [ms] elapsed measurement is calculated from the Thread period that calls this function, so set the Thread period to THREAD_OSS_ECAL_PERIOD [ms].
Please use the oCAT24C512_WP_DIS function to release write-protection before using this function.
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_PARAMETER | Parameter error(Memory address) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code | |
uint16 mem_adr | Memory address | 0x0000 to 0xFFFF | |
uint8 val | Data to write |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
etSTS oCAT24C512_PAGE_WRITE( etCMP cmp, uint16 mem_adr, uint16 len, uint8* buf )
The oCAT24C512_PAGE_WRITE function is an API function that writes the values buf[0] through buf[len-1] for the CAT24C512 in order from the specified address mem_adr. This function returns the return value eSTS_EXE until the time to complete the write (iCAT24C512_WRITE_TIME [ms]) has elapsed.
NOTE :
If mem_adr + len > 0bXXXXXXXXXXX1111111, addresses A7 to A15 are fixed and A0 to A6 are rolled over to 0bXXXXXXXXXXX0000000.
The iCAT24C512_WRITE_TIME [ms] elapsed measurement is calculated from the Thread period that calls this function, so set the Thread period to THREAD_OSS_ECAL_PERIOD [ms].
Please use the oCAT24C512_WP_DIS function to release write-protection before using this function.
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_PARAMETER | Parameter error(Memory address) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code | |
uint16 mem_adr | Memory address | 0x0000 to 0xFFFF | |
uint16 len | Number of bytes to write (Max 128) | ||
uint8* buf | Data buffer to write |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
etSTS oCAT24C512_IMM_ADR_READ( etCMP cmp, uint8* rlt )
The oCAT24C512_IMM_ADR_READ function is an API function that reads the value of 1 byte from the last Read or Write address + 1 for the CAT24C512 and stores it in rlt.
NOTE :
If the last Read or Write address + 1 > 0b111111111111111111111111, the address rolls over to 0b00000000000000000000000000.
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code | |
Parameter OUT | uint8* rlt | Data to read |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
etSTS oCAT24C512_SELECT_READ( etCMP cmp, uint16 mem_adr, uint8* rlt )
The oCAT24C512_SELECT_READ function is an API function that reads a 1-byte value from a specified address mem_adr for the CAT24C512 and stores it in rlt.
NOTE :
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_PARAMETER | Parameter error(Memory address) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code | |
uint16 mem_adr | Memory address | 0x0000 to 0xFFFF | |
Parameter OUT | uint8* rlt | Data to read |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
etSTS oCAT24C512_SEQ_READ( etCMP cmp, uint16 mem_adr, uint16 len, uint8* buf )
The oCAT24C512_SEQ_READ function is an API function that reads data for len from the specified address mem_adr for the CAT24C512 in sequence and stores the data from buf[0] to buf[len-1].
NOTE :
If mem_adr + len > 0b111111111111111111111111, the address rolls over to 0b00000000000000000000000000.
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_PARAMETER | Parameter error(Memory address) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code | |
uint16 mem_adr | Memory address | 0x0000 to 0xFFFF | |
uint16 len | Number of bytes to read | ||
Parameter OUT | uint8* rlt | Data to read |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
etSTS oCAT24C512_WP_EN( etCMP cmp )
The oCAT24C512_WP_EN function is an API function that outputs Write protect enable (write disable) = “Hi” for the CAT24C512.
NOTE :
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_GPIO_OBJECT | GPIO object selection error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
etSTS oCAT24C512_WP_DIS( etCMP cmp )
The oCAT24C512_WP_DIS function is an API function that outputs Write protect disable (write enable) = “Low” for the CAT24C512.
NOTE :
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_GPIO_OBJECT | GPIO object selection error | ||
Parameter IN | etCMP cmp | OSS-ECAL components code |
Function Correspondence Table by HAL
Arduino | Arduino | X |
ARM | Mbed | X |
Debian Project | Debian(Linux) v2022.04 | X |
Infineon | ModusToolbox | X |
NXP | MCUXpresso MXRT1051B_1052B | X |
Renesas | SSP 2.4.0 | X |
STM | STM32Cube FW_F4 | X |
Files
Folder* | File | summary |
---|---|---|
CAT24C512_HALNAME_VERSION/sample | sample.c (.cpp) | サンプル・アプリケーション・プログラム |
sample.h | サンプル・アプリケーション・ヘッダ | |
CAT24C512_HALNAME_VERSION | oCAT24C512.c (.cpp) | CAT24C512用OSS-ECALプログラム |
oCAT24C512.h | CAT24C512用OSS-ECALヘッダ | |
CAT24C512_ARDUINO.ino | Arduino用サンプル・アプリケーション・プログラム | |
oss_ecal.h | OSS-ECAL 共通ヘッダ (Ver 01.00.00以降、AUTOSARはVer01.01.07以降) | |
oTypes.h | AUTOSAR用typedefヘッダファイル | |
oHAL_i2c_stm32f4.c | STM32Cube FW_F4用HALプログラム | |
oHAL_i2c_stm32f4.h | STM32Cube FW_F4用HALヘッダ | |
user_setting.c (.cpp) | ユーザ設定定数・テーブル | |
user_setting.h | ユーザ設定ヘッダ | |
readme.md | Readme | |
OSS-ECAL Terms of Use.txt | OSS-ECAL利用条件 |
* For HALNAME, please refer to HAL Support.
HAL Support List
MCU/Board manufacturer | HAL | MCU* | Development environment* | HALNAME |
---|---|---|---|---|
Arduino | Arduino 1.8.6 | ATmega2560 ATmega328P | Mega 2560 Rev3 Arduino Pro Mini 3.3V | ARDUINO |
ARM | Mbed 6.17.0 | STM32F401RE | STM32 Nucleo-64 boards | MBED |
Infineon | ModusToolbox HAL Cat1 2.4.3 | CYBLE-416045-02 | CY8CPROTO-063-BLE PSoC 6 BLE Prototyping Kit | ModusToolbox |
NXP | MCUXpresso SDK iMXRT1051B_1052B ksdk2_0 | MIMXRT1052DVL6A | IMXRT1050-EVKB | iMXRT1051B1052B |
Renesas | SSP 2.4.0 | R7FS7G27H3A01CFC | S7G2 SK | SSP |
STM | STM32Cube FW_F4 V1.27.1 | STM32F401RE | STM32 Nucleo-64 boards | STM32F4 |
Debian Project | Debian(Linux) v2022.04 | TI AM335x | BeagleBone Black – Rev C | Linux |
* MCU and development environment at the time of development. Even if the same HAL is used, different MCUs and development environments may not work together.
OSS-ECAL Download
Please login before downloading. To register as a new user, please click here.
This OSS-ECAL is a sample version and can be downloaded without user registration, but please accept the OSS-ECAL Terms of Use before downloading.
HAL | Download OSS-ECAL Ver |
---|---|
Arduino 1.8.6 | |
Mbed 6.17.0 | |
ModusToolbox HAL Cat1 2.4.3 | |
MCUXpresso SDK iMXRT1051B_1052B ksdk2_0 | |
SSP 2.4.0 | |
STM32Cube FW_F4 V1.27.1 | |
Debian(Linux) v2022.04 |
If you are unable to download the File, please contact us and let us know the model number and HAL type. We will send you the file as an email attachment.
Built-in How to
Please refer to the following to incorporate API functions into your user program.
Pin A0, A1, and A2 should be set with the following code in user_setting.h.
How to set I2C Device Address in Renesas SSP.
// Device address Code bit2:A2, bit1:A1, bit0:A0
#define CAT24C512_1 0b00000111
For Infineon ModusToolbox HAL, set the I2C Timeout setting with the following code in user_setting.h. For details, see cyhal_i2c_master_write(), cyhal_i2c_master_read() Parameters timeout.
#define I2C_TIMEOUT 10U // Timeout[ms]
For STM32Cube FW_F4 HAL, I2C Timeout time is 25ms.
Note :
For the following command API functions, the Timeout time varies depending on the Read/Write data length len.
etSTS oCAT24C512_PAGE_WRITE( etCMP cmp, uint16 mem_adr, uint16 len, uint8* buf )
etSTS oCAT24C512_SEQ_READ( etCMP cmp, uint16 mem_adr, uint16 len, uint8* buf )
How to incorporate OSS-ECAL into user programs
How to incorporate multiple OSS-ECALs in a user program (same MCU function)
How to incorporate multiple OSS-ECALs in a user program (different MCU function)
How to incorporate multiple identical electronic components into a user program
How to reduce the impact on user programs by replacing electronic components