Reading raw data from X4M02 sensor using MATLAB

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

  1. pmazurek

    pmazurek New Member

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

    Unfortunately, none of the examples, that can be found on, addresses this issue directly. I was trying to use the XEP_X4_plot_frame.m script available in the package found on, 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)
    Error in XEP_X4_plot_frame (line 51)

    I will be grateful for any help.

    With best regards,
  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.x2_instance );
    Error in disp_module_info (line 33)
    pong =;
    Error in xt_modules_plot_record_playback_radar_raw_data_message (line 77)

    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)
    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 ( 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 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:
    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 -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 "", line 207, in <module>
    File "", line 195, in main
    File "D:\XeThru\ModuleConnector-win32_win64-1.6.2\python36-win64\pymoduleconnector\examples\", line 41, in print_module_info
    pong =
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pymoduleconnector-1.6.2-py3.6.egg\pymoduleconnector\moduleconnectorwrapper\", 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, 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 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:

    If the problem still exists, please send one email to 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 (, 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 -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 "", line 134, in <module>
    File "", line 128, in main
    upgrade_fw(args.hex_file_name, args.skip_goto, args.device_name)
    File "", line 61, in upgrade_fw
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pymoduleconnector-1.6.2-py3.6.egg\pymoduleconnector\moduleconnectorwrapper\", 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

    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:
  13. pmazurek

    pmazurek New Member

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