LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   looking for simple RS232 driver & sniffer (https://www.linuxquestions.org/questions/linux-software-2/looking-for-simple-rs232-driver-and-sniffer-171716/)

fbarre 04-18-2004 01:41 PM

looking for simple RS232 driver & sniffer
 
Hi all,

I'm new in Linux drivers programming world.. thanks to O'Reilly's "Linux Device Drivers" book, I was able to pick up the basics but I'm trying to program a simple RS232 driver and don't know where to start. Simple meaning, I want to be able to access/control a board connected to my PC's serial port while using 3 wires only.

I was wondering if anyone knows a simple example out there to follow and also any Linux RS232 sniffer/spy available out there... couldn't find any over the web.

thanks,

larrykeenan 04-18-2004 05:47 PM

Look at http://www.ontrak.net/linux.htm
as a starting point.

fbarre 04-19-2004 06:47 PM

Hi larrykeenan and all,

Thanks for your reply and this driver would do the job but I followed it and I can't talk to my board. For instance by writting 0x81 it should I should get a reply of 0x04. I even wrote 10000001 or 1 0 0 0 0 0 0 1 or 0 0 0 1 1 0 0 0 and no luck.

It says in the example that a special cable was used and I was wondering if this is a big deal as I'm using a normal serial cable where I'm using only the Rx, Tx and Grnd pins.

If you've successfully used this example to communicate with a board please let me know your suggestions as I am stuck! I suspect I should costumize this line and tried few things but no luck. (my baud is 115200)

my_termios.c_cflag = B115200 | CS8 |CREAD | CLOCAL | HUPCL;

I checked the following:

1) from the this output I can tell I my PC serial is using ttyS0
setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4

2) while the program is running, it shows that I'm txing/rxing crazy number of bytes!
and it stays the same even when I quit the program. Initially, tx:24 and rx:0 but never saw these values again:
cat /proc/tty/driver/serial
serinfo:1.0 driver:5.05c revision:2001-07-08
0: uart:16550A port:3F8 irq:4 baud:115200 tx:300973 rx:271036 fe:8 RTS|DTR

3) I did check my serial port of my board and can successfully to it using a Windows based RS232 sniffer.

4) I changed 2 pcs to make sure that my serial port is working.

greatly appreciate your help,


All times are GMT -5. The time now is 08:19 AM.