Reading raw data from X4M02 sensor using MATLAB

Discussion in 'Module Connector (MC)' started by pmazurek, Aug 13, 2019.

  1. pmazurek

    pmazurek New Member

    Hello,
    is it possible to read raw data frames from X4M02 sensor using MATLAB?

    Unfortunately, none of the examples, that can be found on https://github.com/xethru/XeThru_ModuleConnector_Examples/tree/master/MATLAB, addresses this issue directly. I was trying to use the XEP_X4_plot_frame.m script available in the package found on https://www.xethru.com/community/resources/module-connector-windows.78/, but I get the following error, when I try to initialize the radar:

    Error using ModuleConnector.RadarInterface/xep_x4driver_init (line 371)
    Call returns status=1
    Error in ModuleConnector.XEP/x4driver_init (line 193)
    status = this.radarInterface.xep_x4driver_init(this.x2_instance );
    Error in BasicRadarClassX4/init (line 99)
    r.radarInstance.x4driver_init();
    Error in XEP_X4_plot_frame (line 51)
    radar.init();

    I will be grateful for any help.

    With best regards,
    Pawel
     
  2. Charlie Shao

    Charlie Shao Moderator Staff Member

    Did you try xt_modules_plot_record_playback_radar_raw_data_message.m from github repo?
     
  3. pmazurek

    pmazurek New Member

    Dear Charlie,
    thank you for your reply. Unfortunately, when I try to run the mentioned script, I get the following error:

    Error using ModuleConnector.RadarInterface/ping (line 256)
    ping --1
    Error in ModuleConnector.XEP/ping (line 109)
    pongvalue = this.radarInterface.ping( this.x2_instance );
    Error in disp_module_info (line 33)
    pong = xep.ping();
    Error in xt_modules_plot_record_playback_radar_raw_data_message (line 77)
    disp_module_info(input);

    By the way, I also have an X4M03 module, and while the script XEP_X4_plot_frame.m works perfectly for this module, I get the following error when I try to run the other one (i.e. xt_modules_plot_(...).m):

    Error using ModuleConnector.RadarInterface/xep_x4driver_get_downconversion (line 361)
    Call returns status=1
    Error in ModuleConnector.XEP/x4driver_get_downconversion (line 171)
    status = this.radarInterface.xep_x4driver_get_downconversion(this.x2_instance, itPtr );
    Error in disp_x4_settings (line 21)
    [downconversion, status] = xep.x4driver_get_downconversion;
    Error in xt_modules_plot_record_playback_radar_raw_data_message (line 131)
    disp_x4_settings(xep);
    Do you (or anyone else reading this thread) have any other ideas regarding the use of the X4M02 module in MATLAB?
     
  4. Charlie Shao

    Charlie Shao Moderator Staff Member

    Did you update modules to the latest firmware and using latest ModuleConnector?
    The latest resources can be downloaded from the community resource page.
    X4M03 should be programmed with XEP. X4M02 is the hardware name of X4M200 sensor, you can upgrade with latest XeThru Explorer.
     
  5. pmazurek

    pmazurek New Member

    I think the problem lies deeper... I tried to upgrade the firmware, but when I connect the X4M02 module via USB cable, it is not detected by the XeThru Explorer (ver. 2.7.3); however, it is seen by the system, and listed as "Bossa Program Port (COMn)" in Device Manager. By the way: I have a Win10 64bit PC.

    I checked this thread (https://www.xethru.com/community/threads/sensor-not-detected-on-windows-7.20/) and tried to install Bossa drivers following the link you provided in that thread, but the module is still not detected by the XeThru Explorer...

    Also, I don't think it is an issue with the USB cable, because I used the same cable to connect the X4M03 module, and there was no problem: the XeThru Explore detected the module and enabled me to acquire the data.
     
    Last edited: Aug 28, 2019
  6. pmazurek

    pmazurek New Member

    Quick update: I have tried reinstalling the BOSSA driver (from https://github.com/shumatech/BOSSA/releases) and the Atmel driver (from the XeThru Explorer package), but unfortunately the sensor is not detected by the Explorer. What's more, I tried that on a Win10 64bit laptop and the behaviour is the same: the X4M02 is seen by the system (it appears in a Device Manager) but when I run the Explorer, the only message I see is "Please connect your XeThru sensor device" and - after a while - the "XeThru Playback" device shows up...

    Any ideas how to make it work?
     
  7. Charlie Shao

    Charlie Shao Moderator Staff Member

    This is very strange. There might be some problem with this X4M02. I suggest you install ModuleConnector API and try example: https://github.com/xethru/XeThru_Mo...0_print_record_playback_RESP_SLEEP_message.py
    The printout will give more clue on the problem.
     
  8. pmazurek

    pmazurek New Member

    I executed the script, and here goes the printout:

    (base) D:\XeThru\ModuleConnector-win32_win64-1.6.2\python36-win64\pymoduleconnector\examples>python x4m200_print_record_playback_RESP_SLEEP_message.py -d COM4
    2.003627 : Timeout waiting for response
    4.006461 : Timeout waiting for response
    6.006888 : Timeout waiting for response
    Traceback (most recent call last):
    File "x4m200_print_record_playback_RESP_SLEEP_message.py", line 207, in <module>
    main()
    File "x4m200_print_record_playback_RESP_SLEEP_message.py", line 195, in main
    print_module_info(device_name)
    File "D:\XeThru\ModuleConnector-win32_win64-1.6.2\python36-win64\pymoduleconnector\examples\xt_modules_print_info.py", line 41, in print_module_info
    pong = xep.ping()
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pymoduleconnector-1.6.2-py3.6.egg\pymoduleconnector\moduleconnectorwrapper\__init__.py", line 6171, in ping
    return _moduleconnectorwrapper.PyXEP_ping(self)
    RuntimeError: Timeout waiting for response

    More info:
    1) I bought six X4M02 modules (e.g. Item No: 000165-010, Serial No: 100000132159, Production date: 2018-12-06), and all of them react in the same way.
    2) I probably configured Python properly because I am able to run the script XEP_X4M200_X4M300_plot_record_playback_radar_raw_data.py, and acquire data with a X4M03 module.
     
    Last edited: Sep 2, 2019
  9. Charlie Shao

    Charlie Shao Moderator Staff Member

    Are you able to run XEP_X4M200_X4M300_plot_record_playback_radar_raw_data.py with X4M200? Same result?
    If the com4 is correct serial port occupied by X4M200, it is really vired that sensors have no response at all. You have even tested 6 modules. We did not get a similar report from other users by far.

    The last hope might be updating sensor firmware directly by following instructions in this MC example:
    https://github.com/xethru/XeThru_Mo...b/master/PYTHON/xt_modules_firmware_update.py

    If the problem still exists, please send one email to support@xethru.com. XeThru engineer will provide you further guidance.
     
  10. pmazurek

    pmazurek New Member

    Charlie, I do not have X4M200 sensor. I have one X4M03 sensor, and six X4M02 sensors (https://shop.xethru.com/x4m02), and I am struggling to use the latter ones. Is that possible? Does this sensor have some preinstalled firmware? Can I upgrade its firmware with XeThru Explorer?

    I will try the python script, and get back to you later.
     
  11. pmazurek

    pmazurek New Member

    ... the outcome was quite easy to predict:

    (base) D:\XeThru\ModuleConnector-win32_win64-1.6.2\python36-win64\pymoduleconnector\examples>python xt_modules_firmware_update.py -f Annapurna_4bl_cert.hex
    0.000000 : git sha: 0a8e9e99e817
    0.009676 : build date: 2018-10-16 13:41:12
    3.019448 : Timeout waiting for response
    5.019991 : Timeout waiting for response
    Could not go to bootloader, may be there already.
    2.009925 : Timeout waiting for response
    Traceback (most recent call last):
    File "xt_modules_firmware_update.py", line 134, in <module>
    main()
    File "xt_modules_firmware_update.py", line 128, in main
    upgrade_fw(args.hex_file_name, args.skip_goto, args.device_name)
    File "xt_modules_firmware_update.py", line 61, in upgrade_fw
    print(bootloader.get_bootloader_info())
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pymoduleconnector-1.6.2-py3.6.egg\pymoduleconnector\moduleconnectorwrapper\__init__.py", line 5005, in get_bootloader_info
    return _moduleconnectorwrapper.Bootloader_get_bootloader_info(self)
    RuntimeError: Timeout waiting for response

    I will contact the support then. Thanks for your assistance, Charlie.
     
  12. Charlie Shao

    Charlie Shao Moderator Staff Member

    Hi,
    I think I found the problem. I believe you bought pure X4M02 hardware module instead of X4M200/X4M300 sensor with firmware. X4M02 doest not contain any firmware. The X4M02 is compatible with the X4M03 radar development kit but does not contain the firmware debug port. It is for the developer who has finished their development on X4M03 but needs a compact module. Though it does not have a debug port, you can still program X4M02 with XEP like X4M03, see this page for how to program X4M02: https://www.xethru.com/community/resources/xethru-module-mcu-firmware-programming.129/
     
  13. pmazurek

    pmazurek New Member

    Well, that explains everything. I will try that approach. Thank you once again!