[Dilshan] built a dedicated I2C tester which allows for I2C bus control over USB using simple commands such as init
, read
, write
, etc. The Linux kernel has had I2C driver support for a couple of decades, but you’ll be hard pressed to find a computer or laptop with a I2C connector (excluding Bunnie Huang’s Novena hacker’s laptop, of course). This tester does require a Linux host, and his programs use libusb
on the computer side and V-USB
on the embedded side.
[Dilshan] put a lot of time into building this project, and it shows in the build quality and thorough documentation. With its single-sided PCB and all thru-hole construction, it makes a great beginner project for someone just getting into the hobby. At the heart of the tester is an ATmega16A in a 40-pin PDIP package (despite the Microchip overview page calling it a 44-pin chip), supported by a handful of resistors and transistors. Schematics are prepared in KiCad, code is compiled using gcc
and avr-gcc
, and he provides a label for the enclosure top. The only thing missing is information on the enclosure itself, but we suspect you can track that down with a little sleuthing (or asking [Dilshan] himself).
If you use I2C quite a lot, give this project a look. Easy to build, useful in the lab, and it looks nice as well. We have featured [Dilshan]’s work over the years, including this logic pattern generator and his two-transistor-on-a-breadboard superheterodyne receiver.
“you’ll be hard pressed to find a computer or laptop with a I2C connector”
If it’s gotten a standardized external display connector, then you technically have a i2c connector already, as long as the OS is Linux.
But some buffering and protection circuitry would definitely be recommended.
I knew I should’ve added “user accessible” to describe I2C.
You saying the VGA port on my laptop is hard to access?
Well, it requires giving yourself extra permissions. And if you want to rely on any of the linux-builtin abstractions – e.g. EEPROM – you need to keep poking things in /sys with elevated permissions.
e.g. I used the I2C in my VGA port to dump an EEPROM in a USB webcam, after discovering that just using i2cget only read the first 256B (and not the full 4KB)
An article on how to do this would be great.
“large” i2c eeproms are like books, since just like books, they essentially have pages where a set amount of information is on.
Alex Rossie: basically, this: https://stackoverflow.com/questions/52499762/linux-instantiate-from-user-space-eeprom-new-device#answer-53534324
The rest was “I had a cut-up Belkin VGA cable, one of those ones that were so cheap they didn’t use coax for the video signals, isolated the I²C wires, used logic analyzer clips to hook it up to the EEPROM in the webcam, and then copied the file from /sys to somewhere else”.
I intended to use this to start fuzzing the EEPROM, to see if I could disable the reported 16:9 modes to keep programs from trying to use them… but couldn’t figure out a good way to coax the webcam into rebooting.
@Alex Rossie – Here you go! https://hackaday.com/2014/06/18/i2c-from-your-vga-port/
I literally just jammed 3 wires into the i2c and gnd when I first tried it out on my laptop.
So it’s more that it requires a pin-out diagram and some bravery.
“A Pin-out Diagram and Some Bravery” would make a great t-shirt.
Does clock stretching work?
I²C multimaster too?
Stretching clocks worked for Salvador Dali.
A simple MCP2221A (a preprogrammed PIC16F1455) would have done the job as well. No need for a crappy VUSB job, and the lastest kernels already have i2c kernel drivers for it.
Very very nice mate. Add in a couple of simple zeners to make a 5v and a 3v3 supply too. That’d cover 99% of the cases.
That said the project above is very very nice.
If you didn’t feel like assembling anything, an Arduino board has everything on it already.
Well, why not.
But it seems awfully complicated, given the fact that every Mircropython capable microcontroller board with USB can do the same.
Via the USB based serial REPL, you can init the I2C (among other busses) , do a scan, read and write data.
Very handy for testing I2C peripherals before writing the actual code.
My favorite board ist the NRF52840-Dongle, which costs only $10, and has a shitload of features.
I’d rather bitbang with a needle and a battery than deal with micropython
B^)
why not just use I2C-Tiny-USB?
you can flash it on a cheap digispark board and has official kernel drivers.
plug it in and it shows up as an I2C bus.
Hdmi have i2c line too.
I think this is what we had the bus pirate [1] for, back in the early days of the republic.
[1] http://dangerousprototypes.com/docs/Bus_Pirate
Well, regarding the overview page from Microchip: the ATmega16A is also available in 44 pin package,
although not the PDIP version
quote from datasheet: “40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF”
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8154-8-bit-AVR-ATmega16A_Datasheet.pdf
That is the largest Bus Pirate that I have ever seen!
Just see it as another tool in the toolbox. It’s good for some tasks, not so good for others, and nobody is forced to use it.
Most of actual Mainboards or Laptops have an open I2C Connector inside.
But there seems no official documentation for them until you take a closer look in the hardware and began to reserch the deep burried software implementations …
I was wondering what it “brought to the party” that the Bus Pirate didn’t do. However the thing I’m really bothered about is that the project page shows the I2C connector being a 4-pin Molex/Dupont with Gnd and VCC at the two ends and nothing to stop it being flipped.