cronologic-de / xhptdc8_babel

Wrappers, Utilities and Examples for using the xHPTDC8 with various programming languages.
Mozilla Public License 2.0
0 stars 1 forks source link

All Elements YAML example does not work with xhptdc8_readout_64 #43

Closed ahofmann75 closed 3 years ago

ahofmann75 commented 3 years ago

             xHPTDC8 Readout Tool Application

Initializing xHPTDC8 device... Done

Installed Devices Serials for TDC(s): 1 1) index 0: xHPTDC8 serial 20.273

Configuring device using YAML file(s) thread 'main' panicked at 'Error getting current configuration.: 4', src\readout_aux.rs:478:23 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace File .\grp_cfg.yaml... Error: -83

Bassem-Ramzy commented 3 years ago

@ahofmann75 Function xhptdc8_get_current_configuration returned 4, which is equivalent to CRONO_WRONG_STATE in crono_interface.h (when a capture on a closed card is called). Is there any prerequisite to calling xhptdc8_get_current_configuration other than calling xhptdc8_init?

ahofmann75 commented 3 years ago

For xhptdc8_get_current_configuration() to work the device must at least be configured. xhptdc8_configure() must have been called at least once. To get the default configuration use xhptdc8_get_default_configuration().

Bassem-Ramzy commented 3 years ago

@ahofmann75 Most probably the yaml is not parsed properly. I added a check and an information message. Please test again, and let me know. If it displays an error with Yaml, please send me the yaml to test with

ahofmann75 commented 3 years ago

YAML file copied from "All Elements YAML" in https://github.com/cronologic-de/xhptdc8_babel/blob/main/util/README.md Result: Error -83 Error applying yaml.

Complete output

PS C:\Users\andreas\Desktop\yaml-test> .\xhptdc8_readout_64.exe -c .\all_elements.yaml
-----------------------------------------------------------------------------
                 xHPTDC8 Readout Tool Application
-----------------------------------------------------------------------------

Initializing xHPTDC8 device... Done

Installed Devices Serials for TDC(s): 3
1) index 0: xHPTDC8 serial 21.348
2) index 1: xHPTDC8 serial 21.349
3) index 2: xHPTDC8 serial 21.351
Getting default cconfiguration

Configuring device using YAML file(s)
Applied yaml node ([0]) on conifguation (auto_trigger_period) integer value (20)
Applied yaml node ([0]) on conifguation (auto_trigger_random_exponent) integer value (20)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.349900)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.350000)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.366660)
Applied yaml node ([0]) on conifguation (falling) boolean value (false)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([0]) on conifguation (mode) integer value (1)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (10)
Applied yaml node ([0]) on conifguation (stop) integer value (190)
Applied yaml node ([0]) on conifguation (sources) integer value (1)
Applied yaml node ([0]) on conifguation (mode) integer value (2)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (20)
Applied yaml node ([0]) on conifguation (stop) integer value (200)
Applied yaml node ([0]) on conifguation (sources) integer value (2)
Applied yaml node ([0]) on conifguation (enable) boolean value (true)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (enable) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_readout) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_interval) integer value (5)
File .\all_elements.yaml... Error: -83Error applying yaml.

Cleaning up... Done
ahofmann75 commented 3 years ago

When using an empty yaml file the application crashes with a Microsoft Visual C++ Runtime Library Debug Error "abort() has been called":

PS C:\Users\andreas\Desktop\yaml-test> .\xhptdc8_readout_64.exe -c .\empty.yaml
-----------------------------------------------------------------------------
                 xHPTDC8 Readout Tool Application
-----------------------------------------------------------------------------

Initializing xHPTDC8 device... Done

Installed Devices Serials for TDC(s): 3
1) index 0: xHPTDC8 serial 21.348
2) index 1: xHPTDC8 serial 21.349
3) index 2: xHPTDC8 serial 21.351
Getting default cconfiguration

Configuring device using YAML file(s)
ERROR: expected true: _p(node)->is_map()
PS C:\Users\andreas\Desktop\yaml-test>
Bassem-Ramzy commented 3 years ago

YAML file copied from "All Elements YAML" in https://github.com/cronologic-de/xhptdc8_babel/blob/main/util/README.md Result: Error -83 Error applying yaml.

Complete output

PS C:\Users\andreas\Desktop\yaml-test> .\xhptdc8_readout_64.exe -c .\all_elements.yaml
-----------------------------------------------------------------------------
                 xHPTDC8 Readout Tool Application
-----------------------------------------------------------------------------

Initializing xHPTDC8 device... Done

Installed Devices Serials for TDC(s): 3
1) index 0: xHPTDC8 serial 21.348
2) index 1: xHPTDC8 serial 21.349
3) index 2: xHPTDC8 serial 21.351
Getting default cconfiguration

Configuring device using YAML file(s)
Applied yaml node ([0]) on conifguation (auto_trigger_period) integer value (20)
Applied yaml node ([0]) on conifguation (auto_trigger_random_exponent) integer value (20)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.349900)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.350000)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.366660)
Applied yaml node ([0]) on conifguation (falling) boolean value (false)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([0]) on conifguation (mode) integer value (1)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (10)
Applied yaml node ([0]) on conifguation (stop) integer value (190)
Applied yaml node ([0]) on conifguation (sources) integer value (1)
Applied yaml node ([0]) on conifguation (mode) integer value (2)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (20)
Applied yaml node ([0]) on conifguation (stop) integer value (200)
Applied yaml node ([0]) on conifguation (sources) integer value (2)
Applied yaml node ([0]) on conifguation (enable) boolean value (true)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (enable) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_readout) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_interval) integer value (5)
File .\all_elements.yaml... Error: -83Error applying yaml.

Cleaning up... Done

I updated the wiki documentation for trigger_threshold to have a valid value after fixing the code based on issue #41. trigger_threshold=1

Bassem-Ramzy commented 3 years ago

@ahofmann75 Please use the latest code/exe after change, test again, and let me know.

I'm getting the following, as I don't have a device

C:\Users\basse\source\repos\xhptdc8_babel\rust\bin\x64>xhptdc8_readout_64.exe -c C:\temp\crono\test.yaml
-----------------------------------------------------------------------------
                 xHPTDC8 Readout Tool Application
-----------------------------------------------------------------------------

Initializing xHPTDC8 device... Done

Installed Devices Serials for TDC(s): 1
1) index 0: xHPTDC8 serial 21.108
Getting default cconfiguration

Configuring device using YAML file(s)
Applied yaml node ([0]) on conifguation (auto_trigger_period) integer value (20)
Applied yaml node ([0]) on conifguation (auto_trigger_random_exponent) integer value (20)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.349900)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.350000)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.366660)
Applied yaml node ([0]) on conifguation (falling) boolean value (false)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([0]) on conifguation (mode) integer value (1)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (10)
Applied yaml node ([0]) on conifguation (stop) integer value (190)
Applied yaml node ([0]) on conifguation (sources) integer value (1)
Applied yaml node ([0]) on conifguation (mode) integer value (2)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (20)
Applied yaml node ([0]) on conifguation (stop) integer value (200)
Applied yaml node ([0]) on conifguation (sources) integer value (2)
Applied yaml node ([0]) on conifguation (enable) boolean value (true)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (enable) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_readout) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_interval) integer value (5)
Applied yaml node ([adc_channel]) on conifguation (trigger_threshold) double value (1.000000)
Applied yaml node ([0]) on conifguation (skip_alignment) boolean value (true)
Applied yaml node ([0]) on conifguation (alignment_source) integer value (1)
Applied yaml node ([grouping]) on conifguation (enabled) boolean value (true)
Applied yaml node ([grouping]) on conifguation (trigger_channel) integer value (3)
Applied yaml node ([grouping]) on conifguation (zero_channel) integer value (2)
Applied yaml node ([grouping]) on conifguation (zero_channel_offset) double value (1.000000)
Applied yaml node ([grouping]) on conifguation (range_start) long long value (12345)
Applied yaml node ([grouping]) on conifguation (range_stop) long long value (23456)
Applied yaml node ([grouping]) on conifguation (trigger_deadtime) long long value (25)
Applied yaml node ([grouping]) on conifguation (window_start) long long value (10)
Applied yaml node ([grouping]) on conifguation (window_stop) long long value (20)
Applied yaml node ([grouping]) on conifguation (veto_mode) integer value (2)
Applied yaml node ([grouping]) on conifguation (veto_start) long long value (30)
Applied yaml node ([grouping]) on conifguation (veto_stop) long long value (40)
Applied yaml node ([grouping]) on conifguation (veto_relative_to_zero) boolean value (true)
File C:\temp\crono\test.yaml... Parsed
Done
thread 'main' panicked at 'Error start capturing: 4', src\readout_aux.rs:508:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ahofmann75 commented 3 years ago

The All Elements YAML on https://github.com/cronologic-de/xhptdc8_babel/tree/main/util#all-elements-yaml is still broken.

PS C:\Users\andreas\Desktop\yaml-test> .\xhptdc8_readout_64.exe -c .\all_elements.yaml
-----------------------------------------------------------------------------
                 xHPTDC8 Readout Tool Application
-----------------------------------------------------------------------------

Initializing xHPTDC8 device... Done

Installed Devices Serials for TDC(s): 1
1) index 0: xHPTDC8 serial 21.348
Getting default cconfiguration

Configuring device using YAML file(s)
Applied yaml node ([0]) on conifguation (auto_trigger_period) integer value (20)
Applied yaml node ([0]) on conifguation (auto_trigger_random_exponent) integer value (20)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.349900)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.350000)
Applied yaml node ([0]) on conifguation (trigger_threshold) double value (0.366660)
Applied yaml node ([0]) on conifguation (falling) boolean value (false)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([0]) on conifguation (mode) integer value (1)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (10)
Applied yaml node ([0]) on conifguation (stop) integer value (190)
Applied yaml node ([0]) on conifguation (sources) integer value (1)
Applied yaml node ([0]) on conifguation (mode) integer value (2)
Applied yaml node ([0]) on conifguation (negate) boolean value (true)
Applied yaml node ([0]) on conifguation (retrigger) boolean value (true)
Applied yaml node ([0]) on conifguation (start) integer value (20)
Applied yaml node ([0]) on conifguation (stop) integer value (200)
Applied yaml node ([0]) on conifguation (sources) integer value (2)
Applied yaml node ([0]) on conifguation (enable) boolean value (true)
Applied yaml node ([0]) on conifguation (rising) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (enable) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_readout) boolean value (true)
Applied yaml node ([adc_channel]) on conifguation (watchdog_interval) integer value (5)
Applied yaml node ([adc_channel]) on conifguation (trigger_threshold) double value (1.000000)
Applied yaml node ([0]) on conifguation (skip_alignment) boolean value (true)
Applied yaml node ([0]) on conifguation (alignment_source) integer value (1)
Applied yaml node ([grouping]) on conifguation (enabled) boolean value (true)
Applied yaml node ([grouping]) on conifguation (trigger_channel) integer value (3)
Applied yaml node ([grouping]) on conifguation (zero_channel) integer value (2)
Applied yaml node ([grouping]) on conifguation (zero_channel_offset) double value (1.000000)
Applied yaml node ([grouping]) on conifguation (range_start) long long value (12345)
Applied yaml node ([grouping]) on conifguation (range_stop) long long value (23456)
Applied yaml node ([grouping]) on conifguation (trigger_deadtime) long long value (25)
Applied yaml node ([grouping]) on conifguation (window_start) long long value (10)
Applied yaml node ([grouping]) on conifguation (window_stop) long long value (20)
Applied yaml node ([grouping]) on conifguation (veto_mode) integer value (2)
Applied yaml node ([grouping]) on conifguation (veto_start) long long value (30)
Applied yaml node ([grouping]) on conifguation (veto_stop) long long value (40)
Applied yaml node ([grouping]) on conifguation (veto_relative_to_zero) boolean value (true)
File .\all_elements.yaml... Parsed
 Error: 9Error applying yaml.

Cleaning up... Done
ahofmann75 commented 3 years ago

Having looked at the Rust source code the xhptdc_driver complains about invalid config paramters. The driver provides a function called xhptdc8_get_last_error_message() that returns a message string with detailed information. This should be printed if xhptdc8_configure() fails for any reason.

ahofmann75 commented 3 years ago

watchdog_interval : 5 is an invalid value for the configuration field. If a valid value is entered configuration succeeds.