Important changes to forums

We’re making some changes to the Mbed forums. From 10th December 2019 all new discussions will take place on our new forum site. You can continue to reply to existing threads for the next two weeks. After that we will archive this forum so you can return to useful posts in the future.

Serial comms to PC using Serial tx/rx

01 Jun 2011

OK, I'm trying to connect my mbed to my pc via p27/p28 as a serial connection.

To connect this I've got a usb-to-serial convertor (Prolific chipset).

I have connected pin 3 (assumed to be tx) of the usb-to-serial to the rx (pin 27). I have connected the ground (pin 5 on usb-to-serial) to gnd on the board. The other pins on the usb-to-serial connector are not connected up at all.

I thought this would be enough to at least receive data (key presses via putty) but it just does not work.

It works fine over the regular usb headed on the board, and all the settings are the same as this in putty (the default values) but nothing is recieved.

I'm guessing there is something fundamentally wrong here (and probably silly) .... can anyone please help me?

01 Jun 2011

Your USB to Serial cable is probably USB to RS-232 serial and not USB to TTL level serial. You are going to need a level converting IC, such as the MAX232 or equivelant.

See here: http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf

Best regards,

Mike

01 Jun 2011

Did you correct the program to use p28/p27 for serial instead of USBTX/USBRX?

02 Jun 2011

If you just want a quick-and-dirty test, it is easy to haywire a simple level converter/inverter in the receive path. For example:

https://lh3.googleusercontent.com/-ZRSD7-0nKpQ/Tebt4GoUz_I/AAAAAAAAAGA/ZMxS95sRfjk/s800/RS232%252520rcvr.jpg

Going the other direction is trickier - a MAX232 is a good solution, like Mike suggests. Just be sure you have +5 volts available to run it.

02 Jun 2011

One quick test for you to do, short pins 2 & 3 on the 9 way D, as you type in terminal, it should be echoed back to the terminal.

CAUTION +/- 12 volts can be present on the pins of RS232. (more than enough to kill MBED)

Two things from my own experience, avoid the prolific part, my all time favorate is the FTDI chip set (Never crashes PC, and has best PC drivers ever IMHO)

for all of you i recommend, from Farnell: FTDI TTL-232R-3V3-WE part number 1740365 for £16

It is a little expensive, but this comes with an USB Plug on one end, and TTL (3V3) on the other on bair wires.

or 1740367 FTDI TTL-232R-3V3-PCB

/media/uploads/ceri/ftdi_3v3_stick.jpg

Enjoy Ceri.

02 Jun 2011

Aaaaah ... how silly of me :)

Mike & Hexley, you're spot on. Thank you so much! Looking at Maplin (my local electronics store) they have a max232cpe (http://tinyurl.com/6eqjw85) which looks like it's the the max232 (and NOT the max232a) so I should be able to build a small circuit to do the conversion like this: http://tinyurl.com/dgkh2g

I had a sneaky suspicion it might be something to do with this, but I couldn't find any information on the mbed website.

I think it would be very useful for the mbed site to have a "basics" section where simple stuff like this gets outlined for those people that have green-fingers when it comes to interfacing stuff with the board.

Thanks again for your help - I really appreciate it! All I'm trying to do is to "listen in" to what is being sent down the usbtx by mirroring it out another serial connection (I can't seem to "snoop" on the data being set to the COM port under win7 x64).

I'll let you know how I get on ....

02 Jun 2011

I just realised that I should be using a MAX3232 to get the 3.3v output (rather than 5v that the 232 gives). This would then need 0.1uf caps rather than 1uf caps that the design here http://tinyurl.com/dgkh2g says to use. I assume I can serve the 3.3v via Vout on the mbed board.

Thanks for the link Ceri - I would go down this route, but I think I'll learn more by building my own converter. If it does not work, then I'll just order the FTDI cable and be done with it :)

02 Jun 2011

If you don't mind breaking your cable, you could try opening it - it's quite likely it has an USB-TTL chip plus the level converter. You can then just bypass the level converter and connect directly to the TTL pins.

08 Jun 2011

I successfully wired up the MAX3232 & capacitors on a little board and this now allows the RS232 from the USB/Serial adaptor to interface with the board perfectly. Thank you everyone for your help, I really appreciate it!

16 Mar 2012

Hi. Thanks for posting this thread Simon, indeed there are electronically challenged people like me who doesn't know what to do. This saves me time posting the same thing again :)

Though 1 question can I use the max232 instead of max3232 if my RS-232 device does not require the full +12/-12V of the true RS232. 0-5V is usually sufficient. But it does expect the signal to be inverted.

16 Mar 2012

the max 232/3232 both invert the signals.

the max 232 will run at 5 Volts logic & should have around +/- 9 Volts, on I/O pins

Whereas max 3232 has 3 to 3.3 Volt logic, and around 6 volts on I/O.

I think RS232 is guaranteed to work at +/- 5 Volts (I/O)

for a good set of data sheets look in Farnell.

hope this helps.

Ceri.

19 Mar 2012

Okay. Will it blow my mbed if I use a max232 which uses a +5v. to the mbed which I/O pins are 3.3v?

19 Mar 2012

if you power the MAX232 from 3V3, then I/O lines will be 3V3,

so no problem,

I think most of the I/O pins on MBED are 5V Tollerent, but not 100% sure,

to be safe, if using 5V signals, use a resistor of a couple of K (guessing anything > 560 Ohms) will give some protection.

check the data sheet for the spesific MAX232, to see if it will work down to 3V3.

Ceri.

You need to log in to post a reply