FMC ADC 400k 18B 4CHA ISO Software Support
Overview
This is the project that provides software support for the FMC ADC 400k 18B 4CHA ISO board.
Releases
Documentation
ALIN python module
Alin class uses the spec_lib.py file developed by the OHR group that
povides access to the libspec.so C library which is he one who provides
access to the spec memory.
The alin package contains a setup.py which automatically install all
requeired files in its coresponding places. Just download and unzip the
file AlIn-x.x.tar.gz in your electrometer nuc board and execute:
#python setup.py install
This will install:
alin python module on /usr/lib/pythonX.X/site-packages
This module contains, alin.py and alindev.py modules and the developed
to control the AlbaInstrument
alin scripts installed in /usr/bin
libspec.so library under /usr/lib
spec-init.bin The FPGA binary file, will be installed in
/lib/firmware/fmc
kernel modules all the kernel modules to run the spec, will be copied
into /lib/modules/$(uname -r)/extra
doc finally, the html and man documentation is also generated. Html
documentation is copied to the location where the alin modules are
installed and the man information is copied to /usr/share/man/ folder
Class AlinSDB
Alin.py contains the alinSDB class that allows to get information from the Spec board.
Public Member Fucntions:
def init
def getData
def readAddress
def writeAddress
def readData
def loadFile
def readAddressRange
def getDeviceMemory
def getAddress
def setLogEnable
Public Attributes:
spec
init_offset
sdb_structure
base_address
device_bridges
devices_counter
filename
Static Public Attributes:
int OFFSET = 0x00
int SDB_MAGIC = 0x5344422d
int SDB_RECORD_INTERCONNECT = 0x00
int SDB_RECORD_DEVICE = 0x01
int SDB_RECORD_BRIDGE = 0x02
int SDB_RECORD_INTEGRATION = 0x80
int SDB_RECORD_REPO_URL = 0x81
int SDB_RECORD_SYNTHESIS = 0x82
int SDB_RECORD_EMPTY = 0xff
Detailed Description
Main class to read spec memory using te spec_libc library. It reads the memory searching for the SDB structure. Provides access to the SDB structured memory reading or writing to specific memory positions or devices.
def init(self, offset = OFFSET):
The constructor
Parameters:
offset: (not mandatory) Start address where the SDB structure is located
in memory
def getData(self, address):
This function reads the memory searching for the SDB structure. The
result is stored in the sdb_structure
Parameters:
address (not mandatory) Start address where the SDB structure is located
in memory
def readAddress (self, address):
This function reads a 4-byte block in a given memory position.
Parameters
address Address to read. It should be multiple of 4
Returns
Data read
def writeAddress (self, address, data_w):
This function writes a 4-byte block in a given memory position.ion.
Parameters:
address: Address to read. It should be multiple of 4
data_w: Data to write
def readData(self):
This function returns the SDB structure read from memory
Returns
SDB structure
def loadFile (self, filename):
This function loads a new bin file un the FPGA. It gets its SDB
structure
Parameters:
filename Bin file to write in the FPGA
Returns
Boolean value that indicates if the file has been successfully loaded
def readAddressRange (self, ninit_address, end_address):
This function returns a list that contains all memry values between two
given address positions
Parameters:
init_address Initial address to read from
end_address End address to read to
Returns
Data block whcih contains the data in memory for the given address
values
def getDeviceMemory (self, devname, vend, prod)
This function reads the memory for a particualr device name, vendorId
and ProductId. The three items have to much, otherwise the function
returns None
Parameters:
devname: Device name to find in the SDB structure
vend: VendorId to find in the SDB structure
prod: Product to find in the SDB structure
Returns
The contens of the memory block that corresponds to the specified
device, vendorId & product
def getAddress(self, *args):
This function converts a block of four 4 bytes to an address value
Parameters:
args: Block of bytes that contain the address
Returns
Calculated address
def setLogEnable(self, dbg=False):
This function enables the debug information through screen (To log file
is always enabled)
Parameters:
dbg (not mandatory) enables/disables the log oputput. By default is
disabled
Class AlinDevice
Alindev.py provides access to particular devices created form the wb file. th ealingen tool generates a pickle file from the wishbone file used to generated the FPGA code for each block. This file contains the location, description and mapping for each of the registers defined in a particular FPGA block. So the alingen tool generates a pickle file that contains a dict with all the register mapping for a particular device. AlinDevice uses this pickle file, toghether with the alinSDB class to provide functions to read/write registers for a device
Public Member Fucntions:
def init
def setDevice
def getDeviceInfo
def getDeviceName
def getDeviceDescription
def getDeviceData
def getAttributesList
def writeAttribute
def readAttribute
def getAttributeInfo
def setLogEnable
Public Attributes:
sdbDrv
product
vendorId
initAddress
Detailed Description
Main class that links the device map pickel file created with the coresponding memory area defined in the SDB It provides functions to get device information and to read/write attributes of that device
def init(self, offset = OFFSET):
The constructor
Parameters:
device (not mandatory) Device to controls
def setDevice(self, device):
This function reads the memory, searching for the prodcutID ad vendroID
specified. When it is found it stores the falue for the memory address
location where the device is located. A pickle file, named as the
device, should exits to complete the set fo the Device. The pickle file
contains a dict with all the device registers mapping
Parameters:
device Device to read the information. This is a string parametar that
should have the following structure: PorductID:VendorID
def getDeviceInfo (self):
This function returns all mapping information for the corresponding
device
Returns
Dict that contains all device information and mapping
def getDeviceName (self):
This function returns the device name which is included in the pickle
file
Returns
String that contains the device name
def getDeviceDescription(self):
This function returns the device description which is included in the
pickle file
Returns
String that contains the description of the device
def getDeviceData (self):
This function returns all device information included in the pickle
file, including device name, description and register mapping
Returns
List containing all device data
def getAttributesList (self):
This function returns the list of attributes defined in the pickle
file
Returns
Data block whcih contains the data in memory for the given address
values
def writeAttribute (self, attrName,attrVal )
This function uses the initial device address obtained from the SDB for
the device and do the mask wiht the information in the pickle file for
the register selecter to calculate the proper masked value to write.
Then it uses alinSDB write funciton to apply the corresponding value
Paramete
attrName String containing the attribute name to write
attrVal Num with the value to write in the aatribute
def readAttribute(self, attrName):
This function uses the initial device address obtained from the SDB to
read the value using the alinSDB read functions. Then it uses the
information in the pickle file to apply the proper mask and return the
masked value
Parameters:
attrName String containing the attribute name to write
Returns
Numeric value for te selected attribute
def getAttributeInfo(self, attrName):
This function uses the initial device address obtained from the SDB to
read the value using the alinSDB read functions. It uses the information
in the pickle file to apply the proper mask and return the masked value
and return the value and the rest of detailed regiser information.
Parameters:
attrName String containing the attribute name to write
Returns
Dict that contains the register detailed information, including its
value
def setLogEnable(self, dbg=False):
This function enables the debug information through screen (To log file
is always enabled)
Parameters:
dbg (not mandatory) enables/disables the log oputput. By default is
disabled
Go back to index ==>
ALIN SCRIPTS: Scripts for controls module to control
The AlIn scripts help user to control the Alba Instrument. Actually, there are only three tools developed.
- alininfo: provides general control over the spec devices
- alingen: tool to create devices
- alinsave: provides a visual or a file that contains a number of sampling of the 8 ADC separated by a certain time.
Other tools are Panel or the telnet, which are developed for an specific purpose, like reading the 8-ADc channels and print the output to the pael through I2C or to provide a telnet client/serve application which just open the 5025 port and adds a listener.
Tools are installed together with the alin python modules and can be located at /usr/lib/python2.7/site-packages/alin/tools folder
Alininfo
Main tool that provides information about the SDB structure in the spec, their devices and provides access to read/write range of memory areas, devices or particular devices.
ALIN usage as follows:
# alin <command_1>= <command_2>=.....
Commands are optional. By default, short SDB structure info is shown
(alin -t).
List of available commands are:
-r
or ---read=
:
Continuous read of a memory address. This read will be updated every
second until 'enter' key will be pressed.
I.e.: alin -r 0x3100
-m or --map:
Shows the available devices list and lets the user to select which
device memory map to show.
-i or --info:
To display the detailed SDB structure.
-t or --tree:
Short list of SDB structure.
--help:
Shows this help
-l <filename.bin> or --load=<filename.bin>:
To load a new binary file into the Spec FPGA.
The file location has to be specified, i.e.: alin
load='/lib/firmware/fmc/spec-init.bin'.
-o or --offset=:
To define the address position where the SDB magic number is located. By
defult offset values is 0x100.
-b <init_addr>,<end_add> or --block=<init_add>,<end_add>:
This shows range of data memory from the init address <init_add> to the
end address defined in <end_add>.
I.e.: alin -b 0x100,0x11f
-w
, or --write=
,:
This commands lets write a value in a certain position.
I.e.: alin -w 0x3100,0x01
-d command , or --dev= command1
,:
This command is use to get information abput a particular device and
provide individual control for each of its registers
If not is specified, it shows the complete list of available
devices
The list of command available for a device are:
-[None]: Without commands, it shows general information about the
device and its registers
-g : Gets the value of regsiter. I.e.: alin
--dev='VendorID:Product' -g <REG_NAME>
-v : Views the complete register info. I.e.: alin -d
'VendorID:Product' -v <REG_NAME>
-s ,: Sets a to the regsiter . I.e.:
alin dev='VendorID:Product' -s <REG_NAME> data=0x<hex_value>
Alingen
ALINGEN is a tool that generates a pickle file for a device that contains a dict with the device information extracted from the wishbone file. This wishbone file, passed as argument and used to generate the FPGA code block, contains the register mapping and detailed infor for a particular FPGA block. It should be used as follows
# alingen <command_1> <wb_file>
List of available commands are:
-g <wb_filename> or ---generate=<wb_filename>:
Generates te picklefile for the specified wb file.
--help:
Shows this help
-d or --delete=:
Deletes an specific device pickle file.
Alinsave
This scripts is used to acquire a number of samples (for the 8
channles)for a period of time. It writes the output in the screen, but
also to a csv file that can be input or not by the user.
By default, it searchs for the SDB magic number in 0x100 position.
electproto03:~ # alin_save
Numero de ciclos: 10
Intervalo entre ciclos en segundos: 1
Nombre fichero salida sin extension:
Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7, Ch8, Samples Counter
2.07176208496, 2.0703125, 2.07038879395, 2.0686340332, 2.06809997559,
2.07023620605, 2.06985473633, 2.07214355469, 3926
SEQUENCE COMPLETED!!!!
Generate output file: /home/project/alba-em/logs/Current_20150714_172228.csv
Support
We offer the following sources of support:
- Frequently-Asked-Questions
- Mailing list fmc-adc-400k18b4cha-iso@ohwr.org and its archive.
Please** read the documentation and then the FAQ before asking for support on the mailing list.
Contacts
Maintainers
- Manuel Broseta - ALBA
People Involved
- Oscar Matilla - ALBA
- Xavier Serra - ALBA
- Jose Avila - ALBA
Status
Date | Event |
---|
Jose Avila, Manuel Broseta - October 2015