Sunday, June 19, 2011

TTL to UART

While working on my ENC28J60 Project with the PSoC3 FTK,I felt a pressing need to get some debugging data out,in realtime(dont wanna pause it >.< ).There are a few direct solutions,
1.LCD
2.Serial Interface(UART)

LCD can be run at 3.3(here) but its too many wires,and limited text.That makes UART our preferred option.Which explains the title,TTL-UART.

PSoC Creator has a UART component,which can output RX-TX lines(TTL) to the GPIOs on the underside.Hunting around on the net,there are a couple of solutions.Keep in mind,that these will be 3.3V signals.

Before we discuss various options,Serial Port interfacing is basically about turning a 0-3.3V signal to a +/- 12V signal(Inverted) and the reverse for RX.

1.Use a dedicated chip.
MAXIM Semiconductors has a dedicated bunch of chips,each with different features.The one we'd need is the MAX3232(here).Its a one-chip solution,with only some decoupling caps externally.Make a neat PCB,and we're done :)
Sadly,this isnt a common chip here(unlike the MAX232),and ordering is costly :(

2.Use a popular "2 Transistor" Solution.
This is another popular method,which involves  basic NPN and PNP switches based on the 3906 and 3904,though there are variants around.(a detailed explanation of this circuit)

3.Bring in the MOSFETs! :)
Another solution uses a 2N7000,an N-Channel FET.Images,PCB and more here.

4.Use the MSP430 Launchpad(or similar)
If you do have an existing board which has some kind of TTL to USB/UART interface,get it out,and rig it up with the FTK :) .. A messy arrangement,what with 3 boards(Ethernet module too :P ) but it works.Even a PSoC1 Eval kit is a candidate here.

5.Use a MAX232
Yes,this 5V chip can be run at 3.3,to no special side effects,and with perfect results.However,this is abuse of the chip,and shouldnt be used for production level designs.

6.Use a FT232RL or similar USB UART IC.
This chip is another great way to approach this.More at the SparkFun store,here.

7.Mod an existing USB-Serial Cable.
The title says it all.Details here and here.(Many such on the net)

8.Use OpAmps :P
This was an Idea i thought of as I was reading the RS232 specs.It blared comparator at me,since a 0-3.3V signal,needs to be inverted and made a -12V/+12V one.While you can use a dedicated voltage comparator chip,or wire a 741 as an inverting comparator with hysterisis,both should work.How about using the analog blocks on the PSoC3? :)

9.Quick & Dirty : A Hex Inverter
Use a hex inverter for a quick and dirty solution.But its success depends on how far you can violate the standard RS232 protocol.
I'll add more as I find/think of em.Take your pick :)




No comments:

Post a Comment