|
Homebrew Equipment A place to show, design and discuss the weird and wonderful electronic creations from the hands of individual members. |
|
Thread Tools |
14th Feb 2021, 10:03 am | #1 |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,608
|
Help with RS232 needed!
I have a device that talks RS-232 to the rest of the world but it is talking gibberish... I've set up my terminal 4800 8-N-1 as directed, I've tried various forms of flow control but I always get the output shown below. It is a USB - serial interface based on a PL-2303 chip by Prolific.
I'm expecting NMEA-0183 messages like this: $PRWIRID,12,01.80,11/26/97,0003,*42 $GPGGA,,,,,,0,00,,,,,,,*66 $GPGSA,,,,,,*42 ..... etc. .... Can anyone shed any light? I'm afraid that RS-232 isn't a protocol I'm very familiar with....
__________________
Richard Index: recursive loop: see recursive loop |
14th Feb 2021, 10:12 am | #2 |
Moderator
Join Date: Jan 2003
Location: Ipswich, Suffolk, IP4, UK.
Posts: 21,288
|
Re: Help with RS232 needed!
Well at least the two devices are communicating, which is generally the most difficult bit.
I'd try changing the speed at the PC end, the sending device's speed may have been changed.
__________________
Graham. Forum Moderator Reach for your meter before you reach for your soldering iron. |
14th Feb 2021, 10:34 am | #3 |
Octode
Join Date: Feb 2006
Location: Bristol, UK.
Posts: 1,042
|
Re: Help with RS232 needed!
I agree with Graham, looks like the baud rate is incorrect. That or the number of data bits is wrong
|
14th Feb 2021, 11:25 am | #4 |
Dekatron
Join Date: Sep 2005
Location: Seaford, East Sussex, UK.
Posts: 5,997
|
Re: Help with RS232 needed!
Parity bit?
|
14th Feb 2021, 11:36 am | #5 |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,608
|
Re: Help with RS232 needed!
I have just now tried every selectable baud rate from 300 up to 57600, I've tried 5,6,7 & 8 data bits; stop bits 1, 1.5 & 2; and even or odd parity. None of that makes the data intelligible!
__________________
Richard Index: recursive loop: see recursive loop |
14th Feb 2021, 12:05 pm | #6 |
Moderator
Join Date: Dec 2010
Location: Exeter, Devon and Poole, Dorset UK.
Posts: 6,866
|
Re: Help with RS232 needed!
He have had a lot of trouble with RS232 devices in recent years.
The trouble came down to the drive software being used in modern machines. Newer machines were simply too fast ISTR it wasn't the bit rate so much as the UART getting hit too often and too fast. In much older machines there was a physical UART modern PC's its a software UART and that is where the trouble lay. As the machines have got faster the code that delayed the read and write cycles became increasingly not slow enough. In our case the code had to be re-written to give the serial device more time and voila problem gone. Due to legacy requirements in our industry we still support serial coms even on our latest equipment its was an HA now TOPAS requirement. We mostly use the Lindy RS232 to USB converter. Cheers Mike T
__________________
Invisible airwaves crackle with life or at least they used to Mike T BVWS member. www.cossor.co.uk |
14th Feb 2021, 12:22 pm | #7 |
Moderator
Join Date: Jan 2003
Location: Ipswich, Suffolk, IP4, UK.
Posts: 21,288
|
Re: Help with RS232 needed!
I have a CNC machine tool dating from the mid eighties which is controlled using RS232 from a PC running windows 7 and I've never seen any problems. I can't remember what the physical interface is at the PC end, but I have an idea it's a card with a couple of serial ports rather than a USB to serial convertor. I'll check.
How about scoping the output from the GPS device to get an idea of speed although syncing might be difficult?
__________________
Graham. Forum Moderator Reach for your meter before you reach for your soldering iron. |
14th Feb 2021, 1:54 pm | #8 |
Guest
Posts: n/a
|
Re: Help with RS232 needed!
As it looks like it is a GPS device I reckon the polarity is upside down, 0 to 5V TTL (could be 3.3V, still TTL levels). I have a GPS module in my meter clock connected to a PIC micro without RS232 conversion either end, works a treat. RS232 converters invert the signal, two cancel out and one mucks* it all up. Is there an "invert" function in your terminal software?
*One way of spelling it! |
14th Feb 2021, 2:54 pm | #9 | |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,608
|
Re: Help with RS232 needed!
Quote:
Looking at the signal on the 'scope, it appears to be negative-going - in other words, the display has a line at the top (+5V) and short pulses downwards towards 0V
__________________
Richard Index: recursive loop: see recursive loop |
|
14th Feb 2021, 2:55 pm | #10 |
Heptode
Join Date: Apr 2003
Location: Newton Abbot, Devon, UK.
Posts: 761
|
Re: Help with RS232 needed!
Link the TX and RX pins of the USB to serial cable (with the cable disconnected from the far-end device!) This is pins 2 and 3 on a DB9 cable, from memory.
In the terminal program can you type characters and see them echoed back to the screen? If so, the USB to serial cable, the OS and the driver are working (assuming no hardware handshaking etc). |
14th Feb 2021, 3:05 pm | #11 |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,947
|
Re: Help with RS232 needed!
Colin's advice is good.
I reckon you definitely have a speed / parity / byte length mismatch. From the examples given it looks as if the device data rate is lower than the terminal data rate. |
14th Feb 2021, 3:12 pm | #12 | |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,608
|
Re: Help with RS232 needed!
Quote:
So, if the cable and adapter is okay, then the output from the GPS must be awry. Perhaps I'll put an inverter in the signal. I wonder if the TXD and RXD pins in the GPS device are wrong way around, would that have this effect? Data Out from the GPS receiver is connected via a MAX233 to RXD, Data In is connected to TXD
__________________
Richard Index: recursive loop: see recursive loop |
|
14th Feb 2021, 3:23 pm | #13 |
Octode
Join Date: Jan 2014
Location: Oban, Scotland, UK.
Posts: 1,129
|
Re: Help with RS232 needed!
What equipment is the NMEA coming from? Is it NMEA183 or NMEA2k?
|
14th Feb 2021, 3:23 pm | #14 |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,947
|
Re: Help with RS232 needed!
I don't think swapping TXD and RXD would have this effect, but it's easy enough to try. Professionals would use a breakout box / line analyser when trying to resolve these sorts of problems, which makes life easier, but for a simple 3 wire connection without modem control you can just use two plugs with wires going to the TXD, RXD and GND pins.
|
14th Feb 2021, 3:32 pm | #15 |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,608
|
Re: Help with RS232 needed!
It's NMEA-183, a Navman GPS receiver
I just tried swapping the TX & RX pins, there's no output at all, no characters received at the terminal. I suppose I'm going to have to try an inverter now :-( But, wait, I've just read that maybe I can simply take the MAX233 out of the circuit and have the GPS directly drive the RS-232 adapter. It's only on a short cable and it's only running 4800 baud, so there shouldn't be any signal issues....
__________________
Richard Index: recursive loop: see recursive loop Last edited by mole42uk; 14th Feb 2021 at 4:00 pm. |
14th Feb 2021, 4:47 pm | #16 | |
Guest
Posts: n/a
|
Re: Help with RS232 needed!
RS232 has mark as the default state, this is LOW for RS232 and HIGH for TTL serial, so it is inverted (or not inverted if you think about it).
Quote:
Last edited by Guest; 14th Feb 2021 at 4:48 pm. Reason: Added a bit |
|
14th Feb 2021, 5:17 pm | #17 |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,608
|
Re: Help with RS232 needed!
Hurrah!
Thanks for all your help, everyone. I've finally achieved two things: 1. I've learned a lot about RS-232 today and how easy it is to understand. 2. I've got the correct output from my GPS receiver. Going back to RTFM, I discovered that the outoput can either talk NMEA-0183 or some other message protocol that isn't defined. Of course, to ensure the receiver starts up in NMEA, a pin has to be held low at start-up. Now I may start to check that the system is working properly! Thank you again,
__________________
Richard Index: recursive loop: see recursive loop |
14th Feb 2021, 5:31 pm | #18 |
Guest
Posts: n/a
|
Re: Help with RS232 needed!
Once some sense comes out of it... fun time!
|
14th Feb 2021, 5:56 pm | #19 | |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,947
|
Re: Help with RS232 needed!
Quote:
|
|
24th Feb 2021, 9:59 am | #20 |
Heptode
Join Date: Jan 2008
Location: Ashhurst, Manawatu, New Zealand
Posts: 571
|
Re: Help with RS232 needed!
I have a Navman 1220A marine GPS antenna/receiver that outputs RS232 NMEA183 that is very picky on how you start it up. It wants the 5volt power applied first but without the COM port connected. My receiver COM port goes via a COM to USB adapter which probably has a MAX233 inside of it. Once the receiver has had a few minutes, then I can plug the adapter into another USB port and it works a treat. It doesn't matter whether it goes into cold or warm start, it's always the same. If I don't wait long enough, it takes charge of the mouse which then zooms all over the screen with occasional button presses!
__________________
Cheers - Martin ZL2MC |