Author Topic: Sharing a UART between USB FT231X and IR Transceiver  (Read 6128 times)

0 Members and 1 Guest are viewing this topic.

Offline leonhart88Topic starter

  • Regular Contributor
  • *
  • Posts: 58
Sharing a UART between USB FT231X and IR Transceiver
« on: September 08, 2015, 08:00:19 pm »
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.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #1 on: September 08, 2015, 08:37:04 pm »
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.


 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6617
  • Country: nl
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #2 on: September 08, 2015, 08:56:58 pm »
If they are never used at the same time you can simply switch the Tx pin of the uart with a mux?
 

Offline leonhart88Topic starter

  • Regular Contributor
  • *
  • Posts: 58
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #3 on: September 09, 2015, 09:17:36 pm »
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.
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6617
  • Country: nl
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #4 on: September 09, 2015, 09:27:03 pm »
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.
 

Offline leonhart88Topic starter

  • Regular Contributor
  • *
  • Posts: 58
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #5 on: September 09, 2015, 09:30:56 pm »
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.

Yes, 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.
 

Offline Chris C

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #6 on: September 09, 2015, 09:49:03 pm »
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.
« Last Edit: September 09, 2015, 09:54:54 pm by Chris C »
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4986
  • Country: dk
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #7 on: September 09, 2015, 10:01:37 pm »
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.


if you can live with always transmitting on both, just connect TX to both the IR transmitter and the FT231X

to 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





 

Offline leonhart88Topic starter

  • Regular Contributor
  • *
  • Posts: 58
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #8 on: September 11, 2015, 07:13:44 pm »
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!
 

Offline leonhart88Topic starter

  • Regular Contributor
  • *
  • Posts: 58
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #9 on: October 01, 2015, 02:30:23 am »
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    PIC18F
TX    -->    RX
RX    -->    TX
RTS  -->    MCLR

If 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.
 

Offline leonhart88Topic starter

  • Regular Contributor
  • *
  • Posts: 58
Re: Sharing a UART between USB FT231X and IR Transceiver
« Reply #10 on: October 01, 2015, 04:06:12 am »
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 being
damaged 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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf