Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRC error RDTech DPS #9

Closed
robotfreak opened this issue Apr 5, 2019 · 33 comments
Closed

CRC error RDTech DPS #9

robotfreak opened this issue Apr 5, 2019 · 33 comments

Comments

@robotfreak
Copy link

I got a CRC Error when trying to connect a RDTech DPS Power supply:

./SmuView-0.0.3-x86_64.AppImage 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Configurable::init(): Init  "A0"  - key  "Offset"
Configurable::init(): Init  "A0"  - key  "Measured Quantity"
Configurable::init(): Init  "A0"  - key  "Amplitude"
Configurable::init(): Init  "A0"  - key  "Pattern Mode"
Configurable::init(): Init  "A1"  - key  "Offset"
Configurable::init(): Init  "A1"  - key  "Measured Quantity"
Configurable::init(): Init  "A1"  - key  "Amplitude"
Configurable::init(): Init  "A1"  - key  "Pattern Mode"
Configurable::init(): Init  "A2"  - key  "Offset"
Configurable::init(): Init  "A2"  - key  "Measured Quantity"
Configurable::init(): Init  "A2"  - key  "Amplitude"
Configurable::init(): Init  "A2"  - key  "Pattern Mode"
Configurable::init(): Init  "A3"  - key  "Offset"
Configurable::init(): Init  "A3"  - key  "Measured Quantity"
Configurable::init(): Init  "A3"  - key  "Amplitude"
Configurable::init(): Init  "A3"  - key  "Pattern Mode"
Configurable::init(): Init  "Analog"  - key  "Offset"
Configurable::init(): Init  "Analog"  - key  "Amplitude"
Configurable::init(): Init  "Logic"  - key  "Pattern Mode"
Configurable::init(): Init  "Demo device"  - key  "Trigger Match"
Configurable::init(): Init  "Demo device"  - key  "Averaging Samples"
Configurable::init(): Init  "Demo device"  - key  "Averaging"
Configurable::init(): Init  "Demo device"  - key  "Capture Ratio"
Configurable::init(): Init  "Demo device"  - key  "Samplerate"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Regulation"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Current Protection Threshold"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Current Protection Active"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Voltage Protection Threshold"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Voltage Protection Active"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Enabled"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Current Limit"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Current"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Voltage Target"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Voltage"
Init channel  "V" , channel_start_timestamp =  "2019.04.05 21:51:39.753"
Init channel  "I" , channel_start_timestamp =  "2019.04.05 21:51:39.753"
Init channel  "P" , channel_start_timestamp =  "2019.04.05 21:51:39.753"
Init analog signal  "V [V DC]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Init analog signal  "I [A DC]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Init analog signal  "P [W]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Init channel  "" , channel_start_timestamp =  "2019.04.05 21:51:39.753"
Init analog signal  "R [Ω]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Init channel  "" , channel_start_timestamp =  "2019.04.05 21:51:39.753"
Init analog signal  "Wh [Wh]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Init channel  "" , channel_start_timestamp =  "2019.04.05 21:51:39.753"
Init analog signal  "Ah [Ah]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Start aquisition for  "RDTech DPS5005" ,  aquisition_start_timestamp_ =  "2019.04.05 21:51:39.753"
Caught exception: generic/unspecified error
BaseDevice::close(): Trying to close device  "RDTech DPS5005 v14"
Init analog signal  "P [W DC]" , signal_start_timestamp_ =  "2019.04.05 21:51:39.753"
Warning: Adding new signal  "P [W DC]" to fixed channel  "P"
HardwareChannel::push_sample_sr_analog():  "P"  - No signal found:  "P [W DC]"
sr: modbus_serial: CRC error (0x0000 vs 0xFDC3).
BaseDevice::close(): Device closed  "RDTech DPS5005 v14"
BaseDevice::~BaseDevice():  "Demo device"
BaseDevice::close(): Trying to close device  "Demo device"
@knarfS
Copy link
Owner

knarfS commented Apr 5, 2019

Hi robofreak,

looks like a bug in the sigrok rdtech-dps driver, or more specific in the modbus CRC check (modbus_serial_rtu.c -> modbus_serial_rtu_read_end()).
Could you start SmuView with the "-l 5" argument, connect the device and attach the log. Maybe the log contains more info about the CRC check.
I don't own one of the RDTech power supplies and therefore I can't debug the problem myself.

Furthermore the driver is missing a mutex. That's a generic fix I can add, when the CRC check is working.

@littleyoda
Copy link

had the same error with sigrok-cli. So it is a bug in the driver.
I send one or two hours investigation this bug, but without any real success

@robotfreak
Copy link
Author

robotfreak commented Apr 6, 2019

Thank you, for your fast response.
This was my first guess too, that this is a sigrok specific error. But with the sigrok-cli (v0.7.1) the power supply is detected and works.

./sigrok-cli-0.7.1-x86_64.AppImage -d rdtech-dps:conn=/dev/ttyUSB0 --scan
The following devices were found:
rdtech-dps - RDTech DPS5005 v14 with 3 channels: V I P
peter@peter-labor:~/Downloads$ sudo ./sigrok-cli-0.7.1-x86_64.AppImage -d rdtech-dps:conn=/dev/ttyUSB0 --show
Driver functions:
    Power supply
Scan options:
    conn
    serialcomm
    modbusaddr
rdtech-dps - RDTech DPS5005 v14 with 3 channels: V I P
Supported configuration options:
    continuous: on, off
    limit_samples: 0 (current)
    limit_time: 0 (current)
    voltage: 5.000000
    voltage_target: 5.000000
    current: 0.000000
    current_limit: 5.100000
    enabled: on (current), off
    regulation: CV (current)
    ovp_active: on, off (current)
    ovp_threshold: 51.000000
    ocp_active: on, off (current)
    ocp_threshold: 5.200000
peter@peter-labor:~/Downloads$ sudo ./sigrok-cli-0.7.1-x86_64.AppImage -d rdtech-dps:conn=/dev/ttyUSB0 --continuous
FRAME-BEGIN
V: 4.990 V DC
I: 0.0 mA DC
P: 0 mW DC
FRAME-END
FRAME-BEGIN
V: 5.000 V DC
I: 0.0 mA DC
P: 0 mW DC
FRAME-END
FRAME-BEGIN
V: 5.000 V DC
I: 0.0 mA DC
P: 0 mW DC
FRAME-END
FRAME-BEGIN
V: 5.000 V DC
I: 0.0 mA DC
P: 0 mW DC
FRAME-END
FRAME-BEGIN
V: 5.000 V DC
I: 0.0 mA DC
P: 0 mW DC
FRAME-END
FRAME-BEGIN
V: 5.000 V DC
I: 0.0 mA DC
P: 0 mW DC
FRAME-END

Here is the log from smuview. I see it is linked again sigrok v0.6. So maybe this error is already fixed in newer sigrok versions:

./SmuView-0.0.3-x86_64.AppImage -l 5
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
sr: [00:00.000001] log: libsigrok loglevel set to 5.
Settings: "/home/peter/.config/sigrok/SmuView.conf" format QSettings::Format(NativeFormat)
sr: [00:00.002352] backend: libsigrok 0.6.0-git-6449b2e/4:0:0.
sr: [00:00.002419] backend: Libs: glib 2.40.2 (rt: 2.56.3/5603:3), libzip 0.10.1, libserialport 0.1.1/1:0:1 (rt: 0.1.1/1:0:1), libusb-1.0 1.0.21.11156 API 0x01000102.
sr: [00:00.002439] backend: Host: x86_64-unknown-linux-gnu, little-endian.
sr: [00:00.002456] backend: SCPI backends: TCP, RPC, serial, USBTMC.
sr: [00:00.002474] backend: Firmware search paths:
sr: [00:00.002519] backend:  - /home/peter/.local/share/sigrok-firmware
sr: [00:00.002533] backend:  - /home/frank/sr/share/sigrok-firmware
sr: [00:00.002543] backend:  - /usr/local/share/sigrok-firmware
sr: [00:00.002554] backend:  - /usr/share/sigrok-firmware
sr: [00:00.002583] backend: Sanity-checking all drivers.
sr: [00:00.002610] backend: Sanity-checking all input modules.
sr: [00:00.002628] backend: Sanity-checking all output modules.
sr: [00:00.002646] backend: Sanity-checking all transform modules.
sr: [00:00.114903] hwdriver: Scan found 0 devices (agilent-dmm).
sr: [00:00.115148] hwdriver: Scan found 0 devices (appa-55ii).
sr: [00:00.115286] hwdriver: Scan found 0 devices (arachnid-labs-re-load-pro).
sr: [00:00.115400] hwdriver: Scan found 0 devices (atten-pps3203).
sr: [00:00.116167] hwdriver: Scan found 0 devices (baylibre-acme).
sr: [00:00.142460] hwdriver: Scan found 0 devices (bbcgm-2010).
sr: [00:00.142717] hwdriver: Scan found 0 devices (brymen-bm25x).
sr: [00:00.142863] hwdriver: Scan found 0 devices (brymen-bm857).
sr: [00:00.143094] hwdriver: Scan found 0 devices (brymen-bm86x).
sr: [00:00.145017] hwdriver: Scan found 0 devices (cem-dt-885x).
sr: [00:00.145271] hwdriver: Scan found 0 devices (center-309).
sr: [00:00.145385] hwdriver: Scan found 0 devices (colead-slm).
sr: [00:00.145554] hwdriver: Scan found 0 devices (conrad-digi-35-cpu).
sr: [00:00.146572] demo: Generating square pattern.
sr: [00:00.146603] demo: Generating sine pattern.
sr: [00:00.146761] demo: Generating triangle pattern.
sr: [00:00.146954] demo: Generating sawtooth pattern.
sr: [00:00.147009] hwdriver: Scan found 1 devices (demo).
Configurable::init(): Init  "A0"  - key  "Offset"
Configurable::init(): Init  "A0"  - key  "Measured Quantity"
Configurable::init(): Init  "A0"  - key  "Amplitude"
Configurable::init(): Init  "A0"  - key  "Pattern Mode"
sr: [00:00.147318] hwdriver: sr_config_list(): key 30002 (pattern) sdi 0x259f490 cg A0 -> ['square', 'sine', 'triangle', 'sawtooth']
Configurable::init(): Init  "A1"  - key  "Offset"
Configurable::init(): Init  "A1"  - key  "Measured Quantity"
Configurable::init(): Init  "A1"  - key  "Amplitude"
Configurable::init(): Init  "A1"  - key  "Pattern Mode"
sr: [00:00.147514] hwdriver: sr_config_list(): key 30002 (pattern) sdi 0x259f490 cg A1 -> ['square', 'sine', 'triangle', 'sawtooth']
Configurable::init(): Init  "A2"  - key  "Offset"
Configurable::init(): Init  "A2"  - key  "Measured Quantity"
Configurable::init(): Init  "A2"  - key  "Amplitude"
Configurable::init(): Init  "A2"  - key  "Pattern Mode"
sr: [00:00.147655] hwdriver: sr_config_list(): key 30002 (pattern) sdi 0x259f490 cg A2 -> ['square', 'sine', 'triangle', 'sawtooth']
Configurable::init(): Init  "A3"  - key  "Offset"
Configurable::init(): Init  "A3"  - key  "Measured Quantity"
Configurable::init(): Init  "A3"  - key  "Amplitude"
Configurable::init(): Init  "A3"  - key  "Pattern Mode"
sr: [00:00.147802] hwdriver: sr_config_list(): key 30002 (pattern) sdi 0x259f490 cg A3 -> ['square', 'sine', 'triangle', 'sawtooth']
Configurable::init(): Init  "Analog"  - key  "Offset"
Configurable::init(): Init  "Analog"  - key  "Amplitude"
Configurable::init(): Init  "Logic"  - key  "Pattern Mode"
sr: [00:00.147927] hwdriver: sr_config_list(): key 30002 (pattern) sdi 0x259f490 cg Logic -> ['sigrok', 'random', 'incremental', 'walking-one', 'walking-zero', 'all-low', 'all-high', 'squid', 'graycode']
Configurable::init(): Init  "Demo device"  - key  "Trigger Match"
sr: [00:00.148027] hwdriver: sr_config_list(): key 30014 (triggermatch) sdi 0x259f490 cg NULL -> [1, 2, 3, 4, 5]
Configurable::init(): Init  "Demo device"  - key  "Averaging Samples"
Configurable::init(): Init  "Demo device"  - key  "Averaging"
Configurable::init(): Init  "Demo device"  - key  "Capture Ratio"
Configurable::init(): Init  "Demo device"  - key  "Samplerate"
sr: [00:00.148212] hwdriver: sr_config_list(): key 30000 (samplerate) sdi 0x259f490 cg NULL -> {'samplerate-steps': <[uint64 1, 1000000000, 1]>}
sr: [00:00.148566] hwdriver: Scan found 0 devices (deree-de5000).
sr: [00:00.148786] hwdriver: Scan found 0 devices (digitek-dt4000zc).
sr: [00:00.148932] hwdriver: Scan found 0 devices (eevblog-121gw).
sr: [00:00.155940] hwdriver: Scan found 0 devices (fluke-45).
sr: [00:00.156228] hwdriver: Scan found 0 devices (fluke-dmm).
sr: [00:00.156432] hwdriver: Scan found 0 devices (gmc-mh-1x-2x-rs232).
sr: [00:00.156548] hwdriver: Scan found 0 devices (gmc-mh-2x-bd232).
sr: [00:00.156663] hwdriver: Scan found 0 devices (gwinstek-gpd).
sr: [00:00.165449] hwdriver: Scan found 0 devices (hp-3457a).
sr: [00:00.173525] hwdriver: Scan found 0 devices (hpib-pps).
sr: [00:00.174946] hwdriver: Scan found 0 devices (iso-tech-idm103n).
sr: [00:00.175124] hwdriver: Scan found 0 devices (kecheng-kc-330b).
sr: [00:00.175239] hwdriver: Scan found 0 devices (kern-ew-6200-2nm).
sr: [00:00.175344] hwdriver: Scan found 0 devices (korad-kaxxxxp).
sr: [00:00.175453] hwdriver: Scan found 0 devices (lascar-el-usb).
sr: [00:00.175570] hwdriver: Scan found 0 devices (manson-hcs-3xxx).
sr: [00:00.175683] hwdriver: Scan found 0 devices (mastech-mas345).
sr: [00:00.175796] hwdriver: Scan found 0 devices (mastech-ms8250b).
sr: [00:00.175905] hwdriver: Scan found 0 devices (mastech-ms8250d).
sr: [00:00.176029] hwdriver: Scan found 0 devices (maynuo-m97).
sr: [00:00.176138] hwdriver: Scan found 0 devices (metex-m3640d).
sr: [00:00.176247] hwdriver: Scan found 0 devices (metex-m3860m).
sr: [00:00.176361] hwdriver: Scan found 0 devices (metex-m4650cr).
sr: [00:00.176470] hwdriver: Scan found 0 devices (metex-me31).
sr: [00:00.176582] hwdriver: Scan found 0 devices (metrix-mx56c).
sr: [00:00.176741] hwdriver: Scan found 0 devices (mic-98581).
sr: [00:00.176876] hwdriver: Scan found 0 devices (mic-98583).
sr: [00:00.177015] serial: No serial device specified.
sr: [00:00.177032] hwdriver: Scan found 0 devices (motech-lps-301).
sr: [00:00.177159] hwdriver: Scan found 0 devices (norma-dmm).
sr: [00:00.177295] hwdriver: Scan found 0 devices (pce-322a).
sr: [00:00.177431] hwdriver: Scan found 0 devices (pce-pce-dm32).
sr: [00:00.177567] hwdriver: Scan found 0 devices (peaktech-2170).
sr: [00:00.177706] hwdriver: Scan found 0 devices (peaktech-3330).
sr: [00:00.177844] hwdriver: Scan found 0 devices (peaktech-3410).
sr: [00:00.177980] hwdriver: Scan found 0 devices (peaktech-3415).
sr: [00:00.178124] hwdriver: Scan found 0 devices (peaktech-4370).
sr: [00:00.178265] hwdriver: Scan found 0 devices (peaktech-4390a).
sr: [00:00.178410] hwdriver: Scan found 0 devices (radioshack-22-168).
sr: [00:00.178554] hwdriver: Scan found 0 devices (radioshack-22-805).
sr: [00:00.178697] hwdriver: Scan found 0 devices (radioshack-22-812).
sr: [00:00.178833] hwdriver: Scan found 0 devices (rdtech-dps).
sr: [00:00.186062] hwdriver: Scan found 0 devices (scpi-dmm).
sr: [00:00.205400] hwdriver: Scan found 0 devices (scpi-pps).
sr: [00:00.206971] hwdriver: Scan found 0 devices (siemens-b102x).
sr: [00:00.207755] hwdriver: Scan found 0 devices (sparkfun-70c).
sr: [00:00.208505] hwdriver: Scan found 0 devices (tecpel-dmm-8061).
sr: [00:00.209263] hwdriver: Scan found 0 devices (tecpel-dmm-8061-ser).
sr: [00:00.210646] hwdriver: Scan found 0 devices (tekpower-tp4000ZC).
sr: [00:00.211363] hwdriver: Scan found 0 devices (teleinfo).
sr: [00:00.211951] hwdriver: Scan found 0 devices (tenma-72-7730).
sr: [00:00.212621] hwdriver: Scan found 0 devices (tenma-72-7730-ser).
sr: [00:00.213272] hwdriver: Scan found 0 devices (tenma-72-7732).
sr: [00:00.213878] hwdriver: Scan found 0 devices (tenma-72-7732-ser).
sr: [00:00.214474] hwdriver: Scan found 0 devices (tenma-72-7745).
sr: [00:00.215088] hwdriver: Scan found 0 devices (tenma-72-7745-ser).
sr: [00:00.215661] hwdriver: Scan found 0 devices (tenma-72-7750).
sr: [00:00.216232] hwdriver: Scan found 0 devices (tenma-72-7750-ser).
sr: [00:00.216811] hwdriver: Scan found 0 devices (tenma-72-9380a).
sr: [00:00.217477] hwdriver: Scan found 0 devices (tenma-72-9380a-ser).
sr: [00:00.222573] hwdriver: Scan found 0 devices (testo).
sr: [00:00.223409] hwdriver: Scan found 0 devices (tondaj-sl-814).
sr: [00:00.224065] hwdriver: Scan found 0 devices (uni-t-ut32x).
sr: [00:00.224770] hwdriver: Scan found 0 devices (uni-t-ut372).
sr: [00:00.225370] hwdriver: Scan found 0 devices (uni-t-ut60a).
sr: [00:00.225928] hwdriver: Scan found 0 devices (uni-t-ut60a-ser).
sr: [00:00.226520] hwdriver: Scan found 0 devices (uni-t-ut60e).
sr: [00:00.227153] hwdriver: Scan found 0 devices (uni-t-ut60e-ser).
sr: [00:00.227739] hwdriver: Scan found 0 devices (uni-t-ut60g).
sr: [00:00.228303] hwdriver: Scan found 0 devices (uni-t-ut60g-ser).
sr: [00:00.228919] hwdriver: Scan found 0 devices (uni-t-ut61b).
sr: [00:00.229501] hwdriver: Scan found 0 devices (uni-t-ut61b-ser).
sr: [00:00.230058] hwdriver: Scan found 0 devices (uni-t-ut61c).
sr: [00:00.230611] hwdriver: Scan found 0 devices (uni-t-ut61c-ser).
sr: [00:00.231171] hwdriver: Scan found 0 devices (uni-t-ut61d).
sr: [00:00.231747] hwdriver: Scan found 0 devices (uni-t-ut61d-ser).
sr: [00:00.232320] hwdriver: Scan found 0 devices (uni-t-ut61e).
sr: [00:00.232913] hwdriver: Scan found 0 devices (uni-t-ut61e-ser).
sr: [00:00.233475] hwdriver: Scan found 0 devices (uni-t-ut71a).
sr: [00:00.234099] hwdriver: Scan found 0 devices (uni-t-ut71a-ser).
sr: [00:00.234663] hwdriver: Scan found 0 devices (uni-t-ut71b).
sr: [00:00.235227] hwdriver: Scan found 0 devices (uni-t-ut71b-ser).
sr: [00:00.235786] hwdriver: Scan found 0 devices (uni-t-ut71c).
sr: [00:00.236348] hwdriver: Scan found 0 devices (uni-t-ut71c-ser).
sr: [00:00.236988] hwdriver: Scan found 0 devices (uni-t-ut71d).
sr: [00:00.237569] hwdriver: Scan found 0 devices (uni-t-ut71d-ser).
sr: [00:00.238136] hwdriver: Scan found 0 devices (uni-t-ut71e).
sr: [00:00.238708] hwdriver: Scan found 0 devices (uni-t-ut71e-ser).
sr: [00:00.239265] hwdriver: Scan found 0 devices (va-va18b).
sr: [00:00.239869] hwdriver: Scan found 0 devices (va-va40b).
sr: [00:00.240449] hwdriver: Scan found 0 devices (velleman-dvm4100).
sr: [00:00.241061] hwdriver: Scan found 0 devices (victor-dmm).
sr: [00:00.241638] hwdriver: Scan found 0 devices (victor-dmm-ser).
sr: [00:00.242216] hwdriver: Scan found 0 devices (voltcraft-k204).
sr: [00:00.242798] hwdriver: Scan found 0 devices (voltcraft-m3650cr).
sr: [00:00.243437] hwdriver: Scan found 0 devices (voltcraft-m3650d).
sr: [00:00.244040] hwdriver: Scan found 0 devices (voltcraft-m4650cr).
sr: [00:00.244621] hwdriver: Scan found 0 devices (voltcraft-me42).
sr: [00:00.245214] hwdriver: Scan found 0 devices (voltcraft-vc820).
sr: [00:00.245793] hwdriver: Scan found 0 devices (voltcraft-vc820-ser).
sr: [00:00.246362] hwdriver: Scan found 0 devices (voltcraft-vc830).
sr: [00:00.246929] hwdriver: Scan found 0 devices (voltcraft-vc830-ser).
sr: [00:00.247505] hwdriver: Scan found 0 devices (voltcraft-vc840).
sr: [00:00.248111] hwdriver: Scan found 0 devices (voltcraft-vc840-ser).
sr: [00:00.248720] hwdriver: Scan found 0 devices (voltcraft-vc870).
sr: [00:00.249312] hwdriver: Scan found 0 devices (voltcraft-vc870-ser).
sr: [00:00.249894] hwdriver: Scan found 0 devices (voltcraft-vc920).
sr: [00:00.250512] hwdriver: Scan found 0 devices (voltcraft-vc920-ser).
sr: [00:00.251125] hwdriver: Scan found 0 devices (voltcraft-vc940).
sr: [00:00.251758] hwdriver: Scan found 0 devices (voltcraft-vc940-ser).
sr: [00:00.252352] hwdriver: Scan found 0 devices (voltcraft-vc96).
sr: [00:00.253001] hwdriver: Scan found 0 devices (voltcraft-vc960).
sr: [00:00.253603] hwdriver: Scan found 0 devices (voltcraft-vc960-ser).
sr: [00:00.254217] hwdriver: Scan found 0 devices (zketech-ebd-usb).
sr: [00:18.746761] hwdriver: sr_config_list(): key 2147418112 (NULL) sdi (nil) cg NULL -> [uint32 20000, 20001, 20002]
sr: [00:18.746871] modbus: Opening serial_rtu device /dev/ttyUSB0.
sr: [00:18.746931] serial: Opening serial port '/dev/ttyUSB0' (flags 1).
sr: [00:18.749178] serial: Parsing parameters from "9600/8n1".
sr: [00:18.749302] serial: Setting serial parameters on port /dev/ttyUSB0.
sr: [00:18.749436] serial: Flushing serial port /dev/ttyUSB0.
sr: [00:18.749553] serial: Wrote 1/1 bytes.
sr: [00:18.749618] serial: Wrote 5/5 bytes.
sr: [00:18.749694] serial: Wrote 2/2 bytes.
sr: [00:19.023245] serial: Read 1/1 bytes.
sr: [00:19.023328] serial: Read 1/1 bytes.
sr: [00:19.023399] serial: Read 5/5 bytes.
sr: [00:19.023460] serial: Read 2/2 bytes.
sr: [00:19.023520] rdtech-dps: RDTech PSU model: 5005 version: 14
sr: [00:19.023595] hwdriver: Scan found 1 devices (rdtech-dps).
Configurable::init(): Init  "RDTech DPS5005"  - key  "Regulation"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Current Protection Threshold"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Current Protection Active"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Voltage Protection Threshold"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Voltage Protection Active"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Enabled"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Current Limit"
sr: [00:19.024402] hwdriver: sr_config_list(): key 30032 (current_limit) sdi 0x23431f0 cg NULL -> [0.0, 5.0, 0.0001]
Configurable::init(): Init  "RDTech DPS5005"  - key  "Current"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Voltage Target"
sr: [00:19.024713] hwdriver: sr_config_list(): key 30030 (voltage_target) sdi 0x23431f0 cg NULL -> [0.0, 50.0, 0.001]
Configurable::init(): Init  "RDTech DPS5005"  - key  "Voltage"
sr: [00:25.099700] device: rdtech-dps: Opening device instance.
sr: [00:25.099752] serial: Opening serial port '/dev/ttyUSB0' (flags 1).
sr: [00:25.100412] serial: Parsing parameters from "9600/8n1".
sr: [00:25.100475] serial: Setting serial parameters on port /dev/ttyUSB0.
sr: [00:25.100522] serial: Flushing serial port /dev/ttyUSB0.
sr: [00:25.100570] serial: Wrote 1/1 bytes.
sr: [00:25.100604] serial: Wrote 8/8 bytes.
sr: [00:25.100643] serial: Wrote 2/2 bytes.
sr: [00:25.501899] serial: Read 1/1 bytes.
sr: [00:25.501971] serial: Read 1/1 bytes.
sr: [00:25.502013] serial: Read 4/4 bytes.
sr: [00:25.502061] serial: Read 2/2 bytes.
Init channel  "V" , channel_start_timestamp =  "2019.04.06 11:39:45.402"
Init channel  "I" , channel_start_timestamp =  "2019.04.06 11:39:45.402"
Init channel  "P" , channel_start_timestamp =  "2019.04.06 11:39:45.402"
Init analog signal  "V [V DC]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
Init analog signal  "I [A DC]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
Init analog signal  "P [W]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
Init channel  "" , channel_start_timestamp =  "2019.04.06 11:39:45.402"
Init analog signal  "R [Ω]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
Init channel  "" , channel_start_timestamp =  "2019.04.06 11:39:45.402"
Init analog signal  "Wh [Wh]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
Init channel  "" , channel_start_timestamp =  "2019.04.06 11:39:45.402"
Init analog signal  "Ah [Ah]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
sr: [00:25.504011] session: Creating our own main context.
sr: [00:25.504139] session: Starting.
sr: [00:25.504175] hwdriver: rdtech-dps: Starting acquisition.
sr: [00:25.504276] session: bus: Received SR_DF_HEADER packet.
sr: [00:25.504370] serial: Wrote 1/1 bytes.
sr: [00:25.504431] serial: Wrote 5/5 bytes.
sr: [00:25.504497] serial: Wrote 2/2 bytes.
Start aquisition for  "RDTech DPS5005" ,  aquisition_start_timestamp_ =  "2019.04.06 11:39:45.402"
sr: [00:25.673911] serial: Wrote 1/1 bytes.
sr: [00:25.673994] serial: Wrote 5/5 bytes.
sr: [00:25.674035] serial: Wrote 2/2 bytes.
sr: [00:25.954818] serial: Read 1/1 bytes.
sr: [00:25.954826] sr: [00:25.954898] serial: Read 1/1 bytes.
serial: Read 1/1 bytes.
sr: [00:25.954999] serial: Wrote 1/1 bytes.
sr: [00:25.955005] sr: [00:25.955056] serial: Wrote 5/5 bytes.
serial: Read 3/3 bytes.
sr: [00:25.955120] serial: Wrote 2/2 bytes.
sr: [00:26.055351] serial: Read 1/2 bytes.
Caught exception: generic/unspecified error
BaseDevice::close(): Trying to close device  "RDTech DPS5005 v14"
sr: [00:26.412183] serial: Read 1/1 bytes.
sr: [00:26.412264] serial: Read 1/1 bytes.
sr: [00:26.412322] serial: Read 7/7 bytes.
sr: [00:26.412382] serial: Read 2/2 bytes.
sr: [00:26.412433] session: bus: Received SR_DF_FRAME_BEGIN packet.
sr: [00:26.412503] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [00:26.412681] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [00:26.412792] session: bus: Received SR_DF_ANALOG packet (1 samples).
Init analog signal  "P [W DC]" , signal_start_timestamp_ =  "2019.04.06 11:39:45.402"
Warning: Adding new signal  "P [W DC]" to fixed channel  "P"
HardwareChannel::push_sample_sr_analog():  "P"  - No signal found:  "P [W DC]"
sr: [00:26.413191] session: bus: Received SR_DF_FRAME_END packet.
sr: [00:26.413273] serial: Wrote 1/1 bytes.
sr: [00:26.413344] serial: Wrote 5/5 bytes.
sr: [00:26.413416] serial: Wrote 2/2 bytes.
sr: [00:26.869551] serial: Read 1/1 bytes.
sr: [00:26.869633] serial: Read 1/1 bytes.
sr: [00:26.869691] serial: Read 7/7 bytes.
sr: [00:26.869750] serial: Read 2/2 bytes.
sr: [00:26.869799] session: bus: Received SR_DF_FRAME_BEGIN packet.
sr: [00:26.869867] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [00:26.869977] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [00:26.870062] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [00:26.870125] session: bus: Received SR_DF_FRAME_END packet.
sr: [00:26.870209] serial: Wrote 1/1 bytes.
sr: [00:26.870273] serial: Wrote 5/5 bytes.
sr: [00:26.870332] serial: Wrote 2/2 bytes.
sr: [00:26.870388] session: Stopping.
sr: [00:26.870433] hwdriver: rdtech-dps: Stopping acquisition.
sr: [00:26.870476] session: bus: Received SR_DF_END packet.
sr: [00:26.870545] session: fd_source_finalize: key 0x7f676400e460
sr: [00:26.870625] session: Stopped.
sr: [00:26.870865] device: rdtech-dps: Closing device instance.
sr: [00:27.326912] serial: Read 1/1 bytes.
sr: [00:27.326998] serial: Read 1/1 bytes.
sr: [00:27.327048] serial: Read 5/5 bytes.
sr: [00:27.327113] serial: Read 2/2 bytes.
sr: [00:27.327158] modbus_serial: CRC error (0x0000 vs 0xFDC3).
sr: [00:27.327233] serial: Wrote 1/1 bytes.
sr: [00:27.327299] serial: Wrote 8/8 bytes.
sr: [00:27.327369] serial: Wrote 2/2 bytes.
sr: [00:27.327435] serial: Read 1/1 bytes.
sr: [00:27.327480] serial: Closing serial port /dev/ttyUSB0.
BaseDevice::close(): Device closed  "RDTech DPS5005 v14"
BaseDevice::~BaseDevice():  "Demo device"
BaseDevice::close(): Trying to close device  "Demo device"
p
Caught exception: generic/unspecified error
BaseDevice::close(): Trying to close device  "RDTech DPS5005 v14"
sr: [01:11.521536] serial: Read 1/1 bytes.
sr: [01:11.521612] serial: Read 1/1 bytes.
sr: [01:11.521664] serial: Read 7/7 bytes.
sr: [01:11.521717] serial: Read 2/2 bytes.
sr: [01:11.521764] session: bus: Received SR_DF_FRAME_BEGIN packet.
sr: [01:11.521817] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.521973] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.522077] session: bus: Received SR_DF_ANALOG packet (1 samples).
Init analog signal  "P [W DC]" , signal_start_timestamp_ =  "2019.04.06 11:37:25.049"
Warning: Adding new signal  "P [W DC]" to fixed channel  "P"
HardwareChannel::push_sample_sr_analog():  "P"  - No signal found:  "P [W DC]"
sr: [01:11.522426] session: bus: Received SR_DF_FRAME_END packet.
sr: [01:11.522497] serial: Wrote 1/1 bytes.
sr: [01:11.522559] serial: Wrote 5/5 bytes.
sr: [01:11.522621] serial: Wrote 2/2 bytes.
sr: [01:11.978881] serial: Read 1/1 bytes.
sr: [01:11.978951] serial: Read 1/1 bytes.
sr: [01:11.979005] serial: Read 7/7 bytes.
sr: [01:11.979065] serial: Read 2/2 bytes.
sr: [01:11.979107] session: bus: Received SR_DF_FRAME_BEGIN packet.
sr: [01:11.979159] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.979258] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.979341] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.979403] session: bus: Received SR_DF_FRAME_END packet.
sr: [01:11.979477] serial: Wrote 1/1 bytes.
sr: [01:11.979538] serial: Wrote 5/5 bytes.
sr: [01:11.979603] serial: Wrote 2/2 bytes.
sr: [01:11.979648] session: Stopping.
sr: [01:11.979687] hwdriver: rdtech-dps: Stopping acquisition.
sr: [01:11.979727] session: bus: Received SR_DF_END packet.
sr: [01:11.979793] session: fd_source_finalize: key 0x7f18f400d7d0
sr: [01:11.979870] session: Stopped.
sr: [01:11.980146] device: rdtech-dps: Closing device instance.
sr: [01:12.436264] serial: Read 1/1 bytes.
sr: [01:12.436349] serial: Read 1/1 bytes.
sr: [01:12.436406] serial: Read 5/5 bytes.
sr: [01:12.436475] serial: Read 2/2 bytes.
sr: [01:12.436513] modbus_serial: CRC error (0x0000 vs 0xFDC3).
sr: [01:12.436582] serial: Wrote 1/1 bytes.
sr: [01:12.436647] serial: Wrote 8/8 bytes.
sr: [01:12.436734] serial: Wrote 2/2 bytes.
sr: [01:12.436794] serial: Read 1/1 bytes.
sr: [01:12.436828] serial: Closing serial port /dev/ttyUSB0.
BaseDevice::close(): Device closed  "RDTech DPS5005 v14"
BaseDevice::~BaseDevice():  "Demo device"
BaseDevice::close(): Trying to close device  "Demo device"

@littleyoda
Copy link

interesting!
I got the error normally after 10 to 20 min runing sigrok

@knarfS
Copy link
Owner

knarfS commented Apr 7, 2019

I've looked into the driver code, but without the device there is not much i can do. Unfortunately, the logs you attached doesn't help either.
I'm going to add a bunch of log outputs to the relevant parts and post an AppImage here asap. Maybe I get a clue somehow :)

Perhaps the error occurs so fast with SmuView because of the missing mutex? I'll add the mutex in the test AppImage too.
But that sounds like a sporadic error. Maybe the device sends a wrong checksum sometimes? Hopefully more log output will tell...

@littleyoda : You have a Korad psu, don't you? It would be great, if you could confirm the thing with the unreliable buttons and check if my fix is working (issue #7 ).

@littleyoda
Copy link

My Modell of the Korad psu do not have these buttons. Sorry, can not test it :-(

@robotfreak
Copy link
Author

I have done some further investigation. When thesigrok-cli is running in log level 5 I can see the crc error occuring, when the USB connection has been closed.
So this explains the different behaviours between the sigrok-cli and the smuview app. The smuview app closes the connection after init. The sigrok-cli keeps the connection open until you close the program itself.

sr: [01:11.521536] serial: Read 1/1 bytes.
sr: [01:11.521612] serial: Read 1/1 bytes.
sr: [01:11.521664] serial: Read 7/7 bytes.
sr: [01:11.521717] serial: Read 2/2 bytes.
sr: [01:11.521764] session: bus: Received SR_DF_FRAME_BEGIN packet.
sr: [01:11.521817] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.521973] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.522077] session: bus: Received SR_DF_ANALOG packet (1 samples).
Init analog signal  "P [W DC]" , signal_start_timestamp_ =  "2019.04.06 11:37:25.049"
Warning: Adding new signal  "P [W DC]" to fixed channel  "P"
HardwareChannel::push_sample_sr_analog():  "P"  - No signal found:  "P [W DC]"
sr: [01:11.522426] session: bus: Received SR_DF_FRAME_END packet.
sr: [01:11.522497] serial: Wrote 1/1 bytes.
sr: [01:11.522559] serial: Wrote 5/5 bytes.
sr: [01:11.522621] serial: Wrote 2/2 bytes.
sr: [01:11.978881] serial: Read 1/1 bytes.
sr: [01:11.978951] serial: Read 1/1 bytes.
sr: [01:11.979005] serial: Read 7/7 bytes.
sr: [01:11.979065] serial: Read 2/2 bytes.
sr: [01:11.979107] session: bus: Received SR_DF_FRAME_BEGIN packet.
sr: [01:11.979159] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.979258] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.979341] session: bus: Received SR_DF_ANALOG packet (1 samples).
sr: [01:11.979403] session: bus: Received SR_DF_FRAME_END packet.
sr: [01:11.979477] serial: Wrote 1/1 bytes.
sr: [01:11.979538] serial: Wrote 5/5 bytes.
sr: [01:11.979603] serial: Wrote 2/2 bytes.
sr: [01:11.979648] session: Stopping.
sr: [01:11.979687] hwdriver: rdtech-dps: Stopping acquisition.
sr: [01:11.979727] session: bus: Received SR_DF_END packet.
sr: [01:11.979793] session: fd_source_finalize: key 0x7f18f400d7d0
sr: [01:11.979870] session: Stopped.
sr: [01:11.980146] device: rdtech-dps: Closing device instance.
sr: [01:12.436264] serial: Read 1/1 bytes.
sr: [01:12.436349] serial: Read 1/1 bytes.
sr: [01:12.436406] serial: Read 5/5 bytes.
sr: [01:12.436475] serial: Read 2/2 bytes.
sr: [01:12.436513] modbus_serial: CRC error (0x0000 vs 0xFDC3).
sr: [01:12.436582] serial: Wrote 1/1 bytes.
sr: [01:12.436647] serial: Wrote 8/8 bytes.
sr: [01:12.436734] serial: Wrote 2/2 bytes.
sr: [01:12.436794] serial: Read 1/1 bytes.
sr: [01:12.436828] serial: Closing serial port /dev/ttyUSB0.
BaseDevice::close(): Device closed  "RDTech DPS5005 v14"
BaseDevice::~BaseDevice():  "Demo device"
BaseDevice::close(): Trying to close device  "Demo device"

@knarfS
Copy link
Owner

knarfS commented Apr 9, 2019

Hi robotfreak,
are you able to compile libsigrok/sigrok-cli/smuview by yourself? I've added the missing mutex and a whole bunch of debug output for the RDTech psu to my branch "patches": https://github.com/knarfS/libsigrok/commits/patches
Otherwise I can create an AppImage at the end of this week.

You don't need to add "-l 5" for the log output this time.
I don't know if we will see some useful info in the outputs, but i hope so.

@robotfreak
Copy link
Author

Hi knarfS,
ok, I build the libsigrok (branch patches) and smuview (master) by myself.
Here is the log output:

./smuview
Configurable::init(): Init  "A0"  - key  "Offset"
Configurable::init(): Init  "A0"  - key  "Measured Quantity"
Configurable::init(): Init  "A0"  - key  "Amplitude"
Configurable::init(): Init  "A0"  - key  "Pattern Mode"
Configurable::init(): Init  "A1"  - key  "Offset"
Configurable::init(): Init  "A1"  - key  "Measured Quantity"
Configurable::init(): Init  "A1"  - key  "Amplitude"
Configurable::init(): Init  "A1"  - key  "Pattern Mode"
Configurable::init(): Init  "A2"  - key  "Offset"
Configurable::init(): Init  "A2"  - key  "Measured Quantity"
Configurable::init(): Init  "A2"  - key  "Amplitude"
Configurable::init(): Init  "A2"  - key  "Pattern Mode"
Configurable::init(): Init  "A3"  - key  "Offset"
Configurable::init(): Init  "A3"  - key  "Measured Quantity"
Configurable::init(): Init  "A3"  - key  "Amplitude"
Configurable::init(): Init  "A3"  - key  "Pattern Mode"
Configurable::init(): Init  "Analog"  - key  "Offset"
Configurable::init(): Init  "Analog"  - key  "Amplitude"
Configurable::init(): Init  "Logic"  - key  "Pattern Mode"
Configurable::init(): Init  "Demo device"  - key  "Trigger Match"
Configurable::init(): Init  "Demo device"  - key  "Averaging Samples"
Configurable::init(): Init  "Demo device"  - key  "Averaging"
Configurable::init(): Init  "Demo device"  - key  "Capture Ratio"
Configurable::init(): Init  "Demo device"  - key  "Samplerate"
sr: rdtech-dps: probe_device(): -1-
sr: rdtech-dps: rdtech_dps_get_model_version(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 5, maxlen = 5
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x5
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x58EF
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x58EF (2)
sr: rdtech-dps: rdtech_dps_get_model_version(): -2- ret = 0
sr: rdtech-dps: probe_device(): -2- ret = 0
Configurable::init(): Init  "RDTech DPS5005"  - key  "Regulation"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Current Protection Threshold"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Current Protection Active"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Voltage Protection Threshold"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Over Voltage Protection Active"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Enabled"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Current Limit"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Current"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Voltage Target"
Configurable::init(): Init  "RDTech DPS5005"  - key  "Voltage"
sr: rdtech-dps: dev_open(): -1-
sr: rdtech-dps: rdtech_dps_set_reg(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x10
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0xEC01
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 4, maxlen = 4
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x0
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x1
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x2
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0xEC01
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0xC8E1
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0xC8E1 (2)
sr: rdtech-dps: rdtech_dps_set_reg(): -2- ret = 0
sr: rdtech-dps: dev_open(): -2- ret = 0
Init channel  "V" , channel_start_timestamp =  "2019.04.10 15:10:40.201"
Init channel  "I" , channel_start_timestamp =  "2019.04.10 15:10:40.201"
Init channel  "P" , channel_start_timestamp =  "2019.04.10 15:10:40.201"
Init analog base signal  "V [V DC]"
Init analog time signal  "V [V DC]" , signal_start_timestamp_ =  "2019.04.10 15:10:40.201"
Init analog base signal  "I [A DC]"
Init analog time signal  "I [A DC]" , signal_start_timestamp_ =  "2019.04.10 15:10:40.201"
Init analog base signal  "P [W]"
Init analog time signal  "P [W]" , signal_start_timestamp_ =  "2019.04.10 15:10:40.201"
Init channel  "" , channel_start_timestamp =  "2019.04.10 15:10:40.201"
Init analog base signal  "R [Ω]"
Init analog time signal  "R [Ω]" , signal_start_timestamp_ =  "2019.04.10 15:10:40.201"
Init channel  "" , channel_start_timestamp =  "2019.04.10 15:10:40.201"
Init analog base signal  "Wh [Wh]"
Init analog time signal  "Wh [Wh]" , signal_start_timestamp_ =  "2019.04.10 15:10:40.201"
Init channel  "" , channel_start_timestamp =  "2019.04.10 15:10:40.201"
Init analog base signal  "Ah [Ah]"
Init analog time signal  "Ah [Ah]" , signal_start_timestamp_ =  "2019.04.10 15:10:40.201"
sr: rdtech-dps: dev_acquisition_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: dev_acquisition_start(): -2- ret = 0
Start aquisition for  "RDTech DPS5005" ,  aquisition_start_timestamp_ =  "2019.04.10 15:10:40.201"
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
sr: rdtech-dps: config_get(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 7, maxlen = 7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xB
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xC
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0xB124
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0xB124 (2)
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_get_reg(): -1-
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 3, maxlen = 3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x2
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x8479
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x8479 (2)
sr: rdtech-dps: rdtech_dps_get_reg(): -2- ret = 0
sr: rdtech-dps: config_get(): -2-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
sr: rdtech-dps: config_get(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 7, maxlen = 7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xB
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xC
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x7191
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x7191 (2)
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_get_reg(): -1-
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 3, maxlen = 3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x2
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x44B8
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x44B8 (2)
sr: rdtech-dps: rdtech_dps_get_reg(): -2- ret = 0
sr: sr: rdtech-dps: config_get(): -2-
rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
sr: rdtech-dps: config_get(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 7, maxlen = 7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xB
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xC
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x7191
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x7191 (2)
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_get_reg(): -1-
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 3, maxlen = 3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x2
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x44B8
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x44B8 (2)
sr: rdtech-dps: rdtech_dps_get_reg(): -2- ret = 0
sr: rdtech-dps: config_get(): -2-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
sr: rdtech-dps: config_get(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 7, maxlen = 7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xB
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xC
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x7191
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x7191 (2)
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_get_reg(): -1-
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 3, maxlen = 3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x2
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x44B8
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x44B8 (2)
sr: rdtech-dps: rdtech_dps_get_reg(): -2- ret = 0
sr: sr: rdtech-dps: rdtech_dps_capture_start(): -1-
rdtech-dps: config_get(): -2-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
sr: rdtech-dps: config_get(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 7, maxlen = 7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xB
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xC
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0xB124
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0xB124 (2)
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: rdtech_dps_get_reg(): -1-
sr: rdtech-dps: rdtech_dps_get_reg(): -2- ret = -1
sr: rdtech-dps: config_get(): -2-
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
Caught exception: generic/unspecified error
BaseDevice::close(): Trying to close device  "RDTech DPS5005 v14"
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = -1
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 7, maxlen = 7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xB
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xC
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x7191
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x7191 (2)
sr: rdtech-dps: rdtech_dps_receive_data(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -3-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -2- ret = 0
sr: rdtech-dps: rdtech_dps_receive_data(): -4- ret = 0
sr: rdtech-dps: dev_close(): -1-
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 5, maxlen = 5
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x9
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0xA
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x3C72
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x0 (2)
sr: modbus_serial: CRC error (0x0000 vs 0x3C72).
sr: rdtech-dps: dev_close(): -2- ret = -10
sr: rdtech-dps: dev_close(): -3-
sr: rdtech-dps: rdtech_dps_set_reg(): -1-
sr: rdtech-dps: rdtech_dps_set_reg(): -2- ret = -1
sr: rdtech-dps: dev_close(): -4- ret = -1
BaseDevice::close(): Device closed  "RDTech DPS5005 v14"
BaseDevice::~BaseDevice():  "Demo device"
BaseDevice::close(): Trying to close device  "Demo device"


@robotfreak
Copy link
Author

Hi knarfS,

success. I got it working. The only change I made, is in the rdtech_dps_capture_start function. Setting devc->expecting_registers to 0, instead of 2. Not sure if this is the right way to fix it, but for me it works. Now the device_close function will never read any pending data.

SR_PRIV int rdtech_dps_capture_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_modbus_dev_inst *modbus;
	int ret;

	devc = sdi->priv;
	modbus = sdi->conn;

	g_mutex_lock(&devc->rw_mutex);
	sr_err("rdtech_dps_capture_start(): -1-");
	if ((ret = sr_modbus_read_holding_registers(modbus, REG_UOUT, 3, NULL)) == SR_OK)
		devc->expecting_registers = 0; 
	sr_err("rdtech_dps_capture_start(): -2- ret = %i", ret);
	g_mutex_unlock(&devc->rw_mutex);
	return ret;
}

@knarfS
Copy link
Owner

knarfS commented Apr 10, 2019

The CRC error was a red herring and only a subsequent error... :(
The actual error hasn't any interesting log output, but at least I can narrow it down.

I don't think your fix solved the actual error, though the expecting_registers thing doesn't make much sense the way it is implemented...

I updated my branch with more log output in the interesting parts. Would be great if you could attach a log without your patch and one with.
Sorry, but I rebased my patch branch, you have to "git fetch --all && git reset --hard origin/patches".

@robotfreak
Copy link
Author

Now I get a memory access violation error with or without my patch the log output looks the same:

.```
/smuview
Configurable::init(): Init "A0" - key "Offset"
Configurable::init(): Init "A0" - key "Measured Quantity"
Configurable::init(): Init "A0" - key "Amplitude"
Configurable::init(): Init "A0" - key "Pattern Mode"
Configurable::init(): Init "A1" - key "Offset"
Configurable::init(): Init "A1" - key "Measured Quantity"
Configurable::init(): Init "A1" - key "Amplitude"
Configurable::init(): Init "A1" - key "Pattern Mode"
Configurable::init(): Init "A2" - key "Offset"
Configurable::init(): Init "A2" - key "Measured Quantity"
Configurable::init(): Init "A2" - key "Amplitude"
Configurable::init(): Init "A2" - key "Pattern Mode"
Configurable::init(): Init "A3" - key "Offset"
Configurable::init(): Init "A3" - key "Measured Quantity"
Configurable::init(): Init "A3" - key "Amplitude"
Configurable::init(): Init "A3" - key "Pattern Mode"
Configurable::init(): Init "Analog" - key "Offset"
Configurable::init(): Init "Analog" - key "Amplitude"
Configurable::init(): Init "Logic" - key "Pattern Mode"
Configurable::init(): Init "Demo device" - key "Trigger Match"
Configurable::init(): Init "Demo device" - key "Averaging Samples"
Configurable::init(): Init "Demo device" - key "Averaging"
Configurable::init(): Init "Demo device" - key "Capture Ratio"
Configurable::init(): Init "Demo device" - key "Samplerate"
sr: rdtech-dps: probe_device(): -1-
sr: rdtech-dps: rdtech_dps_get_model_version(): -1-
sr: modbus: sr_modbus_read_holding_registers(): address = 0xB, nb_registers = 2
sr: modbus: sr_modbus_read_holding_registers(): request = 0x0 0x0 0x0 0x0 0x0
sr: modbus: sr_modbus_read_holding_registers(): request = 0x3 0x0 0xB 0x0 0x2
sr: modbus_serial: modbus_serial_rtu_send(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_send(): ret = 1
sr: modbus_serial: modbus_serial_rtu_send(): buffer_size = 5
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x5
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_send(): ret = 5
sr: modbus_serial: modbus_serial_rtu_send(): -1- crc = 0x807E (2)
sr: modbus_serial: modbus_serial_rtu_send(): -1- crc = 0xC9B5 (2)
sr: modbus_serial: modbus_serial_rtu_send(): ret = 2
sr: modbus: sr_modbus_read_holding_registers(): ret = 0
sr: modbus: sr_modbus_read_holding_registers(): registers = 0x7FB1 (32689)
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1), ret = 1
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x3, ret = 1
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 5, maxlen = 5
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x5
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x8
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0x2140
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0x58EF
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0x58EF (2)
sr: modbus: sr_modbus_read_holding_registers(): ret = 0
sr: modbus: sr_modbus_read_holding_registers(): -1-
sr: modbus: sr_modbus_read_holding_registers(): -2-
sr: modbus: sr_modbus_read_holding_registers(): -3-
sr: modbus: sr_modbus_read_holding_registers(): registers = 0x8D13 (36115)
sr: modbus: sr_modbus_read_holding_registers(): -4-
sr: rdtech-dps: rdtech_dps_get_model_version(): -2- ret = 0
sr: rdtech-dps: probe_device(): -2- ret = 0
Configurable::init(): Init "RDTech DPS5005" - key "Regulation"
Configurable::init(): Init "RDTech DPS5005" - key "Over Current Protection Threshold"
Configurable::init(): Init "RDTech DPS5005" - key "Over Current Protection Active"
Configurable::init(): Init "RDTech DPS5005" - key "Over Voltage Protection Threshold"
Configurable::init(): Init "RDTech DPS5005" - key "Over Voltage Protection Active"
Configurable::init(): Init "RDTech DPS5005" - key "Enabled"
Configurable::init(): Init "RDTech DPS5005" - key "Current Limit"
Configurable::init(): Init "RDTech DPS5005" - key "Current"
Configurable::init(): Init "RDTech DPS5005" - key "Voltage Target"
Configurable::init(): Init "RDTech DPS5005" - key "Voltage"
sr: rdtech-dps: dev_open(): -1-
sr: rdtech-dps: rdtech_dps_set_reg(): -1-
sr: modbus_serial: modbus_serial_rtu_send(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_send(): ret = 1
sr: modbus_serial: modbus_serial_rtu_send(): buffer_size = 8
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x10
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x11
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x12
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x13
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x14
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x15
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x16
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x17
sr: modbus_serial: modbus_serial_rtu_send(): ret = 8
sr: modbus_serial: modbus_serial_rtu_send(): -1- crc = 0x807E (2)
sr: modbus_serial: modbus_serial_rtu_send(): -1- crc = 0xF667 (2)
sr: modbus_serial: modbus_serial_rtu_send(): ret = 2
sr: modbus_serial: modbus_serial_rtu_read_begin(): slave_addr = 0x1 (1), ret = 1
sr: modbus_serial: modbus_serial_rtu_read_data(): function_code = 0x10, ret = 1
sr: modbus_serial: modbus_serial_rtu_read_begin(): -1- modbus->crc = 0x807E
sr: modbus_serial: modbus_serial_rtu_read_begin(): -2- modbus->crc = 0xEC01
sr: modbus_serial: modbus_serial_rtu_read_data(): len = 4, maxlen = 4
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x0
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x1
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x2
sr: modbus_serial: modbus_serial_rtu_read_data(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_read_data(): -1- modbus->crc = 0xEC01
sr: modbus_serial: modbus_serial_rtu_read_data(): -2- modbus->crc = 0xC8E1
sr: modbus_serial: modbus_serial_rtu_read_end(): crc = 0xC8E1 (2)
sr: rdtech-dps: rdtech_dps_set_reg(): -2- ret = 0
sr: rdtech-dps: dev_open(): -2- ret = 0
Init channel "V" , channel_start_timestamp = "2019.04.10 22:24:20.203"
Init channel "I" , channel_start_timestamp = "2019.04.10 22:24:20.203"
Init channel "P" , channel_start_timestamp = "2019.04.10 22:24:20.203"
Init analog base signal "V [V DC]"
Init analog time signal "V [V DC]" , signal_start_timestamp_ = "2019.04.10 22:24:20.203"
Init analog base signal "I [A DC]"
Init analog time signal "I [A DC]" , signal_start_timestamp_ = "2019.04.10 22:24:20.203"
Init analog base signal "P [W]"
Init analog time signal "P [W]" , signal_start_timestamp_ = "2019.04.10 22:24:20.203"
Init channel "" , channel_start_timestamp = "2019.04.10 22:24:20.203"
Init analog base signal "R [Ω]"
Init analog time signal "R [Ω]" , signal_start_timestamp_ = "2019.04.10 22:24:20.203"
Init channel "" , channel_start_timestamp = "2019.04.10 22:24:20.203"
Init analog base signal "Wh [Wh]"
Init analog time signal "Wh [Wh]" , signal_start_timestamp_ = "2019.04.10 22:24:20.203"
Init channel "" , channel_start_timestamp = "2019.04.10 22:24:20.203"
Init analog base signal "Ah [Ah]"
Init analog time signal "Ah [Ah]" , signal_start_timestamp_ = "2019.04.10 22:24:20.203"
sr: rdtech-dps: dev_acquisition_start(): -1-
sr: rdtech-dps: rdtech_dps_capture_start(): -1-
sr: modbus: sr_modbus_read_holding_registers(): address = 0x2, nb_registers = 3
sr: modbus: sr_modbus_read_holding_registers(): request = 0x0 0x0 0x0 0x0 0x0
sr: modbus: sr_modbus_read_holding_registers(): request = 0x3 0x0 0x2 0x0 0x3
sr: modbus_serial: modbus_serial_rtu_send(): slave_addr = 0x1 (1)
sr: modbus_serial: modbus_serial_rtu_send(): ret = 1
sr: modbus_serial: modbus_serial_rtu_send(): buffer_size = 5
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x3
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x4
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x5
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x6
sr: modbus_serial: modbus_serial_rtu_send(): buf = 0x7
sr: modbus_serial: modbus_serial_rtu_send(): ret = 5
sr: modbus_serial: modbus_serial_rtu_send(): -1- crc = 0x807E (2)
sr: modbus_serial: modbus_serial_rtu_send(): -1- crc = 0xBA4 (2)
sr: modbus_serial: modbus_serial_rtu_send(): ret = 2
sr: modbus: sr_modbus_read_holding_registers(): ret = 0
Speicherzugriffsfehler (Speicherabzug geschrieben)

@knarfS
Copy link
Owner

knarfS commented Apr 10, 2019

Ups, my bad.
I updated my branch.

@robotfreak
Copy link
Author

ok, here are the logfiles for the updates branch with and without my patch.
smuview-patches3-log.txt
smuview-mypatches3-log.txt

@knarfS
Copy link
Owner

knarfS commented Apr 14, 2019

Development moved to https://github.com/knarfS/libsigrok/tree/patches2

Both tests failed, when trying to get the ovp_active config key. The code for getting the config key looks OK, as far as I can tell.

Could you try to get the key with sigrok-cli (replace conn string with your settings):
sigrok-cli -d rdtech-dps:conn=/dev/ttyUSB0 --get ovp_active -l 5
This will probably fail too:
sigrok-cli -d rdtech-dps:conn=/dev/ttyUSB0 --get ocp_active -l 5

Next thing I can do is deactivate this two config key and then testing if there are other config keys that are failing.
But without the device it is very hard to tell what's wrong with those config keys...

@robotfreak
Copy link
Author

Here are the log files for ovp and ocp active config key:
smuview-patches2-ovp.txt
smuview-patches2-ocp.txt

@knarfS
Copy link
Owner

knarfS commented Apr 15, 2019

I think I got it! It was hopefully only a timeout that was set to low.
Please attach another log output, so I can properly adjust the timeout.
I've moved development to https://github.com/knarfS/libsigrok/tree/patches2

@robotfreak
Copy link
Author

Here are the log files. The serial_read_blocking time varies from 33...124 for ovp, 19...91 for ocp.
smuview-patches2-ovp2.txt
smuview-patches2-ocp2.txt

@knarfS
Copy link
Owner

knarfS commented Apr 15, 2019

The important duration is 1st serial_read_blocking() in modbus_serial_rtu_read_begin() which is around 450ms. Pretty close to the former timeout of 500ms.

But the most important question: Is SmuView working now?

@robotfreak
Copy link
Author

No, smuview don't work. Here is the log:
smuview-patches2-log.txt

@knarfS
Copy link
Owner

knarfS commented Apr 16, 2019

Yeah, but my assumption was right ;) However the timeout of 1000ms was still to low...
I increased the timeout to 5s, that should hopefully be enough.

@robotfreak
Copy link
Author

Cool, now smuview is working. Thank you so much knarfS

@knarfS
Copy link
Owner

knarfS commented Apr 16, 2019

Could you attach the log output, so I can adjust the timeouts and make a pull request to libsigrok.

@robotfreak
Copy link
Author

Damn, this is too bad. Yesterday smuview is working, today not. Here is the logfile from today. I have not got one from yesterday.
smuview-notok.txt

@knarfS
Copy link
Owner

knarfS commented Apr 17, 2019

It's again the timeout. Seems like sometimes 5s isn't enough. Puhhh....

Could you play around with the timeout by yourself? You'll find it in src/modbus/modbus_serial_rtu.c, line 148. I'd start with 20000ms (THAT should be enough) and then look at the time in the log ("modbus_serial_rtu_read_begin(): 1st serial_read_blocking() time =") and adjust it down. When SmuView is running stable, start to change the output voltage, current, toggle the output, etc. to stress the power supplies lil' CPU and check if the duration of the serial_read_blocking() is rising...

@robotfreak
Copy link
Author

robotfreak commented Apr 22, 2019

Sorry, but I don't get the timeout working. Even 40s isn't enough. At the moment the chances are 50:50 to start smuview succesfsully. If smuview starts successfully, the blocking time is always less than 5s.
smuview-log-not-ok.txt
smuview-log2.txt

@knarfS
Copy link
Owner

knarfS commented May 1, 2019

Sorry for the late reply.
I pushed a possible workaround to my patches2 branch (rebased!): The sr_modbus_read_holding_registers() function is now called up to 3 times if it fails. i also decreased the timeout back to reasonable 600ms.
Let's see if it's working now...

@robotfreak
Copy link
Author

No worry. Now it is working like a charm. Phantastic job!
smuview-log2.txt

@knarfS
Copy link
Owner

knarfS commented May 22, 2019

I moved the patches for the RDTech power supplies back to my branch "patches" (https://github.com/knarfS/libsigrok/commits/patches).
I refined the commits (a few debug outputs are left, but will be removed before I make a pull request).

I also added meta packages: When the regulation (CV/CC) or the output state changes or one of the protections (OVP/OCP) is triggered, that will be displayed in SmuView.

I would be happy, if you could test my changes again and append a log file with log level 5 (./smuview -l 5)

@robotfreak
Copy link
Author

Here are the log files (first failed connection, second successful connection):
smuview-patches-nok.txt
smuview-patches-ok.txt

@knarfS
Copy link
Owner

knarfS commented Feb 18, 2020

Most of the issues should be fixed in libsigrok since 16.12.2019 and are now available in the SmuView 0.0.4 binaries.

@knarfS knarfS closed this as completed Feb 18, 2020
@17acres
Copy link

17acres commented Mar 20, 2020

Most of the issues should be fixed in libsigrok since 16.12.2019 and are now available in the SmuView 0.0.4 binaries.

Can anyone confirm that the x86_64 appimage from 0.0.4 is working for the DPS? I tried on both Windows and Ubuntu and experienced the same CRC error with the files from the latest release. I've confirmed that the DPS works properly using RD Tech's software on Windows, so I don't think it's a problem on my hardware. I tried building from source on Ubuntu and ran into python issues using either the method from the SmuView manual or the Sigrok Building from Source page.

@knarfS
Copy link
Owner

knarfS commented Mar 21, 2020

Can anyone confirm that the x86_64 appimage from 0.0.4 is working for the DPS? I tried on both Windows and Ubuntu and experienced the same CRC error with the files from the latest release. I've confirmed that the DPS works properly using RD Tech's software on Windows, so I don't think it's a problem on my hardware.

I've implemented a workaround in the sigrok driver for the DPS devices some time ago (see sigrokproject/libsigrok@aff2094). Because I don't own one of those PSUs, I can't do a proper investigation of that problem.
What I can tell so far: Sometimes the device doesn't respond to the "read holding registers" modbus command. The workaround tries to read the registers up to 3 times.
Somebody with that devices has to do some deeper investigation and maybe debug the protocol the vendor is using in its software and tweak the sigrok driver.

I tried building from source on Ubuntu and ran into python issues using either the method from the SmuView manual or the Sigrok Building from Source page.

Can you give some details about that (CMake and/or make output)? Probably a missing dependency or something similar. Maybe open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants