UART to SPI Master or to I2C Master Bridge - Page 1
Forum section: electronics / projects

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 16, 2024, 09:52:39 pm
content: So, I am looking for a way to access SPI or I2C slave devices from the PC using "serial port" explicitly with virtual COM port drivers. But I have to do so without using any programmable devices (neither micros nor FPGA/CPLD are allowed).This basically forces me to use some sort of USB to UART bridge, for which Virtual Com Port drivers are readily available (like from FTDI, SiLabs or Microchip) which I would then need to translate to SPI or to I2C.I have only found a single device capable to do this, namely theSC18IM704from NXP. But apart from that.... nothing.Are there any other devices like that that you know of?I can find quite a large number of SPI/I2C to UART bridges, which are slaves on the SPI/I2C interface, but only the above mentioned one which can be master. Also, there's quite a number of software based solution which I could employ, on various microcontrollers or FPGAs, only if firmware would not be excluded from this endeavor.I am also aware of the existence of various direct USB-to-SPI or USB-to-I2C converters, but unfortunatelly these do not operate with Virtual Com Port Drivers.Is this such a narrow niche...?Regards,Cristian

author: langwadt
author_rank: Super Contributor
timestamp: March 16, 2024, 10:03:55 pm
content: why do you insist on using virtual COM port drivers?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 16, 2024, 10:11:11 pm
content: Quote from: brumbarchris on March 16, 2024, 09:52:39 pmYes, because most people wanting to do this don't have a "no programmable devices" limitation.Some of the FTDI devices have a serial engine that can be configured to do SPI.

author: langwadt
author_rank: Super Contributor
timestamp: March 16, 2024, 10:21:35 pm
content: Quote from: mikeselectricstuff on March 16, 2024, 10:11:11 pmand if you don't need speed they can all do it with bit banging, but that's using the ftdi direct driver, not virtual com port

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 16, 2024, 10:25:13 pm
content: QuoteThis requirement/limitation comes from the intended users of the end device: they already have vast code base with Virtual Com Port and are unwilling to change to other methods. Unfortunately, I cannot influence that.QuoteI am familiar with those, but unfortunatelly they cannot operate in that mode using the VCP drivers; we would need to use the D2XX dll based method of controlling them and that is not accepted by the stakeholders.QuotePrecisely. And that is not acceptable.Regards,Cristian

author: langwadt
author_rank: Super Contributor
timestamp: March 16, 2024, 11:06:51 pm
content: Quote from: brumbarchris on March 16, 2024, 10:25:13 pmwhy is a programmable device out of the question? I'm sure quite few USB to uart devices are actually MCUsif you really want to get creative, make a program that pretends to be a comport on one side and does the DXX magic on the other side

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 16, 2024, 11:19:51 pm
content: QuoteThis was actually discussed as a potential option, but ruled out eventually. The existence of this additional layer is veto-ed by the end users, due to maintenance, reliability etc. No, they want to use a proven and established COM port driver, from a reputable provider. And I can understand and accept that. As a fall-back solution, the SC18IM704 from NXP does what we want, but it is so...single source like. And I mean not even a "principle" function equivalent device exists out there (even with different footprint or somewhat different operation). None.One other idea is to place the SN74LV8153, which has aweirdbut UART compatible interface. And go through all the trouble to bit-bang SPI data through it. But even this one looks like a "single of its kind" type of thing.Regards,Cristian

author: langwadt
author_rank: Super Contributor
timestamp: March 16, 2024, 11:28:15 pm
content: Quote from: brumbarchris on March 16, 2024, 11:19:51 pmsounds like they don't want a solution

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 16, 2024, 11:35:37 pm
content: QuoteIt is legitimate to consider that we are on a look-out for a non-optimal system level solution, I agree that. But it is a constraint I cannot change and I have to work with that: no software, no programmable devices. Solutions do exist (as I have previously mentioned the NXP SC18IM704 or the TI SN74LV8153). It's just that I am somewhat uncomfortable with the narrowness of the purely non-programmable hardware options and I started this thread to maybe get more options pointed to me.Regards,Cristian

author: langwadt
author_rank: Super Contributor
timestamp: March 16, 2024, 11:42:56 pm
content: Quote from: brumbarchris on March 16, 2024, 11:35:37 pmI mean, if a software solution is out, a programmable device is out, the narrowness of the purely non-programmable hardware it out, single source is out, then there isn't really anything left

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 17, 2024, 10:36:47 am
content: QuoteThese two are not really blocking criteria. I was just hoping to get here some suggestions that would widen a bit the options.Regards,Cristian

author: Smokey
author_rank: Super Contributor
timestamp: March 17, 2024, 10:41:53 am
content: MCP2221https://www.microchip.com/en-us/product/mcp2221I2C =https://www.digikey.com/en/products/detail/microchip-technology/MCP2221A-I-ML/6009295SPI =https://www.microchip.com/en-us/product/MCP2210The UART doesn't go directly to the I2C, but it's a simple driver for USB->I2C. No circuit board side programming required. I use these for test fixtures all the time.

author: langwadt
author_rank: Super Contributor
timestamp: March 17, 2024, 12:21:54 pm
content: Quote from: Smokey on March 17, 2024, 10:41:53 ambut when used for SPI/I2C they don't work like virtual com ports

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 17, 2024, 02:16:37 pm
content: Yes, I am acquainted with the Microchip parts, but they are using the HID class when operated as converters to I2C. This would violate the fundamental requirement I have here, that of using Virtual Com Port from a computer perspective.

author: Smokey
author_rank: Super Contributor
timestamp: March 17, 2024, 09:52:04 pm
content: Quote from: brumbarchris on March 17, 2024, 02:16:37 pmHave a PC side program that has a command terminal interface that emulates a COM port that then uses the HID to talk to the I2C.

author: zapta
author_rank: Super Contributor
timestamp: March 17, 2024, 10:32:07 pm
content: For SPI, search pypi.org for SpiAdapter and SpiDriver.For I2C, search pypi.org for I2cAdapter and i2cDriver.They have python packages available and they use serial COM protocol that doesn't require special OS drivers.

author: langwadt
author_rank: Super Contributor
timestamp: March 17, 2024, 11:22:58 pm
content: Quote from: zapta on March 17, 2024, 10:32:07 pmI2cAdapter uses programmable hardware (Raspberry Pico) that already been ruled out, i2cDriver uses software that's already been ruled out

author: PCB.Wiz
author_rank: Super Contributor
timestamp: March 18, 2024, 12:17:23 am
content: Quote from: brumbarchris on March 16, 2024, 09:52:39 pmThat paints you into the corner of a pre-programmed part using an ASCII command set to expand the UART so it can manage the extra state engine of i2c.You should feel lucky you have found anything 'ready to go'The NXP SC18IM704 part has a quite recent data sheet, looks quite good, and you can buy modules using it, so why not use that ?Looks to be based on the LPC802M001JDH16 family. It needs a 3.3V supply, but claims 5V tolerant pins.How many do you need ?There were parts for UART => i2c that were programmed PICs that you could buy already programmed (mostly DIP?), but a quick search cannot find them.Addit: No, wait... found it.Similar commands to NXP, but a superset, with more features. Four separate I2C busses, SPI, Dallas 1 Wire Needs 14.7456MHz crystal, so has precise BAUD rates.https://www.i2cchip.com/shop.htmlDIP and a SMD (SO18W) version comes in tubes of 50, ready to go. SSOP20 available on order.

author: brumbarchris
author_rank: Regular Contributor
timestamp: March 18, 2024, 07:47:30 am
content: Well, yes, currently the NXP SC18IM704 is the tentative way to go.QuoteBut the link you provided seems intriguing... How do you know it is a pre-programmed PIC behind their BL233 ic name? They do not seem to explicitly mention it.Regards,Cristian

author: PCB.Wiz
author_rank: Super Contributor
timestamp: March 18, 2024, 08:09:25 am
content: Quote from: brumbarchris on March 18, 2024, 07:47:30 amThe 18 pin package is a massive clue, just like the NXP part is a MCU programmed, the volume of these parts is too low to make anything fully custom.If you are using modest volume of these in the medium term, I'd suggest trialing both.If you are a little more adventurous, I think this may be the upstream code for the NXP part.https://os.mbed.com/users/k4zuki/code/uart_i2c_conv/file/9d12c615c8ea/main.cpp/https://github.com/K4zuki/tinyI2C/tree/masterSuppliers like Digikey can program parts, for a fee, so that may be almost 'no programming', you can treat the hex file you send Digikey as a large order number

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 18, 2024, 09:21:56 am
content: Quote from: PCB.Wiz on March 18, 2024, 08:09:25 amThey don't offer this service outside the USA, apparently because you might be sending them export-controlled encryption code to program into your tiny micro. Seriously.

author: Tix00
author_rank: Newbie
timestamp: March 27, 2024, 07:59:40 am
content: Hi everyone. UART to I2C master devices:NXP SC18IM700 was tested 10 years ago, and found a regulary nice, but poor performing device:Settings cannot be saved on EEPROMUndocumented message transaction performanceWeird GPIO messages processingUnder stress, the device can crashFor all these reasons, we turned to BL233I've dealing with BL233 (https://i2cchip.com) B and C versions for 10 years. Althrough it's a device with impresive capabilities and afordable price (SO-18 version available!), the company is unresponsive since four mounths ago (please, if someone get in touch, let me know).After this issue, we turned our eyes (again) to NXP SC18IM704, a modern replacement for SC18IM700.Nowadays evaluating SC18IM704 (firmware 1.0.2) : the SC18IM700 was far more reliable. Please, take a look at NXP support forums about this device before expend hours (you'll see a pair of post from my own), to figure out. We're expecting a new firmware, released by NXP as requested samples.Zilog has also this kind of device, but website is offline.Horter has a I2C modemhttps://www.horter-shop.de/de/102-i2c-pc-adaptera pricey deviceLast but not least, you ca relay on a TI MCU with firmware, provided by TIhttps://www.ti.com/lit/pdf/spradd0This is a very good howto about this kind of devices:https://www.ti.com/lit/an/slaa908/slaa908.pdf?ts=1591284148014Hoping been userful. I'll keep on searching...

author: Smokey
author_rank: Super Contributor
timestamp: March 27, 2024, 08:18:30 am
content: Question: What quantities are you guys talking about... I mean seriously, if it's decent volume I'll buy a chip programmer/re-reeler right now and sell you pre-programmed micros with whatever functionality you want.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 27, 2024, 09:35:33 am
content: Quote from: Smokey on March 27, 2024, 08:18:30 amNo need - use a Microchip device and they'll program and re-reel it for a few cents

author: Smokey
author_rank: Super Contributor
timestamp: March 27, 2024, 09:39:58 am
content: Quote from: mikeselectricstuff on March 27, 2024, 09:35:33 amshhhhh!!! you are ruining my new business!