Forum | Documentation | Website | Blog

Skip to content

I2C driver refactoring (to allow listening to 2 addresses), adding ADC functionality, inreasing EEPROM size from 1kB to 4kB

Walter Schnoor requested to merge i2c_tar_refactor into main

This PR is for the following changes:

  1. Refactoring of the I2C target driver to enable responding to I2C traffic at two different I2C bus addresses (needed to enable EEPROM and ADC functionality over the same bus).
  2. Addition of ADC functionality over I2C (8 12-bit channels, compatible with AD7291 driver in Linux IIO framework). Some AD7291 functions are not implemented (like temp sensing & alerts) but analog channel raw reads are supported for measuring analog inputs easily.
  3. Increase of EEPROM size from 1kB to 4kB to make it fully compatible with the at24c32 device. This can result in writes to EEPROM occasionally taking longer than before in cases where many EEPROM writes have already occurred (due to need to swap EEPROM emulation dataset from one group to another when a group is full). However, having the full 4kB available seems to be the right choice from a compatibility perspective, and sysfs r/w operations now do not return 4 copies of the 1kB data that was previously stored, which is nice. I do recommend adding at24.write_timeout=1000 to the kernel command line to allow for longer writes to complete.

The readme.txt now has example device tree overlay text for the EEPROM and ADC functions. Both are tested on BeagleBone and are easy to load via uEnv.txt. For PocketBeagle 2 these could be adapted.

Merge request reports