User Tools

Site Tools


the_i2c_bus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
the_i2c_bus [2020/01/16 13:42] – [I²C in FRC] tellthe_i2c_bus [2022/02/03 09:06] (current) tell
Line 15: Line 15:
   * Each "slave" device has an address, and each slave on the bus must have a unique address.   * Each "slave" device has an address, and each slave on the bus must have a unique address.
   * Addresses are 7 bits long, therefore there are only 128 possible addresses.   * Addresses are 7 bits long, therefore there are only 128 possible addresses.
-  * Some devices have pins that can chose from several addresses.  Others are limited to one per bus because the address can't be changed.+  * Some devices have pins that can chose from several addresses.  Others are limited to one per bus because their address can't be changed. 
  
-{{ :i2c-protocol.png |}} 
 ====== I²C Protocol ====== ====== I²C Protocol ======
  
Line 28: Line 28:
 This figure shows the basic idea: start, write one byte, acknowledge, stop: This figure shows the basic idea: start, write one byte, acknowledge, stop:
  
-  {{ :i2c-protocol.png |}}+{{ :i2c-protocol.png |}}
  
 All transfers start as shown here, with the master sending one byte onto the bus containing the 7 bit address and one bit that indicates whether the next byte will be a write (master to slave) or a read (slave sends to master). All transfers start as shown here, with the master sending one byte onto the bus containing the 7 bit address and one bit that indicates whether the next byte will be a write (master to slave) or a read (slave sends to master).
Line 55: Line 55:
 This is often the best place to find such examples.  Reading the sample code can help you understand the part's datasheet. This is often the best place to find such examples.  Reading the sample code can help you understand the part's datasheet.
  
- +By 2021 there appeared FRC Java libraries for some of the I²C sensors that we've used.  But going back to the Arduino C code is necessary for some of the interesting ones that are less common in FRC.
- +
- +
  
  
Line 74: Line 71:
 ===== Eastbots I2C Tester ===== ===== Eastbots I2C Tester =====
  
-In 2019 we had some flaky i2c operation, so built this wiring tester+In 2019 we had some flaky i2c operation, so we built this wiring tester
 [[testing_i2c_wiring]] [[testing_i2c_wiring]]
 +
 +
the_i2c_bus.1579200141.txt.gz · Last modified: 2020/01/16 13:42 by tell