Author Topic: I2C to USB converter  (Read 2888 times)

0 Members and 1 Guest are viewing this topic.

Offline arcticfishTopic starter

  • Newbie
  • Posts: 5
  • Country: 00
I2C to USB converter
« on: September 22, 2023, 10:48:11 am »
Hi all,

Anyone know decent quality of USB to I2C bridge converter can recommend? mainly use for testing, writing and read register of an IC support I2C from computer comport.

Thank you in advance.
« Last Edit: September 22, 2023, 10:57:42 am by arcticfish »
 

Online oPossum

  • Super Contributor
  • ***
  • Posts: 1408
  • Country: us
  • Very dangerous - may attack at any time
Re: I2C to USB converter
« Reply #1 on: September 22, 2023, 11:01:14 am »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14028
  • Country: fr
Re: I2C to USB converter
« Reply #2 on: September 22, 2023, 10:33:39 pm »
Alternatively, you can use the FT232H. If you are going to use Python, there's PyFtdi which supports it and that works well (tried it). The FT260S is not officially listed as supported by PyFtdi, so not sure it is.
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6702
  • Country: pl
Re: I2C to USB converter
« Reply #3 on: September 23, 2023, 05:43:04 am »
There is some limited support in CH341A chips and a Linux kernel driver which makes it work with standard i2c-tools and with in-kernel I2C device drivers.
https://github.com/gschorcht/i2c-ch341-usb

I have bought a CH341A breakout board from AliE for this purpose, but haven't had the opportunity to try it yet.

I previously used a passive VGA to I2C cable. But this trick doesn't work with DisplayPort anymore and it endangers the GPU if there is magic smoke from your I2C stuff.
 
The following users thanked this post: oPossum

Offline fchk

  • Regular Contributor
  • *
  • Posts: 239
  • Country: de
Re: I2C to USB converter
« Reply #4 on: September 24, 2023, 06:45:32 pm »
https://ftdichip.com/products/ft260s/

Yes, this is my preferred choice now. Before this I used MCP2221A.

fchk
 
The following users thanked this post: oPossum

Offline up8051

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: pl
Re: I2C to USB converter
« Reply #5 on: September 24, 2023, 07:38:25 pm »
FT260 has only 1.8V to 3.3V IO levels supported.

I once designed a USB -> I2C/UART converter module based on MCP2221
 

Offline dkonigs

  • Regular Contributor
  • *
  • Posts: 107
  • Country: us
Re: I2C to USB converter
« Reply #6 on: September 26, 2023, 03:39:48 am »
Not sure which direction you're trying to go, but I've had the need to speak to an I2C peripheral from a computer for one project of mine.  The device I'm currently working with this Devantech adapter.  Its decently documented, and seems to work well enough.
 

Offline Pack34

  • Frequent Contributor
  • **
  • Posts: 753
Re: I2C to USB converter
« Reply #7 on: September 26, 2023, 06:39:38 pm »
Using your computer as an I2C master? Not exactly cheap, but the C232H cables from FTDI seem to work well enough. Come in 5V and 3V3. I've used them in conjunction with some python scripts for test/debug. But ultimately, I think any mini STM32 dev board would probably work better. You'll just have a small layer of embedded code running on the STM32 to convert any serial commands from your python script to I2C commands for your DUT.

https://www.digikey.com/en/products/detail/ftdi-future-technology-devices-international-ltd/C232HM-EDHSL-0/2714140
https://www.digikey.com/en/products/detail/ftdi-future-technology-devices-international-ltd/C232HM-DDHSL-0/2714139
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14028
  • Country: fr
Re: I2C to USB converter
« Reply #8 on: September 27, 2023, 07:56:06 pm »
You can use any FT232H breakout board which are relatively inexpensive.
Adafruit has this one which is fine. I have a couple of theses around: https://www.adafruit.com/product/2264
 

Offline jaka

  • Contributor
  • Posts: 11
  • Country: fi
Re: I2C to USB converter
« Reply #9 on: September 28, 2023, 05:24:29 am »
FT232H is not the best choice, if the slave is a microcontroller. The FT232H doesn't support clock stretching.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3429
  • Country: nl
Re: I2C to USB converter
« Reply #10 on: September 28, 2023, 06:30:29 am »
There is also a solution with an ATtiny and this repository

A module like this can be used to make it with.

I have used an early version of similar code and it works great. The USB side is bit banged and only does 12Mbit but I2C is mainly maxed out on 400KHz so the USB speed does not matter.

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14028
  • Country: fr
Re: I2C to USB converter
« Reply #11 on: September 28, 2023, 08:11:02 pm »
FT232H is not the best choice, if the slave is a microcontroller. The FT232H doesn't support clock stretching.

It's easy to find, breakout boards are all over the place if you don't want to make your own board, and most of all, it's supported by PyFtdi, which was one point I made, for people who want to use Python.
Another benefit is that you can also use it for SPI, GPIO or as an USB FIFO, so it's very versatile.

But you're right, it doesn't support I2C clock stretching. I personally try to avoid clock stretching as much as I can in practice, so I personally don't see it as a big issue, but if you absolutely need to handle it, then agreed, look elsewhere. Make sure you absolutely need clock stretching though. (And I'm not sure I see why the fact you'd need to communicate with a MCU as I2C slave would imply having to use clock stretching necessarily.)

(One reason I usually avoid clock stretching is that it just "grabs" the bus, waiting for the slave to complete something, making any other communication on the bus meanwhile impossible, which kinda defeats the purpose of I2C unless there's only one slave on the bus. A "typical" use of clock stretching is for ADCs that will clock stretch until a conversion cycle has completed for instance, but most I2C ADCs, even when they support this mode, can usually be configured to not use clock stretching and allow polling flags instead, or via a "data ready" GPIO, which I find much better in practice.)
 

Offline jaka

  • Contributor
  • Posts: 11
  • Country: fi
Re: I2C to USB converter
« Reply #12 on: October 02, 2023, 06:46:04 pm »
Quote
(And I'm not sure I see why the fact you'd need to communicate with a MCU as I2C slave would imply having to use clock stretching necessarily.)

That probably depends on the I2C peripheral of the MCU and the driver / firmware implementation. We had to do a PCB re-spin because we found out too late that FT232H was problematic with our 8-bit PIC slave. Especially the I2C bootloader from Microchip application note clock streched a lot. It was possible to use it with FT232H, but the clock speed need to be reduced to 10 kHz or even slower. The in-built I2C driver in CCS compiler was better, but I think it was giving problems at higher clock rates as well.

We then switched to CP2112 which has been working well. One downside is that it didn't have Python support on Windows (on Linux it works well with Python). The BOM cost and complexity went down a lot, the CP2112 requires very few external components.

Another part which we tested was MCP2221A, which also worked well and requires almost no external components. This one works with Python also in Windows. IIRC, the HID protocol was slightly less economical than in CP2112. For this reason, we chose CP2112.

Of course the FT232H outstands in performance in pretty much all other areas than I2C clock stretching. Very versatile part.
 
The following users thanked this post: oPossum, Smokey, SiliconWizard

Offline Wiljan

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: I2C to USB converter
« Reply #13 on: October 02, 2023, 07:28:40 pm »
You can take a look on buspirate I like it for ad-hoc testing
http://dangerousprototypes.com/blog/bus-pirate-manual/i2c-guide/
 

Offline EyC

  • ZeroPoster
  • Posts: 1
  • Country: es
Re: I2C to USB converter
« Reply #14 on: October 06, 2023, 11:13:00 am »
MCP2221 may not be as easy to find as FT232H. It also has some I2C quirks you need to manage by software.
But, for testing and experimentation, I find MCP2221 more useful. Along with I2C, you get UART and analog GPIO.

I recently made some experiments with MCP2221 and also wrote a Python library. https://easymcp2221.readthedocs.io/

 
The following users thanked this post: benSTmax

Offline benSTmax

  • Regular Contributor
  • *
  • Posts: 87
Re: I2C to USB converter
« Reply #15 on: October 06, 2023, 10:31:10 pm »
Excellent work. I just ordered a few MCP2221A moments ago for evaluation/tests after seeing your outstanding support for this chip  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf