moxa-smartio 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. =============================================================================
  2. MOXA Smartio/Industio Family Device Driver Installation Guide
  3. for Linux Kernel 2.4.x, 2.6.x
  4. Copyright (C) 2008, Moxa Inc.
  5. =============================================================================
  6. Date: 01/21/2008
  7. Content
  8. 1. Introduction
  9. 2. System Requirement
  10. 3. Installation
  11. 3.1 Hardware installation
  12. 3.2 Driver files
  13. 3.3 Device naming convention
  14. 3.4 Module driver configuration
  15. 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x.
  16. 3.6 Custom configuration
  17. 3.7 Verify driver installation
  18. 4. Utilities
  19. 5. Setserial
  20. 6. Troubleshooting
  21. -----------------------------------------------------------------------------
  22. 1. Introduction
  23. The Smartio/Industio/UPCI family Linux driver supports following multiport
  24. boards.
  25. - 2 ports multiport board
  26. CP-102U, CP-102UL, CP-102UF
  27. CP-132U-I, CP-132UL,
  28. CP-132, CP-132I, CP132S, CP-132IS,
  29. CI-132, CI-132I, CI-132IS,
  30. (C102H, C102HI, C102HIS, C102P, CP-102, CP-102S)
  31. - 4 ports multiport board
  32. CP-104EL,
  33. CP-104UL, CP-104JU,
  34. CP-134U, CP-134U-I,
  35. C104H/PCI, C104HS/PCI,
  36. CP-114, CP-114I, CP-114S, CP-114IS, CP-114UL,
  37. C104H, C104HS,
  38. CI-104J, CI-104JS,
  39. CI-134, CI-134I, CI-134IS,
  40. (C114HI, CT-114I, C104P)
  41. POS-104UL,
  42. CB-114,
  43. CB-134I
  44. - 8 ports multiport board
  45. CP-118EL, CP-168EL,
  46. CP-118U, CP-168U,
  47. C168H/PCI,
  48. C168H, C168HS,
  49. (C168P),
  50. CB-108
  51. This driver and installation procedure have been developed upon Linux Kernel
  52. 2.4.x and 2.6.x. This driver supports Intel x86 hardware platform. In order
  53. to maintain compatibility, this version has also been properly tested with
  54. RedHat, Mandrake, Fedora and S.u.S.E Linux. However, if compatibility problem
  55. occurs, please contact Moxa at support@moxa.com.tw.
  56. In addition to device driver, useful utilities are also provided in this
  57. version. They are
  58. - msdiag Diagnostic program for displaying installed Moxa
  59. Smartio/Industio boards.
  60. - msmon Monitor program to observe data count and line status signals.
  61. - msterm A simple terminal program which is useful in testing serial
  62. ports.
  63. - io-irq.exe Configuration program to setup ISA boards. Please note that
  64. this program can only be executed under DOS.
  65. All the drivers and utilities are published in form of source code under
  66. GNU General Public License in this version. Please refer to GNU General
  67. Public License announcement in each source code file for more detail.
  68. In Moxa's Web sites, you may always find latest driver at http://www.moxa.com/.
  69. This version of driver can be installed as Loadable Module (Module driver)
  70. or built-in into kernel (Static driver). You may refer to following
  71. installation procedure for suitable one. Before you install the driver,
  72. please refer to hardware installation procedure in the User's Manual.
  73. We assume the user should be familiar with following documents.
  74. - Serial-HOWTO
  75. - Kernel-HOWTO
  76. -----------------------------------------------------------------------------
  77. 2. System Requirement
  78. - Hardware platform: Intel x86 machine
  79. - Kernel version: 2.4.x or 2.6.x
  80. - gcc version 2.72 or later
  81. - Maximum 4 boards can be installed in combination
  82. -----------------------------------------------------------------------------
  83. 3. Installation
  84. 3.1 Hardware installation
  85. 3.2 Driver files
  86. 3.3 Device naming convention
  87. 3.4 Module driver configuration
  88. 3.5 Static driver configuration for Linux kernel 2.4.x, 2.6.x.
  89. 3.6 Custom configuration
  90. 3.7 Verify driver installation
  91. 3.1 Hardware installation
  92. There are two types of buses, ISA and PCI, for Smartio/Industio
  93. family multiport board.
  94. ISA board
  95. ---------
  96. You'll have to configure CAP address, I/O address, Interrupt Vector
  97. as well as IRQ before installing this driver. Please refer to hardware
  98. installation procedure in User's Manual before proceed any further.
  99. Please make sure the JP1 is open after the ISA board is set properly.
  100. PCI/UPCI board
  101. --------------
  102. You may need to adjust IRQ usage in BIOS to avoid from IRQ conflict
  103. with other ISA devices. Please refer to hardware installation
  104. procedure in User's Manual in advance.
  105. PCI IRQ Sharing
  106. -----------
  107. Each port within the same multiport board shares the same IRQ. Up to
  108. 4 Moxa Smartio/Industio PCI Family multiport boards can be installed
  109. together on one system and they can share the same IRQ.
  110. 3.2 Driver files
  111. The driver file may be obtained from ftp, CD-ROM or floppy disk. The
  112. first step, anyway, is to copy driver file "mxser.tgz" into specified
  113. directory. e.g. /moxa. The execute commands as below.
  114. # cd /
  115. # mkdir moxa
  116. # cd /moxa
  117. # tar xvf /dev/fd0
  118. or
  119. # cd /
  120. # mkdir moxa
  121. # cd /moxa
  122. # cp /mnt/cdrom/<driver directory>/mxser.tgz .
  123. # tar xvfz mxser.tgz
  124. 3.3 Device naming convention
  125. You may find all the driver and utilities files in /moxa/mxser.
  126. Following installation procedure depends on the model you'd like to
  127. run the driver. If you prefer module driver, please refer to 3.4.
  128. If static driver is required, please refer to 3.5.
  129. Dialin and callout port
  130. -----------------------
  131. This driver remains traditional serial device properties. There are
  132. two special file name for each serial port. One is dial-in port
  133. which is named "ttyMxx". For callout port, the naming convention
  134. is "cumxx".
  135. Device naming when more than 2 boards installed
  136. -----------------------------------------------
  137. Naming convention for each Smartio/Industio multiport board is
  138. pre-defined as below.
  139. Board Num. Dial-in Port Callout port
  140. 1st board ttyM0 - ttyM7 cum0 - cum7
  141. 2nd board ttyM8 - ttyM15 cum8 - cum15
  142. 3rd board ttyM16 - ttyM23 cum16 - cum23
  143. 4th board ttyM24 - ttym31 cum24 - cum31
  144. !!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  145. Under Kernel 2.6 the cum Device is Obsolete. So use ttyM*
  146. device instead.
  147. !!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  148. Board sequence
  149. --------------
  150. This driver will activate ISA boards according to the parameter set
  151. in the driver. After all specified ISA board activated, PCI board
  152. will be installed in the system automatically driven.
  153. Therefore the board number is sorted by the CAP address of ISA boards.
  154. For PCI boards, their sequence will be after ISA boards and C168H/PCI
  155. has higher priority than C104H/PCI boards.
  156. 3.4 Module driver configuration
  157. Module driver is easiest way to install. If you prefer static driver
  158. installation, please skip this paragraph.
  159. ------------- Prepare to use the MOXA driver--------------------
  160. 3.4.1 Create tty device with correct major number
  161. Before using MOXA driver, your system must have the tty devices
  162. which are created with driver's major number. We offer one shell
  163. script "msmknod" to simplify the procedure.
  164. This step is only needed to be executed once. But you still
  165. need to do this procedure when:
  166. a. You change the driver's major number. Please refer the "3.7"
  167. section.
  168. b. Your total installed MOXA boards number is changed. Maybe you
  169. add/delete one MOXA board.
  170. c. You want to change the tty name. This needs to modify the
  171. shell script "msmknod"
  172. The procedure is:
  173. # cd /moxa/mxser/driver
  174. # ./msmknod
  175. This shell script will require the major number for dial-in
  176. device and callout device to create tty device. You also need
  177. to specify the total installed MOXA board number. Default major
  178. numbers for dial-in device and callout device are 30, 35. If
  179. you need to change to other number, please refer section "3.7"
  180. for more detailed procedure.
  181. Msmknod will delete any special files occupying the same device
  182. naming.
  183. 3.4.2 Build the MOXA driver and utilities
  184. Before using the MOXA driver and utilities, you need compile the
  185. all the source code. This step is only need to be executed once.
  186. But you still re-compile the source code if you modify the source
  187. code. For example, if you change the driver's major number (see
  188. "3.7" section), then you need to do this step again.
  189. Find "Makefile" in /moxa/mxser, then run
  190. # make clean; make install
  191. !!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!
  192. For Red Hat 9, Red Hat Enterprise Linux AS3/ES3/WS3 & Fedora Core1:
  193. # make clean; make installsp1
  194. For Red Hat Enterprise Linux AS4/ES4/WS4:
  195. # make clean; make installsp2
  196. !!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!
  197. The driver files "mxser.o" and utilities will be properly compiled
  198. and copied to system directories respectively.
  199. ------------- Load MOXA driver--------------------
  200. 3.4.3 Load the MOXA driver
  201. # modprobe mxser <argument>
  202. will activate the module driver. You may run "lsmod" to check
  203. if "mxser" is activated. If the MOXA board is ISA board, the
  204. <argument> is needed. Please refer to section "3.4.5" for more
  205. information.
  206. ------------- Load MOXA driver on boot --------------------
  207. 3.4.4 For the above description, you may manually execute
  208. "modprobe mxser" to activate this driver and run
  209. "rmmod mxser" to remove it.
  210. However, it's better to have a boot time configuration to
  211. eliminate manual operation. Boot time configuration can be
  212. achieved by rc file. We offer one "rc.mxser" file to simplify
  213. the procedure under "moxa/mxser/driver".
  214. But if you use ISA board, please modify the "modprobe ..." command
  215. to add the argument (see "3.4.5" section). After modifying the
  216. rc.mxser, please try to execute "/moxa/mxser/driver/rc.mxser"
  217. manually to make sure the modification is ok. If any error
  218. encountered, please try to modify again. If the modification is
  219. completed, follow the below step.
  220. Run following command for setting rc files.
  221. # cd /moxa/mxser/driver
  222. # cp ./rc.mxser /etc/rc.d
  223. # cd /etc/rc.d
  224. Check "rc.serial" is existed or not. If "rc.serial" doesn't exist,
  225. create it by vi, run "chmod 755 rc.serial" to change the permission.
  226. Add "/etc/rc.d/rc.mxser" in last line,
  227. Reboot and check if moxa.o activated by "lsmod" command.
  228. 3.4.5. If you'd like to drive Smartio/Industio ISA boards in the system,
  229. you'll have to add parameter to specify CAP address of given
  230. board while activating "mxser.o". The format for parameters are
  231. as follows.
  232. modprobe mxser ioaddr=0x???,0x???,0x???,0x???
  233. | | | |
  234. | | | +- 4th ISA board
  235. | | +------ 3rd ISA board
  236. | +------------ 2nd ISA board
  237. +------------------- 1st ISA board
  238. 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x
  239. Note: To use static driver, you must install the linux kernel
  240. source package.
  241. 3.5.1 Backup the built-in driver in the kernel.
  242. # cd /usr/src/linux/drivers/char
  243. # mv mxser.c mxser.c.old
  244. For Red Hat 7.x user, you need to create link:
  245. # cd /usr/src
  246. # ln -s linux-2.4 linux
  247. 3.5.2 Create link
  248. # cd /usr/src/linux/drivers/char
  249. # ln -s /moxa/mxser/driver/mxser.c mxser.c
  250. 3.5.3 Add CAP address list for ISA boards. For PCI boards user,
  251. please skip this step.
  252. In module mode, the CAP address for ISA board is given by
  253. parameter. In static driver configuration, you'll have to
  254. assign it within driver's source code. If you will not
  255. install any ISA boards, you may skip to next portion.
  256. The instructions to modify driver source code are as
  257. below.
  258. a. # cd /moxa/mxser/driver
  259. # vi mxser.c
  260. b. Find the array mxserBoardCAP[] as below.
  261. static int mxserBoardCAP[]
  262. = {0x00, 0x00, 0x00, 0x00};
  263. c. Change the address within this array using vi. For
  264. example, to driver 2 ISA boards with CAP address
  265. 0x280 and 0x180 as 1st and 2nd board. Just to change
  266. the source code as follows.
  267. static int mxserBoardCAP[]
  268. = {0x280, 0x180, 0x00, 0x00};
  269. 3.5.4 Setup kernel configuration
  270. Configure the kernel:
  271. # cd /usr/src/linux
  272. # make menuconfig
  273. You will go into a menu-driven system. Please select [Character
  274. devices][Non-standard serial port support], enable the [Moxa
  275. SmartIO support] driver with "[*]" for built-in (not "[M]"), then
  276. select [Exit] to exit this program.
  277. 3.5.5 Rebuild kernel
  278. The following are for Linux kernel rebuilding, for your
  279. reference only.
  280. For appropriate details, please refer to the Linux document.
  281. a. cd /usr/src/linux
  282. b. make clean /* take a few minutes */
  283. c. make dep /* take a few minutes */
  284. d. make bzImage /* take probably 10-20 minutes */
  285. e. make install /* copy boot image to correct position */
  286. f. Please make sure the boot kernel (vmlinuz) is in the
  287. correct position.
  288. g. If you use 'lilo' utility, you should check /etc/lilo.conf
  289. 'image' item specified the path which is the 'vmlinuz' path,
  290. or you will load wrong (or old) boot kernel image (vmlinuz).
  291. After checking /etc/lilo.conf, please run "lilo".
  292. Note that if the result of "make bzImage" is ERROR, then you have to
  293. go back to Linux configuration Setup. Type "make menuconfig" in
  294. directory /usr/src/linux.
  295. 3.5.6 Make tty device and special file
  296. # cd /moxa/mxser/driver
  297. # ./msmknod
  298. 3.5.7 Make utility
  299. # cd /moxa/mxser/utility
  300. # make clean; make install
  301. 3.5.8 Reboot
  302. 3.6 Custom configuration
  303. Although this driver already provides you default configuration, you
  304. still can change the device name and major number. The instruction to
  305. change these parameters are shown as below.
  306. Change Device name
  307. ------------------
  308. If you'd like to use other device names instead of default naming
  309. convention, all you have to do is to modify the internal code
  310. within the shell script "msmknod". First, you have to open "msmknod"
  311. by vi. Locate each line contains "ttyM" and "cum" and change them
  312. to the device name you desired. "msmknod" creates the device names
  313. you need next time executed.
  314. Change Major number
  315. -------------------
  316. If major number 30 and 35 had been occupied, you may have to select
  317. 2 free major numbers for this driver. There are 3 steps to change
  318. major numbers.
  319. 3.6.1 Find free major numbers
  320. In /proc/devices, you may find all the major numbers occupied
  321. in the system. Please select 2 major numbers that are available.
  322. e.g. 40, 45.
  323. 3.6.2 Create special files
  324. Run /moxa/mxser/driver/msmknod to create special files with
  325. specified major numbers.
  326. 3.6.3 Modify driver with new major number
  327. Run vi to open /moxa/mxser/driver/mxser.c. Locate the line
  328. contains "MXSERMAJOR". Change the content as below.
  329. #define MXSERMAJOR 40
  330. #define MXSERCUMAJOR 45
  331. 3.6.4 Run "make clean; make install" in /moxa/mxser/driver.
  332. 3.7 Verify driver installation
  333. You may refer to /var/log/messages to check the latest status
  334. log reported by this driver whenever it's activated.
  335. -----------------------------------------------------------------------------
  336. 4. Utilities
  337. There are 3 utilities contained in this driver. They are msdiag, msmon and
  338. msterm. These 3 utilities are released in form of source code. They should
  339. be compiled into executable file and copied into /usr/bin.
  340. Before using these utilities, please load driver (refer 3.4 & 3.5) and
  341. make sure you had run the "msmknod" utility.
  342. msdiag - Diagnostic
  343. --------------------
  344. This utility provides the function to display what Moxa Smartio/Industio
  345. board found by driver in the system.
  346. msmon - Port Monitoring
  347. -----------------------
  348. This utility gives the user a quick view about all the MOXA ports'
  349. activities. One can easily learn each port's total received/transmitted
  350. (Rx/Tx) character count since the time when the monitoring is started.
  351. Rx/Tx throughputs per second are also reported in interval basis (e.g.
  352. the last 5 seconds) and in average basis (since the time the monitoring
  353. is started). You can reset all ports' count by <HOME> key. <+> <->
  354. (plus/minus) keys to change the displaying time interval. Press <ENTER>
  355. on the port, that cursor stay, to view the port's communication
  356. parameters, signal status, and input/output queue.
  357. msterm - Terminal Emulation
  358. ---------------------------
  359. This utility provides data sending and receiving ability of all tty ports,
  360. especially for MOXA ports. It is quite useful for testing simple
  361. application, for example, sending AT command to a modem connected to the
  362. port or used as a terminal for login purpose. Note that this is only a
  363. dumb terminal emulation without handling full screen operation.
  364. -----------------------------------------------------------------------------
  365. 5. Setserial
  366. Supported Setserial parameters are listed as below.
  367. uart set UART type(16450-->disable FIFO, 16550A-->enable FIFO)
  368. close_delay set the amount of time(in 1/100 of a second) that DTR
  369. should be kept low while being closed.
  370. closing_wait set the amount of time(in 1/100 of a second) that the
  371. serial port should wait for data to be drained while
  372. being closed, before the receiver is disable.
  373. spd_hi Use 57.6kb when the application requests 38.4kb.
  374. spd_vhi Use 115.2kb when the application requests 38.4kb.
  375. spd_shi Use 230.4kb when the application requests 38.4kb.
  376. spd_warp Use 460.8kb when the application requests 38.4kb.
  377. spd_normal Use 38.4kb when the application requests 38.4kb.
  378. spd_cust Use the custom divisor to set the speed when the
  379. application requests 38.4kb.
  380. divisor This option set the custom division.
  381. baud_base This option set the base baud rate.
  382. -----------------------------------------------------------------------------
  383. 6. Troubleshooting
  384. The boot time error messages and solutions are stated as clearly as
  385. possible. If all the possible solutions fail, please contact our technical
  386. support team to get more help.
  387. Error msg: More than 4 Moxa Smartio/Industio family boards found. Fifth board
  388. and after are ignored.
  389. Solution:
  390. To avoid this problem, please unplug fifth and after board, because Moxa
  391. driver supports up to 4 boards.
  392. Error msg: Request_irq fail, IRQ(?) may be conflict with another device.
  393. Solution:
  394. Other PCI or ISA devices occupy the assigned IRQ. If you are not sure
  395. which device causes the situation, please check /proc/interrupts to find
  396. free IRQ and simply change another free IRQ for Moxa board.
  397. Error msg: Board #: C1xx Series(CAP=xxx) interrupt number invalid.
  398. Solution:
  399. Each port within the same multiport board shares the same IRQ. Please set
  400. one IRQ (IRQ doesn't equal to zero) for one Moxa board.
  401. Error msg: No interrupt vector be set for Moxa ISA board(CAP=xxx).
  402. Solution:
  403. Moxa ISA board needs an interrupt vector.Please refer to user's manual
  404. "Hardware Installation" chapter to set interrupt vector.
  405. Error msg: Couldn't install MOXA Smartio/Industio family driver!
  406. Solution:
  407. Load Moxa driver fail, the major number may conflict with other devices.
  408. Please refer to previous section 3.7 to change a free major number for
  409. Moxa driver.
  410. Error msg: Couldn't install MOXA Smartio/Industio family callout driver!
  411. Solution:
  412. Load Moxa callout driver fail, the callout device major number may
  413. conflict with other devices. Please refer to previous section 3.7 to
  414. change a free callout device major number for Moxa driver.
  415. -----------------------------------------------------------------------------