Help me understand this circuit (3v3 to 5v UART)

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working with an evaluation board to try to verify something for a PCB that was designed with the evaluation board as the template. I am unable to use UART to talk to the evaluation board and I think it is because the engineer who designed the PCB changed to voltage level on the UART input. When I put my SoC on our native board I can use the UART just fine - on the evaluation board I am getting nonsense characters out. Since the baudrate setting for uBoot is on the SoC it can't be a baudrate issue. I started studying the schematics and I need some help understanding this:

 

The first picture is the UART input for the evaluation board: (data sheet: https://www.ti.com/lit/ds/symlin...)

 

 

It seems as if the expected RS232 inputs should be 5V, which are then converted to 3v3 by the device. This confuses me a bit as the name of the device is " 3-V to 5.5-V Multichannel RS-232 Line Driver/Receive" - but in this case it seems like it is doing both?

Similarly - the output UART1_TxD_RS323 seems to be outputting 5V (line 9).

 

Meanwhile on our in-house design it looks like this: (datasheet https://www.onsemi.com/pdf/datas...)

 

So here it looks like the expected input already is at 3v3 and no conversion is done.

 

I have a TTL-RS232-3V3 cable that I am using to try to communicate with the device. Since it is working on the in-house design, I think the issue with the devboard is that the voltages are messed up. Is this correct? Could I just make quick-and-dirty fix and make a level converter circuit on a breadboard or is that risky? The last circuits class that I took was over 10 years ago at this point - I can't say I remember much of it. Can somebody point me in the right direction or draw a circuit for me? 

This topic has a solution.

1010001010111101110111

Last Edited: Wed. May 4, 2022 - 01:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mithrandir_ wrote:

It seems as if the expected RS232 inputs should be 5V, which are then converted to 3v3 by the device.

 

You have a fundamental misunderstanding of RS232. RS232 voltage levels are in the range of -12V to -7V for one level and +7V to +12V for the other.

 

That chip converts to and from from EITHER 3.3V or 5V levels to RS22 levels.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
That chip converts to and from from EITHER 3.3V or 5V levels to RS22 levels.

 

The chip does so in general, or does so in this case? It seems from the schematic like it is expecting 5V in/out from the connector and I am unable to get any sensible UART data with my 232R-3V3 cable.

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Mithrandir_ wrote:

Brian Fairchild wrote:
That chip converts to and from from EITHER 3.3V or 5V levels to RS22 levels.

 

The chip does so in general, or does so in this case? It seems from the schematic like it is expecting 5V in/out from the connector and I am unable to get any sensible UART data with my 232R-3V3 cable.

 

Look at the datasheet...

 

 

Everything on the left will be either 3.3V or 5V, depending on what voltage goes into the power block, everything on the right will be RS232 levels of +/-12V.

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

You have a fundamental misunderstanding of RS232. RS232 voltage levels are in the range of -12V to -7V for one level and +7V to +12V for the other.

 

That chip converts to and from from EITHER 3.3V or 5V levels to RS22 levels.

look at the chips example: 3232 mean 3,3V and 232 mean 5V.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does the "slash 2" on the wire mean, that it's binary?

 

So in my case it should be 3v3 because that is the Vcc. 

 

Back to the schematic - does that mean that 14 being 3v3, going to 9 is also just 3v3?

And 6 can be anything within your posted range and the circuit will simply convert it to 3v3 for 17?

 

In which case I am absolutely stumped as to the reason for why my setup is not working.

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If RS232 is 7-12V, why is my cable called TTL-232R-3V3

 

What does the 3v3 imply? Which part of my setup is incompatible?

 

I have

 

Computer - USB port - Cable - RS232 connector

 

This works on my in-house board but not on the devboard. 

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mithrandir_ wrote:

If RS232 is 7-12V, why is my cable called TTL-232R-3V3

 

Because it doesn't output RS232 levels. It's just a USB to serial converter that outputs the serial signals at 3.3V.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mithrandir_ wrote:

What does the "slash 2" on the wire mean, that it's binary?

 

It means that there is actually two identical wires there. It's a simplified diagram.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mithrandir_ wrote:

I have

 

Computer - USB port - Cable - RS232 connector

 

This works on my in-house board but not on the devboard. 

 

That's your problem. You need to take the MAX3242 out of the circuit and connect your USB converter to the xxx_3V3 lines on your board.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mithrandir_ wrote:

Computer - USB port - Cable - RS232 connector

You didn't mention the magic words "D-TYPE".. A web link to your interface cable would clarify things.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Mithrandir_ wrote:
What does the "slash 2" on the wire mean, that it's binary?
That there are two of everything: two DIN, two DOUT, two RIN, two ROUT.

 

In the old days the cables you used to buy on ebay for connecting PCs (USB) to AVRs (and other micros) were USB-RS232 cables. This meant they basically had a USB to UART converter chip (FT232, CP2102, etc) and then ALSO a MAX232. The USB-UART would output TTL levels then the MAX232 would "pump these up" from 0/5V to -12V/+12V. These would allow you to connect PC/USB to some old serial equipment that had either a 9 pin oreven a 25 pin DIN connector operating at RS232 -/+12V levels. But to use these with an AVR or similar the AVR circuit itself also had to have a MAX232 - it would take the +/-12V coming in from the cable and bring it back down to the TTL 0/2V levels an AVR UART expected to use.

 

Then some bright spark spotted the fact that you were paying for two MAX232 in this for no apparent benefit (and it was complicating the AVR design). So they also started supply USB-TTL (serial) cables that now were just a USB plug at one end and an FT232R/CP2102/etc at the other. The cable didn't have a MAX232, there was no +/-12V involved - the cable just plugged straight onto the pins of the AVR.

 

So one might ask what that MAX3243  (which appears to be a 3.3V and dual version of MAX232) is doing in your design? Sure there is merit in taking things up to 12V levels if it's a long/noisy connection (though actually RS485 might be a better solution?) but are you falling into that same trap of putting in a 12V level converter (oh and they invert too!) simply to be able to attach a cable that equally has a needless 12V converter in it? Or will the outside world connection of this really be from something that needs to be true RS232 (+/-12v) ? If that's the case you will want to replace your USB-TTL cable with a true USB-RS232 cable.

 

If this is really just about attaching a TTL level (0/5V UART signal) to a 3.3V micro then non-inverting 3.3<->5 should be a whole lot simpler than something as exotic as a Maxim-Dallas chip.

Last Edited: Wed. May 4, 2022 - 11:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mithrandir_ wrote:

I have

 

Computer - USB port - Cable - RS232 connector

Take a look at voltages of your usb to rs-232 converter.I had that kind of cable but stolen.Check it with DMM/AVO meter.Did you used USB hub ?

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
You need to take the MAX3242 out of the circuit and connect your USB converter to the xxx_3V3 lines on your board.

 

Hmm alright, thanks. Looking at the pin-mapping it does have them listed on the board (https://karo-electronics.github....):

 

I assumed that this was just another way of connecting to the same UART but if I am understanding you correctly, the pins should bypass the MAX3243 and allow me direct access to talk to the UART.

 

Right now I have it set up as such:

 

And to clarify - the reason why this isn't working is because the port to which I am connected now expects RS232 signals but my cable is just outputting/expecting 3v3 signals?

 

N.Winterbottom wrote:
You didn't mention the magic words "D-TYPE".. A web link to your interface cable would clarify things.
 

 

Here's the link to the datasheet for my cable:

https://www.ftdichip.com/Support...

 

clawson wrote:
So one might ask what that MAX3243  (which appears to be a 3.3V and dual version of MAX232) is doing in your design?
 

Thanks! That's actually very helpful. However, the MAX3243 is not in my design - this is on the evaluation board which comes from KA-RO:

https://karo-electronics.github....

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm still confused as to why my cable is called TTL-232R-3V3 if it has nothing to do with RS232!?

 

On the packaging it says:

TTL-232R-3V3

USB to TTL Serial Cable (3v3)

 

Why is the 232R on there and what do they mean by it?

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1


USB to RS232 ->

 

USB to TTL (can be either 5v or 3.3v)

 

For a LONG time serial comms meant using RS-232 signalling, but these days most serial comms are done using TTL levels as its cheaper to leave out the unused RS-232 converts in the link.

However, it seems, maybe due to the a language translation problem, serial USB cables still use the designation of 232 when describing any serial adapter cable, as in:

Mithrandir_ wrote:
I have a TTL-RS232-3V3 cable

You have been mis-lead by that description, your cable is a USB to TTL (3.3v) serial adapter (see second example above), connecting this to a real rs-232 circuit will not work and may let the smoke out of your cable!  You need the one shown first above if you want to connect to RS-232.

 

Its difficult to be young and trying to use OLD tech......    Yet is seems so easy to us old guys!

 

Jim

 

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

It's possible that you may have damaged your cable by making a direct connection. Check t by doing a loopback test. Connect TX to RX on the cable and check that what your transmit comes back as received data.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
your cable is a USB to TTL (3.3v) serial adapter (see second example above)
USB to TTL uart.
ki0bk wrote:

 

Its difficult to be young and trying to use OLD tech......    Yet is seems so easy to us old guys!

Maiar Istari are the new one and to explore the middle earth wink

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

Last Edited: Wed. May 4, 2022 - 05:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I marked Brian's answer as "the answer" but I just wanted to point out that all of you helped me out greatly. I tested the cable - it still works and I am now able to talk to uBoot via the pins directly to UART instead of the through the RS232 connector. Thank you so much everyone!

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Glad you got it working!  BTW, you can use your TTL=3.3v cable while connected to a 5v cpu pins by placing a 1k resistor in series with your TXD/RXD pins, the same works for TTL=5v cables to talk to 3.3v cpus too.

Another tool for your tool box!

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ki0bk wrote:

Glad you got it working!  BTW, you can use your TTL=3.3v cable while connected to a 5v cpu pins by placing a 1k resistor in series with your TXD/RXD pins, the same works for TTL=5v cables to talk to 3.3v cpus too.

Another tool for your tool box!

Jim

 

 

Great insight. Thank you!

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But with that said, there are still a couple of points to be aware of:

 

  • Consider a 5v AVR or similar communicating with a PC via an adaptor cable. The output '232' from the PC idles high, so if it's not sending anything, there is 5v sitting on the AVR's RX pin. If the AVR is powered down but the comms are connected (this could be comms to anything that's powered, not just a PC) then your AVR is *not* powered down - the parasitic body diodes will leak the power from the RX pin and cheerfully supply the AVR. At best this can interfere with power on reset; at worst it can lead to very confusing states where the device is 'powered' but the voltage isn't constant due to current limits. (This applies to most of the IO pins on the majority of microcontrollers and is rarely mentioned, but is most likely to be an issue with a USB adaptor since that's going to be powered whenever the data source is powered.)
  • If you intend to use the FTDI USB-232-ttl adaptors, be aware that one of the lines is a handy 5v supply with a hundred milliamps or so. Which is very useful to power your device, but - from memory - it's 5v on both the 5v and 3v3 adaptors. One to watch if you have 3v3 parts on the microcomputer board.
  • I'm not up to date on current USB adaptors but I have had specific requirements in the past which required some odd non-standard baud rates. The FTDI parts managed these very easily (mod the division ratios for the UART on the microcontroller) while other families didn't seem to be able to do anything other than the standard rates. Whether this was a limitation of the part or of the drivers for the chips I never bothered to investigate.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

why my cable is called TTL-232R-3V3 if it has nothing to do with RS232!?

Because It uses the FTDI ft232rl chip in its guts.

they probably thought their chip number was very clever, back in the days when it was used mostly to connect to “real” rs232 devices (together with a level shifter.)