Menu

AVR Hardware I2C

joe rocci
2015-04-09
2015-04-09
  • joe rocci

    joe rocci - 2015-04-09

    I'm trying this for the first time with the new library and I need to determine that my hardware hookup is capable of working. Does anyone have any known working code for this? For instance, something that scans the bus and returns the address of connected devices.

     
  • joe rocci

    joe rocci - 2015-04-09

    I'm using the demo file "I2C Hardware Discovery to Terminal". My device is an MCP4018 digipot addressed at 2F. The demo program is detecting it at 5E and 5F. Is that a bug or is there something more I should know about how this library works?

    Joe

     
    • Anobium

      Anobium - 2015-04-09

      I am very please the demonstration worked. This is good news.

      0x2F is the 7bit address. If you add the read and write bits to the 7bit address you will get 0x5E and 0x5F for the read/write.

      GCB has uses the 8bit address and then and/or the write/read bit as required. Using the 8bit address was the GCB method in the distance past.

      So, to write/read use 0x5E and GCB will take care of the rest.

      Have a look the DS1307.h - it is a good example.

       
    • Anobium

      Anobium - 2015-04-09

      @joe. Are you willing to create a library for the MCP4018 ?

      Use I2CEEPROM.h as an example if you are willing. The addition of the test of HIC2 and IC2 will ensure we can use the library for software and hardware I2C.

      Thank you.

       
  • joe rocci

    joe rocci - 2015-04-09

    More...
    Actually, I'm using the last release of GCB (not the hot release) with just the HI2C library from the hot release. Is that valid?

     
    • Anobium

      Anobium - 2015-04-09

      If you are using ATMEL I strongly, very strongly recommend v0.94 - the Hot Release.

      Otherwise should be ok. Just review the v0.94 Release Notes to ensure you are not requiring some of the new functionality.

      :-)

       
  • joe rocci

    joe rocci - 2015-04-09

    Let me see how this goes before I commit to making a specialized part handler. Initial result is that it SEEMS to be controlling the DigiPot, but I need to do more detailed testing. FYI, I made my own TWI handler some time ago for driving an SI570 chip and that worked well. However, I'd like to use 'mainstream' libraries for anything new I do, and this is the first attempt at that. Also FYI, I'm using no external pullups, even at 400 khz, just the internal pullups in the chip enabled.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.