Embedded Networking and Communications


I²C

  • I chose I2C as its Networking and Communications week Assessment.
  • I2C consists of one master and one or more slaves. And it is connected to one SDA line for sending and receiving data and one SCK line for synchronizing transmission and reception timing.
  • I2C Communications Korean Description Web Page here
  • week15



  • I decided to communicate with I2C using Attiny412, which I used for output week.
  • The communication board was designed using Kicad.
  • week15



    week15



  • After the design, the board was made using a Bantam milling machine.
  • week15



  • I made same board and soldered it. Good.
  • week15



  • I tested the code upload by connecting the my new board with the Uno board.
  • week15



    week15
  • Nice work!




  • I uploaded the I2C communication code made using the Wire library.
  • However, Atiny412 was not uploaded due to lack of memory Disaster...
  • week15



  • I had to find a new tiny library to insert code for I2C communication in atiny412.
  • downloaded the tinywire library and added it to the Arduino library.
  • TinyWire librar here
  • week15



  • And I ran the example code, but there was an error message saying that multiple libraries were found for "TinyWire.h," so I haven't solved it yet.
  • week15



    #include 
    
    byte own_address = 10;
    
    
    void setup() {
    	// config TinyWire library for I2C slave functionality
    	TinyWire.begin( own_address );
    	// register a handler function in case of a request from a master
    	TinyWire.onRequest( onI2CRequest );
    }
    
    void loop() {
    
    }
    
    // Request Event handler function
    //  --> Keep in mind, that this is executed in an interrupt service routine. It shouldn't take long to execute
    void onI2CRequest() {
    	// sends one byte with content 'b' to the master, regardless how many bytes he expects
    	// if the buffer is empty, but the master is still requesting, the slave aborts the communication
    	// (so it is not blocking)
    	TinyWire.send('b');
    }
  • my work

  • my new board here