Sharing a UART between USB FT231X and IR Transceiver - Page 1
Forum section: electronics / projects

author: leonhart88
author_rank: Regular Contributor
timestamp: September 08, 2015, 08:00:19 pm
content: Hey Guys,I have a microcontroller with one hardware UART, but I have two peripherals that need UART communication. One is an IR transceiver, and the other is a FT231X for USB communication.I only need to transmit to the IR transceiver, but I need to transmit & receive from the FT231X. They will never be used at the same time (the USB functionality is simply to reprogram the device or transfer some data to be stored into FLASH or EEPROM).My question is, is there a clever way to use both peripherals on the same UART lines? I was thinking that if VBUS is detected (ie. USB plugged in and bus powered), I can disable the IR transceiver. Once it's disconnected and unpowered, I can enable the IR transceiver which would be on by default.My only concern is that my system runs on 2V and so I would be applying 2V to the VCCIO line of the FT231X (for the internal level shifter). This means that if USB is unplugged, the device is not powered at VCC but I am still applying a voltage onto VCCIO. Furthermore, if I transmit data to the IR transceiver, the FT231X will also be seeing this on its input lines when VCC = 0. I'd like to avoid applying voltages on the pins if the chip is not powered at VCC.Any simple suggestions? Perhaps the simplest solution would be to just get a micro with 2 UARTs and power VCCIO via a voltage divider or regulator from VBUS...but thought I would ask if there is a way to do it with one UART for curiosity sake.Thanks.

author: retrolefty
author_rank: Super Contributor
timestamp: September 08, 2015, 08:37:04 pm
content: Well for your IR transmit serial needs one could just use a 'software UART' that could utilize any output pin you have available while leaving you hardware USART for your other purpose. The Arduino folks have access to a popular software UART library, I'm sure you would have little problem finding an example.

author: Kjelt
author_rank: Super Contributor
timestamp: September 08, 2015, 08:56:58 pm
content: If they are never used at the same time you can simply switch the Tx pin of the uart with a mux?

author: leonhart88
author_rank: Regular Contributor
timestamp: September 09, 2015, 09:17:36 pm
content: Thanks guys, those suggestions have crossed my mind as well. I'll look into software UART or a mux and compare it to just getting a mcu with 2 UARTs as well. Cheers.

author: Kjelt
author_rank: Super Contributor
timestamp: September 09, 2015, 09:27:03 pm
content: AFAIK There are also 1/2/4 USART ics with SPI or I2C interface but it probably in the end will come down to costs.

author: leonhart88
author_rank: Regular Contributor
timestamp: September 09, 2015, 09:30:56 pm
content: Quote from: Kjelt on September 09, 2015, 09:27:03 pmYes, I have a SPI/I2C peripheral as well. Like you said, it comes down to cost. However, I'm not making a extremely large number of these so an extra dollar is not really that big of a hit.I'd like to avoid the software UART if possible due to processing overhead, and if the additional cost in getting a mux costs close to what it would cost to get a 2 UART mcu, I might as well do the latter (which is what I am leaning towards).I was just curious if people had other suggestions so thought I would ask here.

author: Chris C
author_rank: Frequent Contributor
timestamp: September 09, 2015, 09:49:03 pm
content: Ok, so if I read this correct, it's only necessary to prevent the UART TX signal from reaching the FT231X when it's unpowered.Only allow UART TX to pull down the FT231X pin, by adding a diode between the two. Provide pull up via a resistor connected to the FT231X's power source.The IR transmitter can also be disabled similarly, if you want, with another diode and resistor. That resistor would be connected not to power, but to a MCU digital pin. When the pin is logic high, data flows.

author: langwadt
author_rank: Super Contributor
timestamp: September 09, 2015, 10:01:37 pm
content: Quote from: leonhart88 on September 08, 2015, 08:00:19 pmif you can live with always transmitting on both, just connect TX to both the IR transmitter and the FT231Xto avoid the voltage issues, power VCCIO from 3V3VOUT using a couple of diode to drop the voltage to 2V, connect a pullup from that to the TX input and use a diode from the TX input to MCU.That way VCCIO is only powered when the FT231X is on, and the MCU can only pull the TX low, high is done with pull up when FT231X is on

author: leonhart88
author_rank: Regular Contributor
timestamp: September 11, 2015, 07:13:44 pm
content: Hey guys,Those are great suggestions! That method should probably work. I would only need the pullups and diodes on the FT231X, as I can always disable the IR transceiver from the enable line. Thanks for the help!

author: leonhart88
author_rank: Regular Contributor
timestamp: October 01, 2015, 02:30:23 am
content: Just a quick follow up question to this...should I be pulling up the I/O lines to 2V regulated from the USB power? Or 2V regulated from my main power supply? FTDI suggested using pullups for all I/O lines.I plan to connect the FT231X and my MCU as follows:FT231X PIC18FTX --> RXRX --> TXRTS --> MCLRIf I connect the pullups to VCCIO, then that means the RX and MCLR lines are left floating when the USB is disconnected. Or should I just connect them all to the main 2V and put a diode across each I/O line to prevent voltages from being present when the FT231X is unpowered?Thanks.

author: leonhart88
author_rank: Regular Contributor
timestamp: October 01, 2015, 04:06:12 am
content: OK so apparently, after further digging, the FTDI datasheet for their FT230X development module states the following:Note 2: If power is applied to VCCIO and no power is applied to VCC all Ios will be at an unknown state,this however will not damage the chip. The FT230X also has protective circuitry to prevent the chip beingdamaged by a voltage discrepancy between VCCIO and the level of the signal being processed.So I can either just power VCCIO from my batteries and VCC from the USB port, or just power both VCC and VCCIO from the USB port and not worry about voltages when the chip is not powered.http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_UMFT230XA.pdf