This is an old revision of the document!
Description of the ADALM2000 calibration API in libm2k.
Always disconnect analog inputs/outputs before calibration.
The libm2k API offers three methods for calibrating the board:
import libm2k ctx = libm2k.m2kOpen() if ctx is None: print("Connection Error: No ADALM2000 device available/connected to your PC.") exit(1) ctx.calibrateADC() ctx.calibrateDAC() # signal processing libm2k.contextClose(ctx)
Libm2k offers a way to use prerecorded calibration values that are stored in a context attribute. Using this approach, there is no need to disconnect the analog inputs/outputs at every run because the calibration parameters are stored on the device. Since calibration values are dependent on temperature, a script will record the values at different temperatures and eventually create a file that is compatible with libm2k and the context attribute format.
The calibration values are written to the context attribute from a file on the ADALM2000 partition. The values will be stored on the device until they are overwritten.
This file must be called 'm2k-calib-temp-lut.ini' and it should contain only a row having the following format:
cal,temp_lut=[<temperature>,<adc_offset1>,<adc_offset2>,<adc_gain1> <adc_gain2>, <dac_offset1>,<dac_offset2>,<dac_gain1>,<dac_gain2> [...]]
Example of file:
The values differ from board to board.
The file can be generated by using the following script. For better result, please consider exposing ADALM2000 to wider temperature variations, while the file is generated - will generate calibration values for more diverse points.
generate_temperature_calib_lut <uri> [-h | --help] [-t | --temperature max_temp] [-T | --timeout min] [-v | --values nb_values] [-f | --file path] [-a | --append]
Generate the temperature calibration lookup table.
temperature The maximum temperature to stop at (default 75 °C).
timeout The number of minutes after timeout will occur (default 30 minutes).
values The maximum number of values to extract at the end.
file The path to the generated file (default 'm2k-calib-temp-lut.ini').
append Append the new computed values to the existent file.
python3 generate_temperature_calib_lut.py ip:192.168.2.1
python3 generate_temperature_calib_lut.py auto -v 5 -t 54 -T 15 -f "example.ini" -a
The purpose of this calibration type is to automate and to make the calibration process faster. Please make sure to have the following minimum requirements:
After the board booted, copy the ini file inside the m2k drive. Then eject the drive (do not unplug!) and wait for ADALM2000 to boot. Once booted, the temperature calibration lookup table will be usable from libm2k.
If you are using the -f or --file option you should rename the file to 'm2k-calib-temp-lut.ini' before copying it to the device.
In order to perform a fast calibration call the fallowing context method: calibrateFromContext(). The method hasContextCalibration() will validate if the temperature calibration can be performed on the current board. There are some reasons why the calibration can be performed:
import libm2k ctx = libm2k.m2kOpen() if ctx is None: print("Connection Error: No ADALM2000 device available/connected to your PC.") exit(1) if ctx.hasContextCalibration(): ctx.calibrateFromContext() else: ctx.calibrateADC() ctx.calibrateDAC() # signal processing libm2k.contextClose(ctx)