본문 바로가기

카테고리 없음

Linux Serial Loopback Test Program

Serial HOWTO: Serial Port Devices /dev/ttyS2, etc.Common serial port names are /dev/ttyS0, /dev/ttyS1, etc. Thenaround the year 2000 came the USB bus with names like /dev/ttyUSB0 and/dev/ttyACM1 (for the ACM modem on the USB bus). Multiport serialcard used somewhat differnt names (depending on the brand) such as/dev/ttyE5.Since DOS provided for 4 serial ports on the old ISA bus:COM1-COM4, or ttyS0-ttyS3 in Linux, most serial ports on the newer PCIbus used higher numbers such as ttyS4 or ttyS14 (prior to kernel2.6.13). But since most PCs only came with one or two serial ports,ttyS0 and possibly ttyS1 (for the second port) the PCI bus can now usettyS2 (kernel 2.6.15 on).

All this permits one to have both ISAserial ports and PCI serial ports on the same PC with no nameconflicts. 0-1 (or 0-3) are reserved for the old ISA bus (or thenewer LPC bus) and 2-upward (or 4-upward or 14-upward) are used forPCI, where older schemes are shown in parentheses. It's not requiredto be this way but it often is.If you're using udev (which puts only the device you have on yourcomputer into the /dev directory at boottime) then there's an easy wayto change the device names by editing files in /etc/udev/. Forexample, to change the name of what the kernel detects as ttyS3 towhat you want to name it: ttyS14, add a line similar to this to/etc/udev/udev.rulesBUS'pci' KERNEL'ttyS3',NAME='ttyS14'On-board serial ports on motherboards which have both PCI and ISAslots are likely to still be ISA ports. Even for all-PCI-slotmotherboards, the serial ports are often not PCI.

Minicom loopback testLinux serial loopback test program online

Instead, they areeither ISA, on an internal ISA bus or on a LPC bus which is intendedfor slow legacy I/O devices: serial/parallel ports and floppy drives.Devices in Linux have major and minor numbers. The serial portttySx (x=0,1,2, etc.) is major number 4. You can see this (and theminor numbers too) by typing: 'ls -l ttyS.'

in the /dev directory. Tofind the device names for various devices, see the 'devices' file inthe kernel documentation.There formerly was a 'cua' name for each serial port and it behavedjust a little differently. For example, ttyS2 would correspond tocua2.

It was mainly used for modems. The cua major number was 5 andminor numbers started at 64.

Serial Loopback Test Software

You may still have the cua devices inyour /dev directory but they are now deprecated. For details seeModem-HOWTO, section: cua Device Obsolete.For creating the old devices in the device directory see:Dos/Windows use the COM name while the messages from the serial driveruse ttyS00, ttyS01, etc. Older serial drivers (2001?) used justtty00, tty01, etc.The tables below shows some examples of serial device names.

I have a serial device set up as loopback (meaning it will simply echo back any character it receives), and I'd like to measure effective throughput speed. For this, I hoped I could use time, as in time bash -c '.' Would be some command I could run.Now, the first problem is that I want to use the device at 2000000 bps, so I cannot use or (they both seem to go up to 115200 bps only).