Hardware Link (caen.comm)
caen.comm
Low-level communication interface for CAEN digitizers via libCAENComm.
TheBoard
Wrapper around libCAENComm for register I/O and block data readout.
Supports context-manager usage (with TheBoard(...) as board:) to
automatically open and close the hardware link.
Attributes:
| Name | Type | Description |
|---|---|---|
LinkTypes |
tuple[str, ...]
|
Supported physical link types ( |
ErrorCode |
dict[int, str | bool]
|
Mapping of |
clib |
CDLL
|
Loaded CAENComm library handle ( |
NChannels |
int
|
Number of input channels on the digitizer ( |
ADCNbits |
int
|
Nominal ADC resolution in bits ( |
BufferSize |
int
|
Size of the MBLT readout buffer in 32-bit words ( |
ReadOutBuffer |
Array
|
Pre-allocated |
BoardInfo |
dict[str, str]
|
Hardware model, serial number, and firmware metadata. |
Source code in caen/comm.py
8 9 10 11 12 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 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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
CloseLink()
Close the active CAENComm device handle.
Returns:
| Type | Description |
|---|---|
bool | str
|
|
Source code in caen/comm.py
90 91 92 93 94 95 96 97 98 99 | |
GetBoardInfo()
Read Configuration ROM and FPGA firmware registers to populate BoardInfo.
Also configures HVPS polarity signs (HV_POLA) and voltage/current
step scaling factors (HV_Vmax, HV_Vset, HV_Iset).
Source code in caen/comm.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
GetInfoHV()
Detect the installed High-Voltage Power Supply (HVPS) sub-module type.
Temporarily enters HVPS identification mode via register 0x1234 and
restores the original register state in a finally block.
Returns:
| Type | Description |
|---|---|
str
|
HVPS model suffix ( |
Source code in caen/comm.py
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 | |
OpenLink(LinkNum=0, LinkType='USB')
Open a communication link to the digitizer and query board metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
LinkNum |
int
|
USB or optical link index. |
0
|
LinkType |
str
|
Connection type ( |
'USB'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in caen/comm.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
ReadData()
Perform a Multi-Block Transfer (MBLT) readout into ReadOutBuffer.
Returns:
| Type | Description |
|---|---|
int
|
Number of 32-bit words read from the digitizer memory. |
Source code in caen/comm.py
119 120 121 122 123 124 125 126 127 128 129 130 | |
Reg32(addr, data=None)
Read or write a 32-bit hardware register.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
addr |
int
|
Register address (e.g., |
required |
data |
int | None
|
Value to write. If |
None
|
Returns:
| Type | Description |
|---|---|
int | str
|
Register value on read success, status code on write, or error string on failure. |
Source code in caen/comm.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__(LinkNum=0, LinkType='USB')
Initialize board communication parameters and allocate readout buffer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
LinkNum |
int
|
USB or optical link index. Defaults to |
0
|
LinkType |
str
|
Physical connection type ( |
'USB'
|
Source code in caen/comm.py
51 52 53 54 55 56 57 58 59 60 61 62 63 | |