How can I know which serial port corresponds to a PCI card?

5,369

You can use lspci -v to list PCI device information, along with their IRQs. Correlate the IRQ listed via lspci with the setserial info you already gathered, and that should tell you what tty matches which PCI card.

Also, if the port is disabled, you can enable it using setpci. More info on how to determine that, and how to enable it, can be found here: http://www.tldp.org/HOWTO/Serial-HOWTO-8.html#ss8.7

If the port communicates via an IO address then "lspci -vv" should show "Control: I/O+ ..." with + meaning that the IO address is enabled. If it shows "I/O-" (and "I/O ports at ... [disabled]") then you may need to use the setpci command to enable it. For example "setpci -d 151f:000 command=101". 151f is the vendor id, and 000 is the device id both obtained from "lspci -n -v" or from /proc/bus/pci or from "scanpci -v". The "command=101" means that 101 is put into the command register which is the same as the "Control" register displayed by "lspci". The 101h sets two bits: the 1 sets I/O to + and the 100 part keeps SERR# set to +. In this case only the SERR# bit of the Control register was initially observed to be + when the lspci command was run. So we kept it enabled to + by setting bit 8 (where bit 0 is I/O) to 1 by the first 1 in 101. Some serial cards don't use SERR# so if you see SERR#- then there's no need to enable it so then use: command=1. Then you'll need to set up "setserial" to tell the driver the IO and IRQ.

Per the documentation for Telit, looks like that 3G modem does ACM. Check to see if you have /dev/ttyACM* devices. If so, per the documentation you can use those to send AT commands. The documenation also has instructions on how to load the kernel module, if it isn't already loaded. http://teleorigin.com/file_upl/pliki/1/Telit_HE910_HE863_GE910_UL865_Linux_Driver_UserGuide_r2.pdf

Of those only the following devices can be used:

/dev/ttyACM0: data port for PPP connections and AT commands

/dev/ttyACM3: generic port for AT commands

Share:
5,369

Related videos on Youtube

galaxy
Author by

galaxy

I'm a Software Engineer specialized in JavaEE and Angular Development orientated to design and good practices. Self-taught enthusiast and obsessed with trying out new technologies.

Updated on September 18, 2022

Comments

  • galaxy
    galaxy almost 2 years

    I have a vehicle computer with a internal 3G PCIe card for cellular communications, but I can't figure out which serial port I have to use in order to send AT commands.

    This computer also includes a GPS onboard where I can access very well through /dev/ttyS5 with a speed of 9600. I have been reading some documents and I have seen that the 3G card speed should be 115200. This 3G PCI card is a "Telit HE910 Mini PCIe data card" and I'm running on Ubuntu 14.04.

    Also, I have been trying to open a serial com with n (0...5) ports as below without results:

    stty -F /dev/ttySn ispeed 115200 && cat </dev/ttySn
    

    Executing sudo setserial -g /dev/ttyS[012345] it yields:

    /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4  
    /dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3  
    /dev/ttyS2, UART: 16550A, Port: 0x03e8, IRQ: 5  
    /dev/ttyS3, UART: 16550A, Port: 0x02e8, IRQ: 7  
    /dev/ttyS4, UART: 16550A, Port: 0x02f0, IRQ: 11  
    /dev/ttyS5, UART: 16550A, Port: 0x02e0, IRQ: 10
    

    Please, help to figure out how to access this 3G card through a serial port to send AT commands.

  • galaxy
    galaxy almost 9 years
    There is no IRQs listed via lspci on PCI bridges.
  • galaxy
    galaxy almost 9 years
    I have run lspci -vv and all PCI bridges listed have this "Control: I/O+". I don't know if I have to see it in PCI bridges or in other devices.
  • alienth
    alienth almost 9 years
    I found some documentation on that modem and added extra info to the answer. If the /dev/ttyACM* devices are missing, you may just need to load a kernel module, cdc-adm, which I've confirmed exists in the kernel provided by Ubuntu 14.04.
  • galaxy
    galaxy almost 9 years
    Thank you so much @alienth, you really help me. There won't need to load the kernel module, I could use /dev/ttyACM3 to send AT commands and they were successful.