mantigorahvps Code
A GUI interface to Mantigora high voltage power supply for Linux
Brought to you by:
eagle-owl
| File | Date | Author | Commit |
|---|---|---|---|
| 99-libftdi.rules | 2016-10-27 |
|
[b6e1ad] udev rule |
| README | 2016-10-25 |
|
[48ae2a] Initial commit |
| mantigorahvps | 2016-10-25 |
|
[48ae2a] Initial commit |
| mantigorahvps.py | 2017-02-08 |
|
[e3e8c9] fix for write_data in libftdi-python-1.3 |
| my_transfer_data_done.c | 2016-10-25 |
|
[48ae2a] Initial commit |
This program implements a GUI interface to Mantigora high voltage power supply
for Linux.
Features:
* Work with some devices is provided from one application. No interface
freezes can happen, each device is served by own I/O thread for background
and calibration reads.
* Calibration of built-in voltmeter can be performed for each device
separately with a reference voltmeter. The saved calibration is loaded
for initialization of each device automatically.
* GUI layout and settings can be saved as a profile. Any number of profiles
can be saved and required one can be loaded at any time.
Dependencies: python-2.7, libftdi (libftdi-1), libftdi-python
(libftdi-python-1), PyQt4 (can be installed e.g. from repository of Fedora)
Copy 99-libftdi.rules to /etc/udev/rules.d/ to allow user access to devices.
-----------------------------------------------------------------------------
Scalability as of number of open devices
By default the application uses synchronous reads and is not scalable
because python GIL is not released for reads so all devices are read
sequentially.
With asynchronous reads the application is scalable but libFTDI contains a bug.
Loop in ftdi_transfer_data_done() can run indefinitely long thanks to:
1. lost/not sent bytes from modem line, so read callback can't read data
and set flag 'completed'
2. regular generation of modem status bytes each 40 msec, so read callback
restarts transfer and timeout in
libusb_handle_events_timeout_completed() can't happen
So asynchronous reads can block application indefinitely long.
To solve the problem ftdi_transfer_data_done() is to be replaced in such a way:
1. build shared object my_transfer_data_done.so (install libftdi-devel if
required):
> gcc -Wall -O6 -fPIC -shared -lusb-1.0 -o my_transfer_data_done.so my_transfer_data_done.c
2. set environment variable LD_LIBRARY_PATH (in bash):
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path to my_transfer_data_done.so>
3. set LD_PRELOAD and run application (in bash):
> LD_PRELOAD=my_transfer_data_done.so ./mantigorahvps.py
Timeout of ftdi_transfer_data_done() is set as float number in seconds
in file my_transfer_data_done.c:
#define MY_TRANSFER_DATA_DONE_TOUT_SEC 1.0
If timeout happens the replacement of ftdi_transfer_data_done() outputs
message to stderr:
ERROR: ftdi_transfer_data_done timed out after 1.012927 s
-----------------------------------------------------------------------------
There is a bug in mantigora HVPS hardware. Sometimes try to read built-in
voltmeter hangs. Next reads succeed usually.