element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Enchanted Objects
  • Challenges & Projects
  • Design Challenges
  • Enchanted Objects
  • More
  • Cancel
Enchanted Objects
Blog Using the RGB LED Lighting Shield on SAMA5D4 Xplained
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: crjeder
  • Date Created: 24 Jun 2015 6:30 PM Date Created
  • Views 1045 views
  • Likes 2 likes
  • Comments 2 comments
  • sama5d4
  • atmel_sama
  • smart_key_hooks
  • atmel_sama5d4
  • enchanted_objects
  • xplained
Related
Recommended

Using the RGB LED Lighting Shield on SAMA5D4 Xplained

crjeder
crjeder
24 Jun 2015

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:

image

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

image

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: https://github.com/linux4sam/linux-at91/blob/master/arch/arm/boot/dts/at91-sama5d4_xplained.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_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)
  | AT91_XDMAC_DT_PERID(2))>,
        <&dma1
  (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)
  | 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 =
  <AT91_PIOE 29 AT91_PERIPH_E AT91_PINCTRL_NONE
  AT91_PIOE 30 AT91_PERIPH_E AT91_PINCTRL_NONE>;
  };
};

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.

samba_send_file_nand.png

Now the Shield can be used on the Xplained board

  • Sign in to reply

Top Comments

  • crjeder
    crjeder over 10 years ago in reply to Workshopshed +2
    In the beginning you will be overwhelmed by all the windows but once you get used to it is very powerful. Comparable to Cypres' PSoC Creator.
  • crjeder
    crjeder over 10 years ago in reply to Workshopshed

    In the beginning you will be overwhelmed by all the windows but once you get used to it is very powerful. Comparable to Cypres' PSoC Creator.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Workshopshed
    Workshopshed over 10 years ago

    Great explaination, Dave looks like a good system

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube