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

Info-Tool: small bugs #39

Closed crono-melissa closed 3 years ago

crono-melissa commented 3 years ago

Hey, I finally had time AND equipment to test the info-tool with real hardware (single device) and it mostly works fine. Bugs I found:

This: PS C:\Users\Melissa\Desktop\i_git_t\xhptdc8_babel\go\bin\x64> .\xhptdc8_info_64.exe -tdc=20.277 -all outputs: Error: Board index entered < 20 > is out of bound.

Bassem-Ramzy commented 3 years ago

@crono-melissa For the first point, it runs on dummy driver using command line xhptdc8_info_64.exe -tdc=0 -param on my machine as following:

C:\Users\basse\source\repos\xhptdc8_babel\go\info\src-cgo>xhptdc8_info_64.exe -tdc=0 -param
-----------------------------------------------------------------------------
               xHPTDC8 Information Utility Application
-----------------------------------------------------------------------------

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

param_info of xHPTDC8 serial 21.108 at index 0
{
  "binsize": 0,
  "channels": 8,
  "channel_mask": 0,
  "total_buffer": 0
}
-----------------------------------------------------------------------------
                          End of Application
-----------------------------------------------------------------------------

Please try -tdc=0 by index instead of serial number, and let me know. As, it might be related to the second bug reported.

crono-melissa commented 3 years ago

@Bassem-Ramzy this is exactly what I did (if I try to call the device by serial there is absolutely no output).

PS C:\Users\Melissa\Desktop\i_git_t\xhptdc8_babel\go\bin\x64> .\xhptdc8_info_64.exe -tdc=0 -param

           xHPTDC8 Information Utility Application

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


                      End of Application

Each of the other flags creates the intended output (I'm only not sure, if we provide FPGA temperature measurements here):

PS C:\Users\Melissa\Desktop\i_git_t\xhptdc8_babel\go\bin\x64> .\xhptdc8_info_64.exe -tdc=0 -all -v

           xHPTDC8 Information Utility Application

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

clock_info of xHPTDC8 serial 20.000017 at index 0 { "size": 20, "version": 1, "cdce_locked": 1, "cdce_version": 2, "use_ext_clock": 0, "fpga_locked": 1 } fast_info of xHPTDC8 serial 20.000017 at index 0 { "size": 32, "version": 2, "fpga_rpm": 0, "alerts": 0, "pcie_pwr_mgmt": 0, "pcie_link_width": 1, "pcie_max_payload": 128, "state": 1 } static_info of xHPTDC8 serial 20.000017 at index 0 { "size": 80, "version": 1, "board_id": 0, "driver_revision": 4608, "driver_build_revision": 1907, "firmware_revision": 2, "board_revision": 2, "board_configuration": 1, "subversion_revision": 1088, "chip_id": [ 32784, 32784 ], "board_serial": 20.000017, "flash_serial_high": 792409439, "flash_serial_low": 648308690, "flash_valid": 1, "calibration_date": "2021-02-01 19:39" } temperature_info of xHPTDC8 serial 20.000017 at index 0 { "size": 16, "version": 3, "tdc": [ 31.2, 32.3 ], "fpga": 0 }

                      End of Application

Bassem-Ramzy commented 3 years ago

For point #2 please test using this exe? xhptdc8_info_64.zip It should display the following two lines first for debugging purpose:

C:\Users\basse\source\repos\xhptdc8_babel\go\info\src-cgo>xhptdc8_info_64.exe -tdc=20.277 -param
Serial from device static information:  354133472
Serial Number Entered is < 20.277 >.
Error: Serial number entered < 20.277 > is not found.
-----------------------------------------------------------------------------
               xHPTDC8 Information Utility Application
-----------------------------------------------------------------------------

Please share the results when you run it

crono-melissa commented 3 years ago

windows cmd outputs the following: C:\Users\Melissa\Desktop\xhptdc8_info_64> xhptdc8_info_64.exe -tdc=20.277 -param Serial from device static information: 335544597 Serial Number Entered is < 20.277 >. Error: Serial number entered < 20.277 > is not found.

           xHPTDC8 Information Utility Application

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

About the application Command: xhptdc8_info.exe [TDC] [Flags] Usage: [TDC] is either an integer as the index of the TDC, or a serial number of the TDC [Flags] Can be one or more of the following flags: -tdc=[TDC] is either an integer as the index of the TDC, or a serial number of the TDC -v show size and version information for all selected structures -static show static_info -temp show temperature_info -temperature show_temperature_info -fast show fast_info -param show param_info -clock show clock_info -all show all infos structures -h show this help -d output requested data in JSON only with no headers


                      End of Application

Powershell seems to set the argument to a different type:

PS C:\Users\Melissa\Desktop\xhptdc8_info_64> .\xhptdc8_info_64.exe -tdc=20.277 -param Serial from device static information: 335544597 Serial Number Entered is < 20 >. Error: Board index entered < 20 > is out of bound.

           xHPTDC8 Information Utility Application

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

About the application Command: xhptdc8_info.exe [TDC] [Flags] Usage: [TDC] is either an integer as the index of the TDC, or a serial number of the TDC [Flags] Can be one or more of the following flags: -tdc=[TDC] is either an integer as the index of the TDC, or a serial number of the TDC -v show size and version information for all selected structures -static show static_info -temp show temperature_info -temperature show_temperature_info -fast show fast_info -param show param_info -clock show clock_info -all show all infos structures -h show this help -d output requested data in JSON only with no headers


                      End of Application

PS C:\Users\Melissa\Desktop\xhptdc8_info_64>

Bassem-Ramzy commented 3 years ago

Regarding to PowerShell, that's why I'm using cmd instead. PowerShell for a reason or another doesn't handle 20.277 as a full float, but processes the . separately, so, we can use the following with PS, with serial enclosed within two Single quotations:

.\xhptdc8_info_64.exe -tdc='20.277' -param

Will get

PS C:\Users\basse\source\repos\xhptdc8_babel\go\info\src-cgo> .\xhptdc8_info_64.exe -tdc='20.277' -param
Serial from device static information:  354133472
Serial Number Entered is < 20.277 >.
Error: Serial number entered < 20.277 > is not found.
-----------------------------------------------------------------------------
               xHPTDC8 Information Utility Application
-----------------------------------------------------------------------------
crono-melissa commented 3 years ago

Good to know, that explains why the input was not considered to be a serial (must contain ".") and caused the 'weirder' error. So there ist probably just an error in copying/converting/parsing the serial. And still param_info is not shown, but that could also belong to driver changes/bugs.

This is working (with each of the binaries): C:\Users\Melissa\Desktop\xhptdc8_info_64> xhptdc8_info_64.exe -tdc=20.000017 -param Serial from device static information: 335544597 Serial Number Entered is < 20.000017 >.

           xHPTDC8 Information Utility Application

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


                      End of Application

C:\Users\Melissa\Desktop\xhptdc8_info_64>

Bassem-Ramzy commented 3 years ago

@crono-melissa Could you please share with me the algorithm/code of converting fixed824 to float and vice versa?

Bassem-Ramzy commented 3 years ago

@crono-melissa I've updated the code for the serial number, should be fixed, new exes are found on go/bin/, please check and let me know As for -param, I'll add extra error messages for more clarification

crono-melissa commented 3 years ago

Perfect, the serial-bug is fixed:

C:\Users\Melissa\Desktop\i_git_t\xhptdc8_babel\go\bin\x64>xhptdc8_info_64.exe -tdc=20.277

           xHPTDC8 Information Utility Application

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

static_info of xHPTDC8 serial 20.277 at index 0 { "board_id": 0, "driver_revision": 4608, "driver_build_revision": 1907, "firmware_revision": 2, "board_revision": 2, "board_configuration": 1, "subversion_revision": 1088, "chip_id": [ 32784, 32784 ], "board_serial": 20.277, "flash_serial_high": 792409439, "flash_serial_low": 648308690, "flash_valid": 1, "calibration_date": "2021-02-01 19:39" }

                      End of Application

And this is the param-debug-output: C:\Users\Melissa\Desktop\i_git_t\xhptdc8_babel\go\bin\x64>xhptdc8_info_64.exe -tdc=20.277 -param

           xHPTDC8 Information Utility Application

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

4 Error displaying param info: 4

                      End of Application

Bassem-Ramzy commented 3 years ago

@sulimma In the driver code:

int XHPTDC8::GetParamInfo(xhptdc8_param_info *param_info)
{
    if ((state == DeviceState::CREATED) || (state == DeviceState::INITIALIZED)) {
        Error("Device is not configured, ParamInfo not yet available.");
        return XHPTDC8_WRONG_STATE;
    }
.
.
  1. In info tool, we should call xhptdc8_configure with default configuration when calling get_param_info, right?
  2. In Dummy library, I will check the same states in get_param_info, right?
sulimma commented 3 years ago

1) Sorry, that is my fault. I did not realize that get_param_info is dependent on the configuration. Please remove the param feature from the info tool. It does not make sense.

2) Yes. Modeling this behavior is easy to do in the dummy library so please add it.

sulimma commented 3 years ago

@Bassem-Ramzy : Regarding the serial numer: 8.24 means that there are 8 bits for the year-2000 and 24 bits for the running serial number. 20.277 should be 0x14000115 or decimal 335.544.597. (0x14 is 20 and 0x000115 is 277)

20.017 should be 0x14000011 or decimal 335.544.337

So conversion is: year = serial >> 24 id = serial & 0xffffff

Bassem-Ramzy commented 3 years ago

@Bassem-Ramzy : Regarding the serial numer: 8.24 means that there are 8 bits for the year-2000 and 24 bits for the running serial number. 20.277 should be 0x14000115 or decimal 335.544.597. (0x14 is 20 and 0x000115 is 277)

20.017 should be 0x14000011 or decimal 335.544.337

So conversion is: year = serial >> 24 id = serial & 0xffffff

Crystal clear, thanks Kolja