README.md 6.68 KB
Newer Older
1
# Beam Position Monitor Software
Lucas Russo's avatar
Lucas Russo committed
2

3
Software for controlling the AFC BPM boards
Lucas Russo's avatar
Lucas Russo committed
4

5
## Prerequisites:
Lucas Russo's avatar
Lucas Russo committed
6

7
Make sure you have the following libraries installed: 
Lucas Russo's avatar
Lucas Russo committed
8

9 10
* zeromq-4.0.4 (http://zeromq.org/area:download)
* czmq-2.1.0 (http://czmq.zeromq.org/page:get-the-software)
Lucas Russo's avatar
Lucas Russo committed
11

12
Cloning this repository
Lucas Russo's avatar
Lucas Russo committed
13

14
	git clone --recursive https://github.com/lerwys/bpm-software.git
Lucas Russo's avatar
Lucas Russo committed
15

16
Install the Majordomo application from this repository (autotools-based)
Lucas Russo's avatar
Lucas Russo committed
17

18
	cd majordomo/libmdp
19

20
Execute the traditional sequence of autotools commands:
21

22
	./autogen.sh && make && sudo make install
23

24
## PCIe Installation Instructions
25

26
Install linux header files
Lucas Russo's avatar
Lucas Russo committed
27

28
	sudo apt-get install linux-headers-generic
Lucas Russo's avatar
Lucas Russo committed
29

30
Install the GIT package
Lucas Russo's avatar
Lucas Russo committed
31

32
	sudo apt-get install binutils gcc
Lucas Russo's avatar
Lucas Russo committed
33

34
Change folder to the pcie driver location
Lucas Russo's avatar
Lucas Russo committed
35

36
	cd kernel
Lucas Russo's avatar
Lucas Russo committed
37

38
Compile the PCIe driver and its tests
Lucas Russo's avatar
Lucas Russo committed
39

40
	make
Lucas Russo's avatar
Lucas Russo committed
41

42
Install the PCIe drivers and libraries
Lucas Russo's avatar
Lucas Russo committed
43

44
	sudo make install
Lucas Russo's avatar
Lucas Russo committed
45

46
Load the Driver module
Lucas Russo's avatar
Lucas Russo committed
47

48
	sudo insmod /lib/modules/$(uname -r)/extra/PciDriver.ko
Lucas Russo's avatar
Lucas Russo committed
49

50 51
After this the kernel should have found the FPGA board 
and initialized it. Run the following command and check its output
Lucas Russo's avatar
Lucas Russo committed
52

53
	dmesg | tail
Lucas Russo's avatar
Lucas Russo committed
54

55
You should see something like the excerpt below:
Lucas Russo's avatar
Lucas Russo committed
56

57 58 59 60 61 62 63 64 65 66
	[267002.495109] pciDriver - pcidriver_init : 
		Major 250 allocated to nodename 'fpga'
	[267002.495130] pciDriver - pcidriver_probe : 
		Found ML605 board at 0000:01:00.0
	[267002.495224] pciDriver - pcidriver_probe : 
		Device /dev/fpga0 added
	[267002.495434] pciDriver - pcidriver_probe_irq : 
		Registered Interrupt Handler at pin 1, line 11, IRQ 16
	[267002.495450] pciDriver - pcidriver_init : 
		Module loaded
Lucas Russo's avatar
Lucas Russo committed
67

68
## Running the PCIe self-test
Lucas Russo's avatar
Lucas Russo committed
69

70 71 72
After the installation of the PCIe driver (see above) 
it is possible to run a self test to check if 
everything is setup properly. For this run the following:
Lucas Russo's avatar
Lucas Russo committed
73

74
Change to the "compiled tests folder"
Lucas Russo's avatar
Lucas Russo committed
75

76
	cd tests/pcie/bin
Lucas Russo's avatar
Lucas Russo committed
77

78
Run the test entitled "testPciDriverMod"
Lucas Russo's avatar
Lucas Russo committed
79

80
	sudo ./testPciDriverMod
Lucas Russo's avatar
Lucas Russo committed
81

82
You should get an output like the following, if everythig is ok:
Lucas Russo's avatar
Lucas Russo committed
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175

        Testing OPEN DEVICE... PASSED!
         Testing PCIDRIVER_IOC_MMAP_MODE... PASSED!
         Testing PCIDRIVER_IOC_MMAP_AREA... PASSED!
         Testing PCIDRIVER_IOC_PCI_INFO...  PASSED!
         Testing PCI CONFIG... 
           Reading PCI config area in byte mode ... PASSED!
           Reading PCI config area in word mode ... PASSED!
           Reading PCI config area in double-word mode ... PASSED!
         Testing PCI mmap... 
           Reading PCI info... PASSED!
           Setting mmap mode... PASSED!
           Setting mmap area... PASSED!
           MMAP'ing BAR0... PASSED!
           Setting mmap area... PASSED!
           MMAP'ing BAR2... PASSED!
           Setting mmap area... PASSED!
           MMAP'ing BAR4... PASSED!
         Testing PCIDRIVER_IOC_KMEM_ALLOC...
           alloc size    1024 :  PASSED!
           alloc size    2048 :  PASSED!
           alloc size    4096 :  PASSED!
           alloc size    8192 :  PASSED!
           alloc size   16384 :  PASSED!
           alloc size   32768 :  PASSED!
           alloc size   65536 :  PASSED!
           alloc size  131072 :  PASSED!
           alloc size  262144 :  PASSED!
           alloc size  524288 :  PASSED!
           alloc size 1048576 :  PASSED!
           alloc size 2097152 :  PASSED!
           alloc size 4194304 :  PASSED!
           alloc size 8388608 :  FAILED (maybe size is just too big)!
         Testing PCIDRIVER_IOC_KMEM_SYNC...
           Setting KMEM SYNC to write mode... PASSED!
           Setting KMEM SYNC to read mode... PASSED!
           Setting KMEM SYNC to read/write mode... PASSED!
         Testing PCIDRIVER_IOC_KMEM_FREE... PASSED!
         Testing Kernel Buffer mmap... 
           Setting MMAP mode to KMEM... PASSED!
             Allocing size    1024 : PASSED!
             MMAPing size     1024 : PASSED!
             Allocing size    2048 : PASSED!
             MMAPing size     2048 : PASSED!
             Allocing size    4096 : PASSED!
             MMAPing size     4096 : PASSED!
             Allocing size    8192 : PASSED!
             MMAPing size     8192 : PASSED!
             Allocing size   16384 : PASSED!
             MMAPing size    16384 : PASSED!
             Allocing size   32768 : PASSED!
             MMAPing size    32768 : PASSED!
             Allocing size   65536 : PASSED!
             MMAPing size    65536 : PASSED!
             Allocing size  131072 : PASSED!
             MMAPing size   131072 : PASSED!
             Allocing size  262144 : PASSED!
             MMAPing size   262144 : PASSED!
             Allocing size  524288 : PASSED!
             MMAPing size   524288 : PASSED!
             Allocing size 1048576 : PASSED!
             MMAPing size  1048576 : PASSED!
             Allocing size 2097152 : PASSED!
             MMAPing size  2097152 : PASSED!
             Allocing size 4194304 : PASSED!
             MMAPing size  4194304 : PASSED!
             Allocing size 8388608 : FAILED (maybe size is just too big)!
           Freeing Kernel buffers...
              Buffer index 0... PASSED!
              Buffer index 1... PASSED!
              Buffer index 2... PASSED!
              Buffer index 3... PASSED!
              Buffer index 4... PASSED!
              Buffer index 5... PASSED!
              Buffer index 6... PASSED!
              Buffer index 7... PASSED!
              Buffer index 8... PASSED!
              Buffer index 9... PASSED!
              Buffer index 10... PASSED!
              Buffer index 11... PASSED!
              Buffer index 12... PASSED!
         Testing PCIDRIVER_IOC_UMEM_SGMAP ... PASSED!
         Testing PCIDRIVER_IOC_UMEM_SGGET ... PASSED!
         Testing PCIDRIVER_IOC_UMEM_SYNC ...
           Setting UMEM SYNC to write mode... PASSED!
           Setting UMEM SYNC to read mode... PASSED!
           Setting UMEM SYNC to read/write mode... PASSED!
         Testing PCIDRIVER_IOC_UMEM_SGUNMAP ... PASSED!

		-------------------------------------
		|        All tests PASSED!          |
		-------------------------------------

176 177 178 179 180 181 182 183 184
Notice that some tests that try to evaluate the limits of a current
Linux Kernel may fail in some cases. In the example above,
two tests , due to an attempt to allocate a large buffer in kernel
space.

This is not actually an error or a failure, it is just trying to
allocate more memory than the kernel has available.

## Installation Instructions
Lucas Russo's avatar
Lucas Russo committed
185

186
Comple everything
Lucas Russo's avatar
Lucas Russo committed
187

188
	make
Lucas Russo's avatar
Lucas Russo committed
189

190
Compile the examples
Lucas Russo's avatar
Lucas Russo committed
191

192
	make examples
Lucas Russo's avatar
Lucas Russo committed
193

194
Run the server components with the helper script, like shown below:
Lucas Russo's avatar
Lucas Russo committed
195

196
	./init.sh <broker_endpoint>
Lucas Russo's avatar
Lucas Russo committed
197

198 199
Typically, one should choose the IPC transport method
for its faster than TCP. For instance:
Lucas Russo's avatar
Lucas Russo committed
200

201
	./init.sh ipc:///tmp/bpm/0
Lucas Russo's avatar
Lucas Russo committed
202

203
Now we should be good to start making transactions.
Lucas Russo's avatar
Lucas Russo committed
204

205
Change to the example applications folder
Lucas Russo's avatar
Lucas Russo committed
206

207
	cd examples
Lucas Russo's avatar
Lucas Russo committed
208

209
Run the Example application
Lucas Russo's avatar
Lucas Russo committed
210

211
	./client -v
Lucas Russo's avatar
Lucas Russo committed
212

213
Leds should be blinking in the FMC ADC board