Linux support for 10-bit Slave Addressing

The I2C protocol knows about two kinds of device addresses: normal 7 bit addresses, and an extended set of 10 bit addresses. The sets of addresses
do not intersect: the 7 bit address 0x10 is not the same as the 10 bitaddress 0x10 (though a single device could respond to both of them).
I2C messages to and from 10-bit address devices have a different format.See the I2C specification for the details.
The current 10 bit address support is minimal. It should work, however you can expect some problems along the way:

  • Not all bus drivers support 10-bit addresses. Some don't because the  hardware doesn't support them (SMBus doesn't require 10-bit address  support for example), some don't because nobody bothered adding the code (or it's there but not working properly.) Software implementation  (i2c-algo-bit) is known to work.
  • Some optional features do not support 10-bit addresses. This is the  case of automatic detection and instantiation of devices by their drivers, for example.
  • Many user-space packages (for example i2c-tools) lack support for  10-bit addresses.


Note that 10-bit address devices are still pretty rare, so the limitationslisted above could stay for a long time, maybe even forever if nobody
needs them to be fixed.

(linux kernel Documentation/i2c/ten-bit-addresses)


That's bad news for me. But there might be a solution.


Firmware Modification

Since Infineon provides the source of the firmware of the RGB Shield I can try to change it to use 7-bit addresses.

My first attemt would be to simply modify the address to something 7-bit compatible. Steps to do are:

  1. download Dave
  2. download the firmware source code
  3. import source code in Dave as a project
  4. make changes
  5. compile
  6. program into flash

The steps 2, 3, 5 and 6 are covered in a tutorial by infineon and step 4 was suprisingly easy:

In the App view select the I2C003 APP:


Then right-click on it and select UIEditor. In UIEditor make the necessary changes:


Then compile and download to the board.

Enable I2C


The I2C-1 to which the RGB Shield is connected to is not enabled by default. This is done by modifying the device tree file (dts), compile it into a binary (dtb) and save that file to the flash

Device Tree

current dts:

I2C-1 is missing

i2c1: i2c@f8018000 {
  status = "okay";

and in the included "sama5d4.dtsi"

i2c1: i2c@f8018000 {
  compatible = "atmel,at91sam9x5-i2c";
  reg = <0xf8018000 0x4000>;
  interrupts = <32 IRQ_TYPE_LEVEL_HIGH 6>;
  dmas = <&dma1
  | AT91_XDMAC_DT_PERID(2))>,
  | AT91_XDMAC_DT_PERID(3))>;
  dma-names = "tx", "rx";
  pinctrl-names = "default";
  pinctrl-0 = <&pinctrl_i2c0>;
  #address-cells = <1>;
  #size-cells = <0>;
  clocks = <&twi0_clk>;
  status = "disabled";

i2c1 {
  pinctrl_i2c0: i2c1-0 {
  atmel,pins =

Compile device tree

make ARCH=arm dtbs

Should make all .dtb files

make ARCH=arm at91-sama5d4_xplained.dtb

would be enough.


Replacing dtb

Replace the current dtb with new one using SAM-BA as described at Linux4SAM

  1. Modify the Address to 0x180000
  2. Choose Send File Name open file dialog and select the dtb binary file and to program the binary to the NandFlash.
  3. Click Send File button to program the binary to the NandFlash in address 0x180000.


Now the Shield can be used on the Xplained board