====== V-DIO EL502 EEPROM Programming ====== The newly manufactured EL502 Mezzanine cards do not contain any data in their EEPROM yet. A Raspberry Pi and a custom made cable are used to programm the EEPROM. ===== Resources ===== The code of this project is under version control in a Git repository whose upstream is: https://git.gsi.de/BEA_HDL/V_DIO_EEPROM_Programming ===== How to program the EEPROM ===== * connect the custom made cable to the Raspberry Pi and to the Mezzanine * activate the I2C interface of the Raspberry Pi: ''%%sudo raspi-config%%'', browse to ''%%Interfaces%%'' and activate I2C * copy the ''%%src%%'' folder to the Raspberry Pi or clone the Git repository on it {{:ds:projects:vdio:Raspi_Mezzanine_Connection.jpg| I2C connection}} ^ **Raspberry Pi**^ **Raspberry Pi**^ **Mezzanine**^ **Mezzanine**^ | **pin number**| **signal name**| **pin number**| **signal name**| | 1| +3.3 V| 1| +5 V| | 3| SDA| 3| SDA| | 5| SCL| 2| SCL| | 6| GND| 26| GND| ==== Programming with individual serial numbers ==== * ''%%cd src%%'' * ''%%./write_serial_number.py %%'' ===== Alternative static programming and verification scripts ===== ==== Programming ==== * ''%%cd src%%'' * ''%%./write_eeprom.py%%'' This will program the content of ''%%src/eeprom_content.csv%%'' to the EEPROM. ==== Verification ==== * ''%%cd src%%'' * ''%%./read_eeprom.py%%'' This will create an output file ''%%src/eeprom_content_readback.csv%%''. You can compare it to the desired content using ''%%diff eeprom_content_readback.csv eeprom_content.csv%%''. ===== Testing the IO expanders ===== The six IO expanders on the EL502 Mezzanine can be accessed via the same I2C bus. The following commands can be used: ==== Listing the available I2C devices ==== ''%%i2cdetect -y 1%%'' will list all available I2C devices on the I2C bus ''%%/dev/i2c-1%%'' The output on the EL502 is the following: ''%%0 1 2 3 4 5 6 7 8 9 a b c d e f%%'' ''%%00: -- -- -- -- -- -- -- -- -- -- -- -- --%%'' ''%%10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --%%'' ''%%20: 20 21 22 -- 24 25 26 -- -- -- -- -- -- -- -- --%%'' ''%%30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --%%'' ''%%40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --%%'' ''%%50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --%%'' ''%%60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --%%'' ''%%70: -- -- -- -- -- -- -- --%%'' The devices with the addresses 0x20, 0x21, 0x22 are the IO expanders on the top side. The devices with the addresses 0x24, 0x25, 0x26 are the IO expanders on the bottom side. The device with the address 0x50 is the EEPROM. ==== Writing registers ==== === Via single CLI accesses === E.g. ''%%i2cset -y 1 0x20 0x02 0xff%%'' will write the value of ''%%0xff%%'' to the register ''%%0x02%%'' on the device with the I2C address ''%%0x20%%''. === Via a script === * ''%%cd src%%'' * ''%%./configure_io_expanders.py%%'' This will program the content of ''%%src/io_expander_config.csv%%'' to the registers of the IO expanders. ==== Reading registers ==== === Via single CLI accesses === E.g. ''%%i2cget -y 1 0x20 0x02%%'' will read the value of the register ''%%0x02%%'' on the device with the I2C address ''%%0x20%%''. === Via a script === * ''%%cd src%%'' * ''%%./read_io_expanders.py%%'' This will print all the register values of the IO expanders.