-
Notifications
You must be signed in to change notification settings - Fork 0
EV3 I2C
The [AM1808 SoC](EV3 Processor) has 2 hardware Inter-Integrated Circuit (I2C) controllers. Additionally, there are 4 software controllers implemented using [fast interrupts](EV3 FIQ) (FIQs).
I2C0: [Boot EEPROM](EV3 EEPROM) @400kHz
I2C1: Not used/connected
[FIQ](EV3 FIQ) (software/bit-banging) I2C: Input ports 1-4 @10kHz
The Linux kernel has a well established framework for I2C drivers.
The SoC I2C uses the existing driver at drivers/i2c/busses/i2c-davinci.c as a backend.
Since there are not enough I2C controllers on the SoC, LEGO chose to implement the I2C buses for the four input ports using GPIOs. A secondary reason for this is that the NXT Ultrasonic sensors does not work well with standard I2C masters. It requires an extra clock pulse between the stop and the next start. (TODO: add references here.)
This Linux kernel has an existing GPIO i2c driver, but in order to get the performance needed, we have to use [fast interrupts](EV3 FIQ) (FIQs). (Be sure to follow the link for some interesting reading.) So, the really low level stuff is done in arch/arm/mach-davinci/legoev3-fiq.c and the rest is in drivers/i2c/busses/i2c-legoev3.c.
TODO: This was moved to I2C Sensor Addressing. Need to integrate this table somewhere or delete it.
Address | Sensor | Notes | |
---|---|---|---|
Shifted | Unshifted | ||
0x02 | 0x01 | LEGO NXT Ultrasonic sensor | This address is illegal according to the I2C spec, so we had to patch the kernel driver to make it work. |
0x14 | 0x0A | Mindsensors Light Sensor Array | The address can be changed programatically |