Jump to content
hawwwran

TTL UART and FTDI - what is what and for what?

Recommended Posts

Hello,

I found some devices which should allow me to connect naked MSP430G2553 chip to PC over USB. But here is one problem I don't really understand. I found devices with FTDI chip (I know it's a brand name) and devices which I found under "TTL UART" or "USB to TTL".

 

Here is link to the FTDI one: https://www.sparkfun.com/products/9873

09873-01.jpg

 

Here is link to the TTL one: http://dx.com/p/usb-2-0-to-ttl-uart-5-pin-cp2102-module-serial-converter-blue-152317

 

So, my question is: is there any difference between those two? Because there is huge difference in price.

 

Thanks for replies

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

FTDI usually has better driver support on different O/S's I've heard.  Both would work though.  I think dx.com ships from China and is known for rather slow shipping but I have no personal experience with them.  SparkFun is also known for overpricing things sometimes although $15 for an FTDI board sounds comparable to folks like Adafruit.

 

Don't forget Tindie -- this guy has an FTDI (FT230X, cheaper chip than the SparkFun board but still functionally the same) for $10 ($12.50 shipped to USA): https://www.tindie.com/products/jimparis/microftx-usb-serial-breakout-1/

 

Think you have to solder headers on yourself though for that one.

Share this post


Link to post
Share on other sites

TTL means 5V outputs (keep in mind that product descriptions are not always 100% accurate.)

You need 3.3V one if you want to use it with MSP430.

Share this post


Link to post
Share on other sites

I ordered both types from china for $5 ftdi and $2 the ttl one. And both of them capable of 3.3V and 5V. The TTL one even simultaneously. So, there is literally no difference (do not count the drivers)?

 

And yes, sparkfun has terrible prices :-(

Share this post


Link to post
Share on other sites

Another question about those devices.

 

If I'm right, connecting the first (FTDI, red, sparkfun) one means connect it like this:

device     msp

------------------

dtr       -> rst (reset)

rxi        -> rxd

txo       -> txd

cts       -> tst (test)

 

The second one (TTL, blue)

------------------------------------

device     msp

------------------

r       -> rxd

t       -> txd

 

 

Now my questions are:

- am I right about the connection?

- Will the first one work just like the launchpad's serial communication using "Serial.print();" in Energia?

- Will the second one work just like the launchpad's serial communication using "Serial.print();" in Energia? I guess not (there are not the test and reset pins) so how to use it? How to simple communicate using the second one? Hello world example appreciated.

 

Hawwwran

Share this post


Link to post
Share on other sites

TXD/RXD (and GND) lines are used for UART transfer. TEST/RESET pins are used for SBW/JTAG flashing and there are not related to UART transfer.

Share this post


Link to post
Share on other sites

So you say, that connecting TXD and RXD pins from MSP to the device will allow me to communicate propperly the same as launchpad do?

 

So my question is, why do I use launchpad with disabled TXD and RXD pins on top? I mean I have the jumpers horizontaly for SW UART, but I don't know what the SW UART actualy means... if I connect MSP's TXD and RXD pins, then it uses RST and TEST to communicate? I don't understand the mechanism how it works.

Share this post


Link to post
Share on other sites

TXD/RXD jumper orientation on Launchpad is used for software/hardware UART selection (on target device, chip in socket). TEST/RESET pins are not related to UART.

 

http://www.ti.com/lit/ug/slau318d/slau318d.pdf

Jumpers 4 and 5 connect the UART interface of the emulator to the target device pins P1.1 and P1.2. The
direction of the UART signal lines can be selected by the orientation of the attached jumpers. In horizontal
orientation, the jumpers connect TXD to P1.1 and RXD to P1.2, as they are used for the software UART
communication on the demo application (see Section 3.2). In vertical orientation, the jumpers connect the
TXD signal to P1.2 and the RXD signal to P1.1, as required for the MSP430G2553 USCI.

Share this post


Link to post
Share on other sites

Oh, I think I get it now! So the RXD and TXD jumpers are not bridges, but switches. So I drawed little diagram how I think it's connected to work like that. I just had to, to be calm :-)

Thanks for help

 

uart.jpg

Share this post


Link to post
Share on other sites

The launchpad has 2 parts.  The emulation side (top) and the MCU side (bottom).  In the emulation side is another microcontroller that handles UART <--> USB conversion like the FTDI chip does.  Those headers connect the MCU on launchpad to the emulation side, allowing the UART/USB bridge to interface with the MCU in the dip socket.

 

When you program the MCU to communicate over UART, you can do it one of 2 ways.  Some chips like the G2553 have a hardware USCI module that handles all of the guts of the protocol internally.  You just configure it, then write to a buffer or wait for an interrupt.  Some chips don't have that USCI module, so you have to write your own 'software' based UART code that uses timers to send/read data on the UART bus.  When you do this, you have to use P1.1 for TX and P1.2 for RX (backwards of the USCI config)....so depending on if you use the 'hardware' mode or the 'software' mode, the direction of each pin changes....hence the jumpers that let you switch it.  They let you connect the 'TX' pin on the emulation side to either pin on the MCU (and similarly and oppositely for the 'RX' pin). 

 

Does that make sense?

 

So if you want to use the external USB/UART bridge, you can either:

 

1). Pull those jumpers completely and connect it to the RX, TX pins on the MCU.

2). Pick two other pins on the MCU that can support software UART, connect to those and write some code.

 

UART is just a data format...it describes how the data are framed.  You can send them over TTL, RS232, RS485, RS422, etc which describe what voltages mean what.  E.G. TTL is +5V = 0, 0V = 1.  Sending a stream of bits is easy for the MCU...it just drives a pin low and high a bunch of times in sync with a clock.  The FTDI chip just translates the TTL voltage signals into something the computer can interpret.

Share this post


Link to post
Share on other sites

Hello again. Now I have this question:

 

I'm awaiting this device to come soon and I don't get one thing... the RST line. What is it for?

But my question is little bit more complicated. This device uses chip CP2102 so I searched little bit and found few articles how to take out DTR instead of the RST. But, as I found out.. for MSP430 it seems the DTR is usualy connected to RST pin, so what the RST on the device stands for? Here is the article how to bring the DTR out instead of the RST: http://jimlaurwilliams.org/wordpress/?p=999

 

And what I would be glad to do: to programm the MSP430 using this device. Is it possible? Apparantely not without some HW hack, but it looks arduino guys are able to programm arduino. I know I need the RST and TEST pins from launchpad to programm the chip... so after I figure out the mess with the DTR and RST, only TEST would remain to find and it could work... Have some of you guys any experience with this?

 

 

cp2102.jpg

Share this post


Link to post
Share on other sites

You can use it to program target device by BSL, but I didn't play with generic TI BSL too much, and don't know if it will work or not with your interface.

 

http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/205976.aspx

 

Just to clarify your doubts about connection lines for programming, here is my BSL. I done hardware and software side so it is not compatible with generic TI BSL.

 

RS232        MSP430

 

RTS ----- TEST

DTR ----- RESET

TDX ----- RDX (BSL, not related to UCA hardware UART)

RDX ----- TDX (BSL, not related to UCA hardware UART)

GND ----- GND

 

post-26480-0-46761700-1370956446_thumb.jpg

 

post-26480-0-05335000-1370956519_thumb.gif

 

post-26480-0-88221800-1370956477_thumb.gif

Share this post


Link to post
Share on other sites

If the RST line is just attached the RST line of the CP2102, then that's exactly what it is.  If you pull that pin low, the chip powers down.  So you can use it to allow the MCU to disable or reset the chip.  Attaching it to the RST pin on the launchpad means that when you pull the RST line down to reset the MCU on the launchpad, the adaptor is reset as well.

 

DTR is 'Data Terminal Ready'.  It's a control signal used by RS232 when you are using hardware flow control.  An Arduino is just an AVR MCU with a special serial based bootloader, which is a layer of software that lets you flash a new program over a serial line instead of using a programmer.  They sort of pirate the DTR line to reset the chip and signal when to enter the bootloader and start accepting new code over the serial interface.  To program a MSP430 like this, you would need to first flash bootloader code in the 'usual' way.  However, since the launchpad has a full programmer/debugger built in, there really is no need.

Share this post


Link to post
Share on other sites

I'm  noob in this area so forgive me my silly and repetitive questions.

 

- I get now the difference between the devices RST and DTR, thank you mbeals

- I still don't really understand how the programming works. I know that launchpad (the top part) is using RST and TEST pins to programm the MSP. Is the launchpad's programmer somehow transforming the TXD RXD communication to those TEST and RST pins to programm the MSP or is it possible to find those pins (TEST RST) as output on the CP2102 to point them to TEST and RST on MSP to programm it? My point is, that I want to free myself from having to use launchpad for programming my devices which uses standalone MSP430G2553 chip. I would like to embedd the small device above into my devices or make programming cable for that purpose.

Share this post


Link to post
Share on other sites

Yep.  The MSP430's on the launchpad are programmed through a protocol known as 2-wire jtag or spibywire, which involves using the RST and TEST pins to write directly to the chips flash memory.  The MCU on the emulation side acts as a programming tool, taking the compiled file sent to it over serial, and loading it in the chip over spibywire.

 

If you want to use a standalone chip, you can use the launchpad itself as a programmer.  If you pull those headers connecting the MCU to the emulation side, you can connect the top row (RX, TX, RST, TEST, VCC) and a ground from somewhere else (like the bottom right) to a chip on a standalone board, and it will program it just like it was sitting in the launchpad.  You can also solder a .05" header on that set of pads along the top right edge and have access to all 6 lines (Rx, TX, TEST, RST, GND) in a single header.

 

http://www.43oh.com/2011/11/tutorial-to-use-your-launchpad-as-a-programmer/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×