Bit Bang I2C

56 views
Skip to first unread message

James Lynes

unread,
Aug 28, 2020, 7:55:08 PM8/28/20
to HiPi Perl

The I2C docs state:
"If you use the gpio bit banging driver then you can pass /dev/i2c-3 as the devicename"

Where would more information be found on this driver?

Thanks,
James

Mark Dootson

unread,
Aug 29, 2020, 2:13:42 AM8/29/20
to HiPi Perl
Hi,

Setting up the driver is done via /boot/config.txt
See https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README and search for i2c-gpio

An example param line in config.txt, using the i2c-gpio driver on the 'standard' GPIO pins for I2C ( instead of the standard kernel drivers ) that would give you /dev/i2c-3 would be

dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=02,i2c_gpio_scl=03,i2c_gpio_delay_us=2

This would give approx 100 kbit/s speed. You can vary the i2c_gpio_delay_us param to get a different speed.

You would need a very specific reason I think to use the i2c-gpio driver I think. In most cases the kernel driver is your best bet.

Mark
Reply all
Reply to author
Forward
0 new messages