It is straightforward to connect an I2C device to a Jetson TX2. Looky here:
Background
I2C is a straightforward serial protocol. There are usually two wires, one is for transferring data (SDA), the other is a clock which is used to mark the begin and end of data packed (SCL). Most devices will also require power (VCC) and ground (GND). There are several I2C busses on the NVIDIA Jetson TX2 Development Kit. You can access I2C bus 0 and I2C bus 1 on the J21 GPIO header.
Hardware
Note:A Jetson TX2 with 64 bit L4T 28.2.1 (JetPack 3.2.1) is shown in the demo
First, before powering up the Jetson, let’s wire up the LED Segment Display. Here’s the pinout of the J21 GPIO Header. In our example, we power the display from the Jetson GPIO header at 5V.
For this example project, a Adafruit 0.56″ 4-digit 7-segment Display W/i2c Backpack – Green is wired to a Jetson. The Display is assembled per the Adafruit instructions.
On a Jetson TX2, here’s a wiring combination for I2C Bus 1:
GND J21-6 -> LED Backpack (GND)
VCC J21-2 -> LED Backpack (VCC – 5V)
SDA J21-3 -> LED Backpack (SDA)
SCL J21-5 -> LED Backpack (SCL)
Note that the TX2 also has a I2C Bus 0 interface. See the J21 Pinout Diagram.
If you wish to interface with I2C Bus 0:
GND J21-6 -> LED Backpack (GND)
VCC J21-2 -> LED Backpack (VCC – 5V)
SDA J21-27 -> LED Backpack (SDA)
SCL J21-28 -> LED Backpack (SCL)
Note: To use Bus 0 with the example, you will need to modify the example source code.
Software Installation
Once the board is wired up, turn the Jetson on.
Install the libi2c-dev library. In order to be able inspect the LED Display, you may find it useful to also install the i2c tools:
$ sudo apt-get install libi2c-dev i2c-tools
After installation, in a Terminal execute (1 is the I2C bus in this case):
$ sudo i2cdetect -y -r 1
ubuntu@tegra-ubuntu:~$ sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — — —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: — — — — — — — — — — — — — — — —
70: 70 — — — — — — —
You should see an entry of 0x70, which is the default address of the LED Segment Display. If you have soldered the address pins on the Display to change the address, you should see the appropriate address.
Next, install the library and example code which is available in the JHLEDBackpack repository on the JetsonHacks Github account. To install:
$ git clone https://github.com/jetsonhacks/JHLEDBackpack.git
$ cd JHLEDBackpack
$ cd example
You are then ready to compile the example and run it.
$ make
$ sudo ./displayExample
The display will go through a couple of examples, a blinking set of dashes, a hexadecimal display, a floating point number display, a count down timer and a clock example. Hit the ‘Esc’ key during the clock example to end the example.
The library defaults to I2C Bus 1. If you want to use Bus 0, modify the example file displayExample.cpp:
HT16K33 *displayMatrix = new HT16K33() ;
// Add the following line
displayMatrix->kI2CBus = 0; // Use I2C bus 0
int err = displayMatrix->openHT16K33();
Make sure you save the file, and run make on it.
Notes
Equipment and Supplies
The segmented LED display is a kit. You will need some elementary soldering skills for assembly. We tend to use:
- A soldering iron: Hakko FX888D-23BY Digital Soldering Station. The tip on the soldering iron used is the one included with the product.
- Solder, in the video 60/40 lead free solder was used.
Note: For the lead free solder, the iron was set at 750 degrees fahrenheit.
Note: A fan or fume extractor (such as the Hakko FA400-04 Bench Top ESD-Safe Smoke Absorber) should be used to avoid breathing soldering fumes. - Breadboard (In the video, a Solderless BreadBoard, 400 tie-points, 4 power rails was used)
- We also used some M/F breadboard jumper wire
New to electronics? This is a pretty easy project, looky here: Electronics Tutorials for some introductory material on how to start becoming a master.
Conclusion
Accessing the I2C bus on the Jetson TX2 J21 GPIO header is straightforward, and makes for easy prototyping!
The post I2C – NVIDIA Jetson TX2 Development Kit appeared first on JetsonHacks.