Usb to ttl modules - connection to pics at 3.3v


Closed Thread
Results 1 to 25 of 25
  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Default Usb to ttl modules - connection to pics at 3.3v

    HI Guys,

    I have had a need to use a number of USB to TTL modules for a project

    Most have either been the PLH2303 or CP2102 modules

    one problem i had found was that when the USB module was connected to the a 3.3v pic ( gnd , RX,TX only) and the usb was powered via the usb cable , the pic was not happy

    the pics RX pin was at 5v and the PIC would not power down correctly or do some strange things while the usb cable was connected to the PC and the PIC powered down.

    to resolve this i placed a 4k7 resistor in line with the USB-RX to the PIC RX input , dropping the voltage to about 1.8v ( when the PIC is powered down, but the USB cable is still connected)


    wondered if other have seen this issue when using USB on PIC running at 3.3v ?


    also i have found when the PIC was running DT's INT_RX to detect terminal input and the USB cable to the USB -ttl model was not connected the PIC RX input was low , which triggered the ISR , slowing the PIC down to service an invalid input

    as a result i placed a 100k resistor to 3.3v to ensure when the USB is not connected the ISR is not triggered
    note: prior to using a 100K pullup a 4k7 was tried , but cos of the above fix of 4k7 in line to stop issues with 5v input signal the low going pulse was not strong enough to get consistent inputs for the RX line


    I wonder if others have had this problems with interfacing the USB to TTl modules to 3.3v pic application ?

    cheers

    sheldon

  2. #2
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Not sure why you are surprised that applying 5V signals to a PIC running at 3.3 V is a problem. Either level shift the adapter to 3.3 V signals or run the PIC at 5V.

  3. #3
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Simple solution is to use 2x transistor inverter(http://hyperphysics.phy-astr.gsu.edu...tron/bufi2.gif), or optocoupler on USB Tx pin...
    Or use one inverter with transistor if your pic suport inverted UART input.
    Last edited by pedja089; - 4th March 2015 at 16:47.

  4. #4
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    always thought the PIC input pins are 5v tolerant
    the resistor 100k pull up to 3.3v and the 4k7 inline solved the problem for the USB RX pin into the PIC , but perhaps a level converter would be best

  5. #5
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Problem is when pic doesn't have supply voltage, current flow from Tx pin thru resistors, parasitic diode between pin and Vdd, and charge capacitors on Vdd. When voltage rise above 1,8V, pic start, and then lock up, doing weird things...

  6. #6
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    5 V tolerant does not mean nothing happens when you connect a signal higher than Vdd. It simply means you won't permanently damage the device. Pedja089 is absolutely correct. If there is a 3.3 supply in place, it's low impedance sinks the current from the signal pin. If the supply is not there, the signal voltage tries to power the PIC. With a big series resistor, there is not enough current available to power the PIC. So leave the resistor - a level shifter likely won't solve the problem.
    Last edited by Charlie; - 5th March 2015 at 14:28.

  7. #7
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    yes 4k7 in series with the usb ttl module is needed , i am also thinking there must be usb -ttl modules that have a 3.3v signal in/ out level option

  8. #8
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v


  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Quote Originally Posted by longpole001 View Post
    yes 4k7 in series with the usb ttl module is needed , i am also thinking there must be usb -ttl modules that have a 3.3v signal in/ out level option
    FTDI makes their USB/serial for 5V and they also have a 3.3v version. Have you tried the 3.3v FTDI USB version?
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  10. #10
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    You'll have the same problem with a 3V3 converter if you apply an input signal to an unpowered PIC unless the pin doesn't have protection diodes.

  11. #11
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Agreed - anything you use can't be allowed to supply power. The PIC input should be connected to the PIC supply through a resistor, and then a diode (or equivalent) connected in series in the signal line, with the anode connected to the input pin. The serial converter can then only pull low. When it's high, the diode makes it high impedance, and the resistor pulls high to the PIC VDD. When power is removed everything will then truly shut down.
    This problem has nothing to do with 5 V vs 3 V. It's all about a low impedance signal source, idle state high, able to supply enough current to power the PIC through the protection diode.

  12. #12


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Charlies's approach sounds good. Would it not be wise to use a Schottky diode to keep the low input to the PIC as low as possible?

  13. #13
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Can if you like, or if signal speed is an issue, but otherwise it doesn't matter. Any old diode in the box will do.

  14. #14
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    the modules on hand give a 5v signal,, and provide a 3v output when cable connected to the pc - usb

    but there are a few that appear to be able to select a 3v or 5v input to vcc and should give a 3v signal input/output
    http://www.ebay.com.au/itm/USB-To-RS...item43d2b06273


    yes the diode is a good idea , since the 4k7 is in line already a schotky is better to reduce the signal drop

    think this is the way to go with 5v modules

    New Project.pdf

  15. #15
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    It'd be better to move R4 so that it's directly on the USB_RXD pin. That way it won't create a voltage divider w/the pullup.

  16. #16
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    *sigh*. It would actually be hard to get it more wrong. The problem is with TX, not RX. The arrow heads to the PIC are the wrong direction, as are the labels on the PIC side of those arrows. The Diode is in the wrong leg. It needs to be between pin 3 of the module, and the RX pin of the PIC. The 4.7 K resistors are doing nothing - replace with a short. The 100K is way too big, replace with 4.7K. For RS-232 signals, schottky makes no difference. Use it if you have extra, but don't run out to buy one if all you have is a 1N914. On the positive side, the diode is in the correct direction.

    You should probably test it before posting an update to the schematic. As shown it should not work at all.

  17. #17


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    I must be missing something regarding the discussion of the benefit of using a Schottky diode in this application. From a reading of the PIC data sheet the maximum pin input voltage for the low state is 0.8 volts. The USB module is said to be TTL ... so I believe its normal working range would be 0 to 5 volts. An ordinary diode's forward drop is about 0.7 volts whereas a Schottky is typically 0.3 volts. Therefore, the Schottky would provide 0.5 volts of noise margin, but the normal diode only 0.1 volts of margin.

  18. #18
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    ok thanks guys ,
    what stuff up that last cct was

    this appears to work after some testing

    placed a NCH mosfet i had on hand ,

    the internal diode of the mosfet is blocking the 5v signal from the TTL module
    when usb cable is connected , but PIC Pwr is not on, then mosfet gate is inactive ,
    the mosfet acts as level converter from PIC TX 3.3v signal to the 5v on the RX TTL module ,

    the pic TX line is pulled high internally, TTL Rx line is also pulled high , so no additional pullups are required on the Source or Drain of the mosfet

    this stops any signal power to the PIC until its powered up , Tried fitting resistor to TTL RX line but found 2v is always going to be there


    D2 stops the voltage from TX of the TTL module to the pic when powered down , 4k7 pull up on input RX to pic at 3.3v

    D2 is better to be a schotcky ( i have many of both ) as the low going signal swing was going closer to ground than using a standard signal diode , but both worked ok

    cheers

    Sheldon

    New Project.pdf

  19. #19
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Almost perfect. The FET is serving no purpose - replace it with a piece of wire and you have the final circuit.

    By the way, not sure what purpose USB_ON is serving since you don't show where it's connected, but if it is going to the PIC, then that is another source of parasitic powering. As a matter of fact, it's probably the true source of your problem, since thinking back, I've never seen a 2303 TX signal able to parasitically power a PIC. 3V3, however, is intended to supply a bit of power. Also what purpose does R8 serve?

  20. #20
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    [IMG][/IMG]New Project.pdf

    the mosfet stops the 5v pullup voltage on RX from usb module , which is there when usb cable is in , without it voltage is being applied to the PIC TX pin when, the pic is not powered

    this caused other PIC pins to float to 1.8v - measured 4 pins that eventually got to 2v

    the mosfet also allows the voltage at PIC TX pin to stay at 3v3 and the RX on usb module to stay 5v when they are connected - when the PIC is on

    the "usb_On" signal was not used in the testing yesterday , but signal is to be isolated when the PIC is not on , but the usb cable is in , will test this today

    it is intended to indicate to the PIC that the usb power is there and adjusts others settings / program options

    R8 is Changed now other mosfet on "usb_on" signal is connected

  21. #21
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    wrong image should be this one


    New Project.pdf

  22. #22
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Which PIC are you using? I measured a PL2303 module and the RXD pin (4 in your drawing) is floating at 1.8V idle, and not able to supply much current. As an input, it shouldn't be able to supply any, but some input designs allow a little in unusual conditions. To power the PIC through the protection diode, the PIC would need to operate down to 1.2 V or less, and would need to draw very little current. So I want to check the spec sheet for you. Maybe you actually have an out of spec device. The TXD pin (3 on your drawing) sits at 4.5 V and is designed to supply current, so it should be the only culprit. D2 fixes that.

    The circuit you have on the USB_ON pin will work, but might be a bit more traditional if the gate went to the module and the drain went to the PIC VDD. This would allow you to use it with VDD at any (reasonable) voltage without having to change the circuit.

  23. #23
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    Hi charthe pl2303 ttl module has TX, RX led with a 1.5k resistor on each signal , which is pulling the line high , looking at the pcb

    the module is one of these

    Name:  pl2303 module.JPG
Views: 1147
Size:  44.1 KB

    there are 3 pic chips i am testing this usb modules on - 18f67k22 ,18f87k22, 18f46k80 , the measurments so far are using the 18f67k22

    there are 3 usb - ttl modules to be tested and checked cp2102 module , pl2303 module , ch340G module

    i am still trying to get the correct cct for each of ttl modules / boards i am using for the test

    But from a quick look on the net and the boards them selves , there is wide number variations and ways they make the boards , some have leds on the TX,RX line , with different values of resistors inline on those lines others do not

    i want to ensure that no mater what ttl usb module of the 3 i am testing , the PIC is not powered or effected by the different possible TTL modules

    A design making use of USB -TTL modules needs to allow for this.

    the mosfet ensures no possible voltage from the TTL MODULE RX line to the TX on the pic , when the PIC is not powered . regardless of TTL module used


    cheers

    Sheldon

  24. #24
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    hi charlie ,
    The circuit you have on the USB_ON pin will work, but might be a bit more traditional if the gate went to the module and the drain went to the PIC VDD. This would allow you to use it with VDD at any (reasonable) voltage without having to change the circuit.
    yep that seems like a good idea and is a more traditional approach

  25. #25
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Usb to ttl modules - connection to pics at 3.3v

    well after testing 3 different USB modules and 3 different pics , the cct works well , the requirement to isolate the TTl signals when the the PIC is not on is a requirement that should be done when using the USB -ttl models

Similar Threads

  1. Usb-Pc connection 18f4550 pls help
    By extoprak in forum USB
    Replies: 2
    Last Post: - 24th November 2008, 09:24
  2. USB and serial cable connection(s)
    By ardhuru in forum Schematics
    Replies: 3
    Last Post: - 18th August 2008, 16:26
  3. Replies: 15
    Last Post: - 30th October 2007, 20:25
  4. Microcode studio and USB pics
    By KPDes in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th May 2007, 10:28
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 18:39

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts