[fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

Bo Berglund bo.berglund at gmail.com
Sat Apr 1 21:56:41 CEST 2023

I need to read and write data to an EEPROM connected by I2C on a RaspberryPi4.
The I2C channel is found in /dev as i2c-1:

$ ll /dev/i2*
crw-rw---- 1 root i2c 89, 1 2019-02-14 11:12 /dev/i2c-1

In this channel the EEPROM CAT24C128 is at address 0x50
The data on the device is organized as 256 pages of  64 bytes data each AFAIU.

I can check the EEPROM using i2c-tools, which I have installed, but I am unsure
if the read is correct...

Can I use Linux file system commands to read/write the data on the i2c EEPROM
memory device and if so how from fpc?

I have installed the current versions of Lazarus and Fpc on the RPi4 itself.

Bo Berglund
Developer in Sweden

More information about the fpc-pascal mailing list