LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   more then 4 serial ports (https://www.linuxquestions.org/questions/linux-hardware-18/more-then-4-serial-ports-586232/)

mattsoftnet 09-20-2007 11:19 PM

more then 4 serial ports
 
the project I'm doing needs a lot of serial ports. I have 2 on the motherboard, but they were used up very fast. I got a 6 serial port pci card to use, totaling at 8 serial ports. all I knew about the card was that it supports linux. I go into the readme files on the drivers cd and it says "Since Linux only support 4 serial ports (ttyS0, ttyS1, ttyS2, ttyS3) under the default condition." okay.. how do I change that in linux? I need all 8 ports available, not just the first 4. I'm currently running fedora 7 on my development machine, but I might be using centos for the final server setup. any help would be great. I've been searching, but not finding what I'm looking for. I may be searching with the wrong keywords.

Simon Bridge 09-20-2007 11:41 PM

Step one: plug the card in and see what happens. I have seen multi serial cards work out of the box. The devices are created as /dev/tty/x

mattsoftnet 09-21-2007 01:03 AM

I disabled the on board serial ports to simplify things a bit more. I'm not sure if linux enables them again on it's own, but either way, I have ttyS0 ttyS1 ttyS2 ttyS3 . tty isn't a directory so I can't go in it. I'm not sure what it is on this system. if all of the serial ports were working, there should be 6 of them, plus the 2 on board that are disabled. is there a setting in the kernel for this or something? to allow more then 4 ports?

Simon Bridge 09-21-2007 02:46 AM

........try:
man ttys

but did you not try with the onboard ports enabled??

mattsoftnet 09-21-2007 10:11 AM

with the onboard ports enabled, it was still showing up as 4 ports. I'm not sure what port is what yet, but I'd like to get them all installed first.

I read the manual you said about "man tty" but it doesn't say much. it returns "/dev/pts/0"

farslayer 09-21-2007 10:28 AM

lspci to see if the system can see the board properly..
lshw would give more detailed hardware info..

if udev doesn't create the serial device nodes for you automatically, you should be able to manually create them.

http://www.linux.org/docs/ldp/howto/...tml#make_multi

http://www.linux.org/docs/ldp/howto/...-HOWTO-11.html

mattsoftnet 09-21-2007 10:49 AM

here's what I got for those 2 commands

02:0c.0 Serial controller: NetMos Technology PCI 1 port parallel adapter (rev 01)

*-communication
description: Serial controller
product: PCI 9845 Multi-I/O Controller
vendor: NetMos Technology
physical id: c
bus info: pci@0000:02:0c.0
version: 01
width: 32 bits
clock: 33MHz
capabilities: 16550
configuration: driver=serial latency=64

mattsoftnet 09-21-2007 11:42 AM

I have a simple program I wrote in c to send commands to a serial port. it was working well with the onboard ports, but now that I disabled those and only have the card installed, it's failing to open ports. I have tried the setserial command, but I'm still learning a lot with linux. not sure what I could be doing wrong, but something's not right.

[root@localhost serial]# ./serial
Serial_Init:: tcgetattr() failed
SendByte() failed

farslayer 09-21-2007 11:51 PM

with the onboard disabled and the card installed what o you get from teh following command ? (curious to see what the OS thinks of those ports at boot time)

Quote:

debianetch:/# cat /var/log/dmesg | grep ttyS
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

mattsoftnet 09-22-2007 01:02 AM

looks like it sees only 4 ports. there has to be a setting someplace or a patch or kernel module to allow the other 4 ports to work.


[root@localhost ~]# cat /var/log/dmesg | grep ttyS
0000:02:0c.0: ttyS0 at I/O 0xdff0 (irq = 9) is a 16550A
0000:02:0c.0: ttyS1 at I/O 0xdfe0 (irq = 9) is a 16550A
0000:02:0c.0: ttyS2 at I/O 0xdfa8 (irq = 9) is a 16550A
0000:02:0c.0: ttyS3 at I/O 0xdfa0 (irq = 9) is a 16550A

farslayer 09-23-2007 01:08 AM

did you try creating the additional device nodes as mentioned in a previous reply in this thread ?
Follow the links I posted....

mattsoftnet 09-23-2007 02:16 AM

this is the command I tried:
mknod /dev/ttyS4 -m 666 c 4 64

it looks like it created it under /dev and my c program can open the port and write to it without errors, but I'm still not getting any output out of the physical port. I don't understand what the major and minor numbers are for. 4 and 64? is that what they should be to point to the right hardware?

farslayer 09-23-2007 03:12 AM

man ttyS

Code:

ttyS[0-3] are character devices for the serial terminal lines.

      They are typically created by:

              mknod -m 660 /dev/ttyS0 c 4 64 # base address 0x3f8
              mknod -m 660 /dev/ttyS1 c 4 65 # base address 0x2f8
              mknod -m 660 /dev/ttyS2 c 4 66 # base address 0x3e8
              mknod -m 660 /dev/ttyS3 c 4 67 # base address 0x2e8
              chown root:tty /dev/ttyS[0-3]

The "major" number is always 4 for ttyS devices.
For ttyS serial ports the minor number is: 64 + port number.


so you need to use 68, 69, 70 & 71 when adding the additional ports

MAKEDEV may be easier to use than mknod

man MAKEDEV

MAKEDEV ttyS4
MAKEDEV ttyS5
MAKEDEV ttyS6
MAKEDEV ttyS7

mattsoftnet 09-23-2007 03:38 AM

ooh, thank you for explaining that. now it sounds like it will work. I'm just finishing up a fresh install of centos on my development system. I will try it and let you know how it goes.

btw, I used mknod because MAKEDEV wasn't installed. I will check yum for it and see if I can install it.

mattsoftnet 09-23-2007 04:13 AM

centos found the serial card and installed all 8 ports, including the 2 on the motherboard I'm guessing. I haven't tried the motherboard 2 lately, but the ports on the card aren't giving any errors when I open them or send data to them, but the device I'm using has a led on it that turns on or off when it gets a command, and it's not working yet. the device has to run at 9600 baud rate. I think that might be where the problem is. maybe this card gets it's settings differently or something. I still don't understand c completely yet, but I'll keep working at it. tomorrow I'll try connecting the ports on the card to my windows computer and see if I can get any signals with the hyperterminal.


All times are GMT -5. The time now is 12:37 AM.