Ports
June 20, 2013, 12:57:49 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Welcome to the PORTS Forum. Please post your questions, answers, and comments relating to USB and other hardware interfaces in the appropriate forums below. - Jan
Pages: [1]
  Print  
Author Topic: Serial Port Sniffer & 9th bit support  (Read 4035 times)
mduarte
Member
*
Posts: 3


« on: March 21, 2012, 12:37:08 am »

Hello !

I need to start some research creating a serial port sniffer to analyze a specific protocol (I mean.. spy an existing rs232 serial protocol between two serial devices).  I have read a lot about 9th bit on windows, so I want to change the device.

I was thiking to use Arduino forthis purpose. So I have the following questions I hope somebody may help me :

- Does arduino supports to have two different serial ports opened and listen them ?
- The Rs232 serial protocol I need to analyze is very strict and special: 5ms interbyte timming, and 9th bit set on first byte to determine packet start.
  Does arduino UART support 9th bit detection/set ??   What about the interbyte timming, do you think arduino processor would be fast enough to manage it ?

- Do you think I can have the same results if I use Netduino instead Arduino ?

- BTW, do you have any libray/code I can use to implement 9th bit on PC-UART (I just need to determine if first byte has 9th bit set, but with parity replacement I cannot get it works)


Thanks in advance for your guidelines ! 


Logged
GlennP
Frequent Contributor
****
Posts: 126


« Reply #1 on: March 21, 2012, 08:05:20 am »

Hi,

I have used AGG softs Advanced Serial Port Monitor with mixed results I have not tried to read 9 bit data with it, but it should or else AGG will be able to guide you web site is www.aggsoft.com/serial-port-monitor.htm
Also  I have used Free Serial Port Monitor from HDD soft at www.serial-port-monitor.com/index.html again I have not used for 9 bit data, but you might get lucky....

Glenn
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1642


WWW
« Reply #2 on: March 21, 2012, 09:10:18 am »

I have links to serial-port software tools here:

http://www.lvr.com/serport.htm#software

For Arduino-specific questions, an Arduino forum might be the best place to ask:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl

Jan
Logged
mduarte
Member
*
Posts: 3


« Reply #3 on: March 21, 2012, 01:30:15 pm »

Thank you for your fast responses!

Maybe I have no explained my need pretty well. I already have a external software to monitor the communications between two serial port devices like AGG softs Advanced Serial Port Monitor.

The think I need to resolve is that right now I need to do something by myself.  I am not thinking to reinvent the wheel, because I only need to get working the following data flow:

 For each byte coming from Serial Port 1 =>  Store each byte into internal memory and read 9th bit status => redirect the byte to Serial Port 2

Each time I detect a packet end (in my case is with an interbyte timeout greather than 5ms), I need to move the byte array stored at internal memory and send it back to be parsed later on (maybe to a text file, through another serial port, etc) and clear it to next incoming packet.

The effort on development I suppose it is going to be only in the offline parser, not in the serial port pass through. For the offline parser is where I need to be able to retrieve the 9th bit status it had on arribe.

What kind of architecture can you recommend us to implement that feature ?  (pc with dos, windows or linux, PIC, Arduino, etc.etc.)
 
Thanks!
Logged
GlennP
Frequent Contributor
****
Posts: 126


« Reply #4 on: March 22, 2012, 12:14:55 pm »

I take it English is not your first language, as I am having a little trouble following your reply, but I will try.  You need to read eight bytes, the next byte is used to switch to the next Serial port and not really used for data (i.e. 0 for stay the same 1 for switch) ? As for the architecture why do you ask, Jan's examples are targeted toward Windows and Vis studio with PIC being the Embedded platform, however Linux & Arduino, PC running DOS can do it as well.  In my own view Windows C# & Microchip's PIC family are a good starting point, lots of users good help.
"The effort on development I suppose it is going to be only in the offline parser, not in the serial port pass through. For the offline parser is where I need to be able to retrieve the 9th bit status it had on arribe."  So the job is an offline parser?  So if I get what you are saying the data could look like
                                       111111111,222222222,3333333,44444444,55555555,666666,7777777,88888888,0000001
coming in via Com1 (11111111, is the first byte)

so the data stored is:
11111111
22222222
33333333
44444444
55555555
66666666
77777777
88888888
00000001

the 00000001 causes the port to switch to Com2 ?  Could you not then step through it using an array or RegEx type expression.  Seem to less about comms and more about handling data. Sounds an awful lot like a Uni Assignment to me! Smiley
       
 
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1642


WWW
« Reply #5 on: March 22, 2012, 04:16:45 pm »

Mark and Space parity can be used as a 9th bit in .NET. However, this may be too slow if your goal is to monitor traffic you don't have control over.

Jan
Logged
mduarte
Member
*
Posts: 3


« Reply #6 on: March 26, 2012, 10:28:36 am »

GlennP / Jan,  thanks for your response.  you're right english is not my first language  Wink

What I need to do is similar to what you has explained jan. Let's suppose the following packet is arriving from COM2 :

{ 0x01,0x10,0x030,0x40 }   ( I am going to determine when the packet is completed checking the interbyte timeout, the brackets are just used here to delimit the whole packet content).

I need to store the packet content (for example in flat text mode) to analyze later on, adding to the packet an identifier (or whatever I choose) only if the first byte (0x01) has set the 9th bit, for example:  { *,0x01,0x10,0x030,0x40 }

The analysis process and how to store the packet content in fact is out of what I need because I know how to resolve it. What I didn't know how to handle was to determine if a specific byte has set the 9th bit or no. That's all ;-)

Because as far as I know, under windows it is not possible to determine it accurately and fast enough as you read each byte, so I was trying to have opinions about what different architecture I can use.  (maybe you have some c++ code which allows me to read the 9th bit status under windows)

I hope this post is more clear the previous one. Sorry about the misunderstandings!
Marcelo




Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1642


WWW
« Reply #7 on: March 26, 2012, 01:03:18 pm »

I don't have a specific recommendation, but a search on:

windows serial port "9-bit" driver

will turn up various discussions and tools.

Jan
Logged
GlennP
Frequent Contributor
****
Posts: 126


« Reply #8 on: April 10, 2012, 04:47:23 am »

Umm Hi,

Looking for something else I came across this:

http://www.codeproject.com/Articles/75770/Basic-serial-port-listening-application

Might be what is wanted?


Glenn
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!