In order to achieve higher speed it is necessary to use some UART integrated extension cards. The current drivers support PCI based cards integrating the OX16C954 chip, probably the fastest UART integrated circuit with a PCI interface on the market. It is a high performance UART with 128 byte FIFOs by Oxford Semiconductor. The IC integrates a 16C550 compatible UART offering an ample FIFO size and many other interesting features. One of the most important features is the maximal bus speed of 15 Mbit/s in normal mode and 60 Mbit/s in external clock mode.
Using this IC the drivers achieve a communication speed of 12 Mbit/s, the maximal speed of Profibus DP. The PCI card contains up to four ports so four Profibus stations are available simultaneously. The PCI card does not allow usage in the Bit analyzer mode at the moment as there is no built-in hardware support (will be added).
[OX16PCI954 integrated PCI card]
OX16PCI954 integrated PCI card
OX16PCI954 integrated PCI card
Remove all drivers occupying the serial device
rmmod 8250_pnp
rmmod 8250_pci
rmmod 8250
rmmod serial_core
Make sure you have not compiled these drivers into the kernel but should use modules instead. If so, you have to update the kernel configuration and then recompile it. Serial drivers you can find in the section Device Drivers -> Character devices -> Serial drivers in the kernel configuration.
I use to put these drivers to the module blacklist /etc/modprobe.d/blacklist so the starting scripts will not try to modprobe them. I use Debian Linux 4.0 so please refer to the documentation of your distribution if you could not find this file.
blacklist 8250_pci blacklist 8250_pnp blacklist 8250 blacklist serial_core
To minimize the latency and to achieve the best performance, make sure your card is not sharing the interrupt with any other hardware. You can check it by looking at the /proc/interrupts file. If the interrupt is shared, try to place your card at another PCI slot if it is available.
cat /proc/interrupts
Compile drivers with the following commands
tar xvzf pbmaster_<version>.tgz
cd pbmaster_<version>/src/pbm_drv
make</version></version>
The modules are compiled so everything is prepared to be used now. Continue installing the modules using the standard utility insmod(8). First, you have to install the modules pbmcore and pbm_fdl. The first module provides Profibus functionalities, the latter provides an interface between user's applications and the drivers.
insmod pbmcore.ko
insmod pbm_fdl.ko
Use command lsmod(8) to make sure that the modules have been loaded
lsmod
Every chip module cares about the communication with one physical hardware and every has its own configuration. This means every chip module can represents separated stations on the fieldbus. Use the utility modinfo(1) to show all module available parameters. The supported parameters are described in details in the section Module's parameters.
modinfo pbm_950pci.ko
filename: pbm_950pci.ko
license: GPL
author: Copyright(c) 2006-2008 Tran Duy Khanh
description: Profibus Master Serial Device Driver
version: 0.2.0
srcversion: D10D2E8372449087C592F49
alias: pci:v00001760d00008004svsdbcsci
alias: pci:v00001415d0000950Asvsdbcsci
depends: pbmcore
vermagic: 2.6.24 mod_unload K8
parm: nodes:Node parameters (array of charp)
Installing a chip module (using default parameters)
insmod pbm_950pci.ko
Install the first channel of the first card in master mode running at 1.5Mbps, master address will be set to 12 (the major number is dynamically allocated and minor number is allocated by the pbmcore module. Both numbers can be found in /var/log/messages after the installation of pbm_fdl and chip modules respectively)
insmod pbm_950pci.ko nodes="0:0:0:1500000:12"
You should see something like this in your log file (/var/log/message, /var/log/kern.log or dmesg(8) alternatively)
pbm_950pci: PCI device found at slot 0000:00:09.0 (IRQ=16)
ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:00:09.0 to 64
pbmcore: chip registered: pbm_950pci (minor=0)
pbm_950pci: serial controller Oxford Semiconductor Ltd EXSYS EX-41092 Dual 16950 Serial adapter (FIFO length: 127B) or its compatibles
pbmcore: pbm_950pci(0): mode master
pbm_950pci: baud rate setup: 1500000bps
pbm_950pci(0)(TS=12): LAS(1): 5 GAPL(119) (PS=5 TS=12 NS=5 HSA=11): 0 1 2 3 4 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
From the above messages you can see there is another master with address 5 connected to the bus (This Station = our master = 5; Previous Station = 5; Next Station = 5). Bus reinitialization didn't occur because our master indicated activity on the bus and waited for token passing to start the communication. The network baud rate is 1.5Mbps. Check the interrupts to be sure that it is running. There should be a line with interrupt number of our serial interface:
$ cat /proc/interrupts
CPU0
0: 64 IO-APIC-edge timer
1: 62761 IO-APIC-edge i8042
4: 9628520 IO-APIC-edge
16: 46210221 IO-APIC-fasteoi pbm_950pci <-------------- the IRQ counter should increase constantly
In order to install the drivers, you can use the prepared scripts/install.sh to do so. Installing drivers you will be able to load modules with the modprobe(8) command:
modprobe pbm_950pci
In order to set other parameters of the node please refer to the Module's parameters page
In order to be able to send requests respectively receive responses from the bus we have to create a character device. The device is an interface between user's application and device drivers. It works like a raw device of the Profibus frames. You can write frames of requests to this device and then read incoming responses. Find out the dynamically allocated major and minor numbers in /var/log/messages. At the last step, use mknod(1) to make a node with appropriated major and minor number (in this example the minor number is 0). Considering the major number has value 254, the node can be created like this (or you can use the script scripts/mkdev.sh instead to have life easier):
mknod /dev/pbmaster0 c 254 0
Consider a file named framedump, which contains frames of requests in raw form (saved in bytes). We can send them to the bus using the cat(1) command.
cat framedump > /dev/pbmaster0