Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for i2c-tiny-usb: usb to iic bridge #1123

Closed
wants to merge 3 commits into from

Conversation

0xDRRB
Copy link
Contributor

@0xDRRB 0xDRRB commented Feb 20, 2024

Add support for i2c-tiny-usb via a new i2ctinyusb driver.

It's a device you can create yourself using an AVR ATtiny45 microcontroller or a Raspberry Pi Pico board, and which allows you to use sensors and other i2c modules (RTC, EEPROM, HSM/TPM, oled screen, etc.).

ugen2.4: <Nicolai Electronics I2C adapter> at usbus2
iichb0: <I2C-Tiny-USB I2C interface> on uhub3
iichb0: <I2C interface> on usbus2
iicbus8: <Philips I2C bus> on iichb0
iic8: <I2C generic I/O> on iicbus8

Once the driver has been loaded and the device connected, the new bus can be accessed via /dev/iic* just like any other:

$ i2c -f /dev/iic8 -s
23 3c 50 60 68 76

$ i2c -f /dev/iic8 -a 0x68 -d r -c 1
26

$ i2c -i "r 8 0x50 16BE 0x10 16"
95f9f6526d207bb45d43d1c73af99577

@bsdimp
Copy link
Member

bsdimp commented Feb 23, 2024

Thanks for the submission. I'll take a look at it in a few days. It looks quite interesting. Are these boards available to buy, or just in gerber/design form? I didn't see a 'buy it here' link in the above links, though I might have missed it.

Also, next time you update, could you 'git rebase -i main' and then force push with --force-with-lease? That makes merging it a little easier.

@0xDRRB
Copy link
Contributor Author

0xDRRB commented Feb 23, 2024

Thanks for the submission. I'll take a look at it in a few days. It looks quite interesting. Are these boards available to buy, or just in gerber/design form? I didn't see a 'buy it here' link in the above links, though I might have missed it.

The historical hardware implementation uses an Atmel ATtiny45-based DIY circuit, but a more modern version just uses a Raspberry Pi Pico board and nothing else is needed. It's easier and cheaper than a CP2112 module, for which a driver already exists.

Also, next time you update, could you 'git rebase -i main' and then force push with --force-with-lease? That makes merging it a little easier.

Duly noted. Sorry about that.

@bsdimp bsdimp self-assigned this Apr 19, 2024
@bsdimp bsdimp added the ready label Apr 19, 2024
freebsd-git pushed a commit that referenced this pull request Apr 19, 2024
@bsdimp
Copy link
Member

bsdimp commented Apr 19, 2024

Thanks for this very interesting contribution. I was on the fence about it, but talking with others convinced me it was OK. Sorry this process took so long...

@bsdimp bsdimp closed this Apr 19, 2024
@bsdimp bsdimp added merged and removed ready labels Apr 19, 2024
@0xDRRB
Copy link
Contributor Author

0xDRRB commented Apr 21, 2024

Thank you very much. That made my day :)

@0xDRRB 0xDRRB deleted the i2ctinyusb branch June 14, 2024 15:23
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants