EmbeddedRelated.com
Forums

Monitor RS232 comms with millisecond resolution

Started by rowan.bradley June 20, 2010
> Anyone know the quickest or easiest way of recording a serial data stream > and timestamping each byte with a resolution of at least 1ms (preferably > finer)? I can only find cheap or free programs with less resolution, or > very expensive solutions, often involving special hardware. > > I only need to monitor one port, and I don't need to send any characters > (actually I'm snooping on an RS485 bus). > > I'm prepared to use an old PC with a "real" serial port, run MSDOS, Linux > or whatever other OS will do the job, use some sort of microprocessor to > capture the data (preferably one I'm familiar with, such as 8051 family or > PIC) or anything else so long as it's quick and cheap. I just need to get > the job done, preferably tomorrow! >
If you only want to analyse a serial data stream and if you are sure, that the bits are correct, you can simply read the data with a PC. I don?t think, that you need a microcontroller. The simplest way is, you take the B wire (or D-) of the RS485 signal and connect it via a 1K resistor with the RXD* line of the PC and the GND line of your RS485 Device with the GND-Line of the PC-Com-Port. This is electrically not ideal, but should normaly work. But You should not connect the TXD* line (the one, where you see about -8V) of the PC to the RS485 bus. A better solution of course would be the use of a RS485 tranceiver which is used only in read-mode, e.g. max485. Now take a simple program, e.g. in Turbo-Pascal under DOS or Delphi under Windows and record the data. For a one-cannel solution, i would prefer delphi. For a two-channel solution, where i need the timing between the two signals, it might be better in DOS. With some experience in serial communication, this should be done in about half an hour. With MSDOS or Windows, you can use every baudrate that is a factor/divider of 115200. best regards Stefan DF9BI
In comp.arch.embedded,
Oliver Betz <obetz@despammed.com> wrote:
> "rowan.bradley" wrote: > >>Anyone know the quickest or easiest way of recording a serial data stream >>and timestamping each byte with a resolution of at least 1ms (preferably >>finer)? I can only find cheap or free programs with less resolution, or >>very expensive solutions, often involving special hardware. > > So you already checked all solutions listed on > http://wiki.oliverbetz.de/owiki.php/TerminalPrograms ? > > Another possibility is http://www.tech-tools.com/dv_main.htm - it's > able to record and decode serial data and of course the resolution is > several orders of magnitude better than you require. Not cheap but a > good logic analyzer is often useful.
Much cheaper and possibly enough for this job: http://www.saleae.com/logic/ -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail) I'm having a tax-deductible experience! I need an energy crunch!!
In article <4c1f3dc4$0$3314$8e6e7893@newsreader.ewetel.de>, 
stefan___@broering.de says...
> > Anyone know the quickest or easiest way of recording a serial data stream > > and timestamping each byte with a resolution of at least 1ms (preferably > > finer)? I can only find cheap or free programs with less resolution, or > > very expensive solutions, often involving special hardware. > > > > I only need to monitor one port, and I don't need to send any characters > > (actually I'm snooping on an RS485 bus). > > > > I'm prepared to use an old PC with a "real" serial port, run MSDOS, Linux > > or whatever other OS will do the job, use some sort of microprocessor to > > capture the data (preferably one I'm familiar with, such as 8051 family or > > PIC) or anything else so long as it's quick and cheap. I just need to get > > the job done, preferably tomorrow! > > > > If you only want to analyse a serial data stream and if you are sure, > that the bits are correct, you can simply read the data with a PC. > > I don?t think, that you need a microcontroller. > > The simplest way is, you take the B wire (or D-) of the RS485 signal and > connect it via a 1K resistor with the RXD* line of the PC and the GND > line of your RS485 Device with the GND-Line of the PC-Com-Port. This is > electrically not ideal, but should normaly work. But You should not > connect the TXD* line (the one, where you see about -8V) of the PC to > the RS485 bus. > > A better solution of course would be the use of a RS485 tranceiver which > is used only in read-mode, e.g. max485. > > Now take a simple program, e.g. in Turbo-Pascal under DOS or Delphi > under Windows and record the data. > > For a one-cannel solution, i would prefer delphi. For a two-channel > solution, where i need the timing between the two signals, it might be > better in DOS. > > With some experience in serial communication, this should be done in > about half an hour. > > With MSDOS or Windows, you can use every baudrate that is a > factor/divider of 115200.
Without changing system timing, MSDOS won't give you 1ms resolution only 1/18.5 Hz. Not sure about all forms of Windows and system clock resolution.
> best regards > > Stefan DF9BI > >
-- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font <http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny <http://www.badweb.org.uk/> For those web sites you hate
On 2010-06-21, D Yuniskis <not.going.to.be@seen.com> wrote:

>> If possible I'd like it to run at a non-standard baud rate (62,500 >> baud). > > IIRC, a "real PC" will give you problems hitting 62,500. > I think the baud rate clock is fed from too low of a frequency > to give you enough precision to hit "any" baudrate you want > (esp at higher rates, obviously)
You're right. A "standard" motherboard UART can't do 62.5K. It can do 57.6K and 115.2K, but nothing in between. -- Grant Edwards grant.b.edwards Yow! I'm ANN LANDERS!! at I can SHOPLIFT!! gmail.com

Grant Edwards wrote:
> On 2010-06-21, D Yuniskis <not.going.to.be@seen.com> wrote: > > >>>If possible I'd like it to run at a non-standard baud rate (62,500 >>>baud). >> >>IIRC, a "real PC" will give you problems hitting 62,500. >>I think the baud rate clock is fed from too low of a frequency >>to give you enough precision to hit "any" baudrate you want >>(esp at higher rates, obviously) > > > You're right. A "standard" motherboard UART can't do 62.5K. It can do > 57.6K and 115.2K, but nothing in between.
Load good old DOS, set up PC timer interrupt and do bit banging. You can i/o at the standard LPT port as fast as ~1.5MHz or so. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
In article <EpmdnWB348YFOIPRnZ2dnUVZ_qGdnZ2d@giganews.com>, 
rowan@n_o_s_p_a_m.sylvester-bradley.org says...
> Anyone know the quickest or easiest way of recording a serial data stream > and timestamping each byte with a resolution of at least 1ms (preferably > finer)? I can only find cheap or free programs with less resolution, or > very expensive solutions, often involving special hardware. > > I only need to monitor one port, and I don't need to send any characters > (actually I'm snooping on an RS485 bus). > > I'm prepared to use an old PC with a "real" serial port, run MSDOS, Linux > or whatever other OS will do the job, use some sort of microprocessor to > capture the data (preferably one I'm familiar with, such as 8051 family or > PIC) or anything else so long as it's quick and cheap. I just need to get > the job done, preferably tomorrow! > > If possible I'd like it to run at a non-standard baud rate (62,500 baud). > > Thanks - Rowan >
I kind of scanned through he replies and I don't think I saw this mentioned. *IF* you don't have much data to dig through, or you have lots of time on your hands, you can use a logic analyzer and get ns resolution if you want. Many of them have settings to mark a channel as a serial input of differing type, UART, I2C, SPI and so on, and then mark the data up appropriately. All you need is access to the logic side of the transceiver, or the logic signals for on board busses. I am only mentioning it because I have used it for a very similar purpose. So, the software the comes with the Digi View from Tech Tools will let you set multiple inputs up as serial data with any baud rate and combo of start and stop bits, parity and so on, and display the massaged data bytes with full timing info available on every level transition, including the start bit. Jim
On Jun 20, 4:34=A0pm, "rowan.bradley" <rowan@n_o_s_p_a_m.sylvester-
bradley.org> wrote:
> Anyone know the quickest or easiest way of recording a serial data stream > and timestamping each byte with a resolution of at least 1ms (preferably > finer)? I can only find cheap or free programs with less resolution, or > very expensive solutions, often involving special hardware. > > I only need to monitor one port, and I don't need to send any characters > (actually I'm snooping on an RS485 bus). > > I'm prepared to use an old PC with a "real" serial port, run MSDOS, Linux > or whatever other OS will do the job, use some sort of microprocessor to > capture the data (preferably one I'm familiar with, such as 8051 family o=
r
> PIC) or anything else so long as it's quick and cheap. I just need to get > the job done, preferably tomorrow! > > If possible I'd like it to run at a non-standard baud rate (62,500 baud). > > Thanks - Rowan =A0 =A0 > > --------------------------------------- =A0 =A0 =A0 =A0 > Posted throughhttp://www.EmbeddedRelated.com
Have you seen this: <http://www.232analyzer.com/232default.htm> ?? According to their hype, "All monitoring modes available in 232Analyzer software come with timestamps in milliseconds." RK
On Sun, 20 Jun 2010 18:34:48 -0500, "rowan.bradley"
<rowan@n_o_s_p_a_m.sylvester-bradley.org> wrote:

>If possible I'd like it to run at a non-standard baud rate (62,500 baud).
Typically the UART requires a clock that is 16x the baud rate, thus, for 62.5 kBaud, the crystal frequency would have to be multiple of 1 MHz. Take some ISA/PCI UART board and replace the crystal (oscillator) with one that oscillates on some exact MHz close to the original frequency and adjust the divisor accordingly.
On 10-06-20 16:34, rowan.bradley wrote:
> Anyone know the quickest or easiest way of recording a serial data stream > and timestamping each byte with a resolution of at least 1ms (preferably > finer)? I can only find cheap or free programs with less resolution, or > very expensive solutions, often involving special hardware. > > I only need to monitor one port, and I don't need to send any characters > (actually I'm snooping on an RS485 bus). > > I'm prepared to use an old PC with a "real" serial port, run MSDOS, Linux > or whatever other OS will do the job, use some sort of microprocessor to > capture the data (preferably one I'm familiar with, such as 8051 family or > PIC) or anything else so long as it's quick and cheap. I just need to get > the job done, preferably tomorrow! > > If possible I'd like it to run at a non-standard baud rate (62,500 baud). > > Thanks - Rowan > > --------------------------------------- > Posted through http://www.EmbeddedRelated.com
This little widget has proven *very* valuable to me: http://www.saleae.com I do a lot of communications development/debugging, and this thing is FANTASTIC (no, I'm not affiliated with Saleae - just a happy customer ;) </A>
Thanks for all the helpful replies. I'm coming to the following conclusions:
 - Windows can't do what I want, or at least not without a huge amount of 
work trying to get the most accurate timestamps possible, and even then it 
would be only barely good enough.
 - I could possibly do it on a PC with MSDOS, but I would effectively be 
programming it as a microprocessor.
 - The standard ISA or motherboard serial port can't do 62,500 baud.
 - I'm therefore best to use a simple free standing PCB with a 
microprocessor with a RTC and two serial ports capable of flexible baud 
rates. One runs at 62,500 baud and receives the characters from the RS485 
bus. The other runs at 115,200 baud or higher and sends to the PC. The 
receive interrupt handler receives the bytes, timestamps them and writes 
them into a buffer. The main program reformats the bytes and timestamps in a 
form suitable for the PC and writes them into an output buffer. The send 
interrupt handler sends them to the PC.

So long as the PC can keep up, either because the baud rate is high enough 
or because there are sufficient gaps in the incoming data for the buffers to 
empty (in practice the data comes in short bursts with gaps between so with 
decent sized buffers this won't be a problem).

One other thing I learned - the Saleae logic analyser looks a really 
interesting device for a very good price - I think I may get one of those...

Thanks again for a valuable discussion - Rowan