questions about getting raw data in matlab

Discussion in 'X4M03' started by Hongjie Cui, Apr 11, 2019.

  1. Hongjie Cui

    Hongjie Cui New Member

    Hi there,
    I am a pretty new hand and I would like to apologise for easy questions. I will appreciate any help!
    I want to get raw data through matlab. I use resource from ''
    I am working on the file 'xt_sensors_plot_record_playback_baseband_IQ_AP_message.m'
    but it shows some errors:
    Error using ModuleConnector.ModuleConnector (line 78)
    nva_create_module_connector failed (COM5/libModuleConnector), verify COM-port and check the logs

    Error in disp_module_info (line 25)
    mc = ModuleConnector.ModuleConnector(device_name,0);

    Error in xt_modules_plot_record_playback_radar_raw_data_message (line 77)

    Could anyone help with that?
    Is my idea of getting raw data right or you would suggest me to try other ways?
    Thanks a lot
  2. Luyao Tang

    Luyao Tang New Member

    Hi!Have you already sorted this out?
  3. Allen Wu

    Allen Wu Moderator Staff Member


    I think the error is due to COM port setting. Tested with X4M200, actual COM port is 'COM3', if set the COM port in .m file to 'COM4', will get similar error message.

    >> xt_sensors_plot_record_playback_baseband_IQ_AP_message
    Library is already loaded.
    Library is already loaded.
    Error using ModuleConnector.ModuleConnector (line 78)
    nva_create_module_connector failed (COM4/libModuleConnector), verify COM-port and check
    the logs

    Error in disp_module_info (line 25)
    mc = ModuleConnector.ModuleConnector(device_name,0);

    Error in xt_sensors_plot_record_playback_baseband_IQ_AP_message (line 70)
    OrderCode = disp_module_info(input);


    in the file: xt_sensors_plot_record_playback_baseband_IQ_AP_message.m
    line 24: input = 'COM4';

    Set the COM port to the one that is assigned by OS.

    After plug in XeThru module to PC, you can check the COM port in Windows: Device Manager -> Ports (COM & LPT) -> Bossa Program Port (COMxx)

    xx is the assigned COM port.

    Last edited: Dec 6, 2019
  4. Luyao Tang

    Luyao Tang New Member

    Hi Allen,

    Thank you for uploading this kind of error which might caused in MATLAB. I recently got a really similar error. Here is the details of error,

    Library is already loaded.
    错误使用 ModuleConnector.ModuleConnector (line 78)
    nva_create_module_connector failed (COM6/libModuleConnector),
    verify COM-port and check the logs

    出错 X4M200_X4M300_manipulate_noisemap (line 27)
    mc = ModuleConnector.ModuleConnector('COM6');

    I have already checked the USB port using the way you said before which is 'COM6' in my PC, it can be seen in the screenshot.


    And I have change that in the code,


    But the same error occur as before.
    I am just wondering what the problems is. I guess maybe it is my PC problem, but the sensor works well when I use XeThru Explorer in my PC. Or maybe it is some other problems. It will be great if you could help me to solve this.

    All the best,
  5. Charlie Shao

    Charlie Shao Moderator Staff Member

    Everything looks fine on your debugging process, just wonder do you have the same problem with other MATLAB scripts like or

    I did a test on MATLAB-R2018b, there is no problem. If you have version 2019 or older than 2017, they may have changes to the serial port assignment.
  6. Luyao Tang

    Luyao Tang New Member

    Hi Charlie,

    I have test all the scripts in the examples file and the newest scripts on github. It does show the same problem. I am using the MATLAB R2018a, I don not know if there are any differences for testing between these two version.

  7. Luyao Tang

    Luyao Tang New Member

    Hi Charlie,

    Here is the debug file after errors occur, if that could help to find the problem, it will be great.

    0.000000 : createing logger StdoutLogger
    0.011990 : Created logger

    0.013994 : RadarCommunicator: 28
    0.013994 : parser constructor
    0.013994 : RadarInterface - base -- begin
    0.013994 : log_trace -- begin
    0.013994 : log_trace -- end
    0.013994 : git sha: 0a8e9e99e817
    0.013994 : build date: 2018-10-16 13:41:11
    0.013994 : RadarInterface - base -- end
    0.013994 : open -- begin
    0.013994 : ~RadarCommunicator -- begin
    0.013994 : ~RadarCommunicator -- end
    0.013994 : ~PacketDispatcher -- begin
    0.013994 : task ending: dispatcher
    0.023993 : ~PacketDispatcher -- end
    0.023993 : ~ActiveThread: dispatcher
    0.024993 : RadarCommunicator: 28
    0.024993 : log_trace -- begin
    0.024993 : log_trace -- end
    0.025992 : subscribe_to_presence_single -- begin
    0.025992 : subscribe_to_presence_single -- end
    0.025992 : subscribe_to_presence_movinglist -- begin
    0.025992 : subscribe_to_presence_movinglist -- end
    0.025992 : subscribe_to_data_float -- begin
    0.025992 : subscribe_to_data_float -- end
    0.025992 : subscribe_to_data_string -- begin
    0.025992 : subscribe_to_data_string -- end
    0.025992 : subscribe_to_data_byte -- begin
    0.025992 : subscribe_to_data_byte -- end
    0.025992 : subscribe_to_baseband_iq -- begin
    0.025992 : subscribe_to_baseband_iq -- end
    0.025992 : subscribe_to_baseband_ap -- begin
    0.025992 : subscribe_to_baseband_ap -- end
    0.025992 : subscribe_to_pulsedoppler_float -- begin
    0.025992 : subscribe_to_pulsedoppler_float -- end
    0.025992 : subscribe_to_noisemap_float -- begin
    0.025992 : subscribe_to_noisemap_float -- end
    0.025992 : subscribe_to_pulsedoppler_byte -- begin
    0.025992 : subscribe_to_pulsedoppler_byte -- end
    0.025992 : subscribe_to_noisemap_byte -- begin
    0.025992 : subscribe_to_noisemap_byte -- end
    0.025992 : subscribe_to_system_status -- begin
    0.025992 : subscribe_to_system_status -- end
    0.025992 : subscribe_to_resp_status -- begin
    0.025992 : subscribe_to_resp_status -- end
    0.025992 : subscribe_to_sleep_status -- begin
    0.025992 : subscribe_to_sleep_status -- end
    0.025992 : subscribe_to_respiration_movinglist -- begin
    0.025992 : subscribe_to_respiration_movinglist -- end
    0.025992 : subscribe_to_respiration_detectionlist -- begin
    0.025992 : subscribe_to_respiration_detectionlist -- end
    0.025992 : subscribe_to_respiration_normalizedmovementlist -- begin
    0.025992 : subscribe_to_respiration_normalizedmovementlist -- end
    0.025992 : subscribe_to_sleepstage -- begin
    0.025992 : subscribe_to_sleepstage -- end
    0.025992 : subscribe_to_vital_signs -- begin
    0.025992 : subscribe_to_vital_signs -- end
    0.025992 : subscribe_to_radar_rf -- begin
    0.025992 : subscribe_to_radar_rf -- end
    0.025992 : subscribe_to_radar_rf_normalized -- begin
    0.025992 : subscribe_to_radar_rf_normalized -- end
    0.025992 : subscribe_to_radar_baseband_float -- begin
    0.025992 : subscribe_to_radar_baseband_float -- end
    0.025992 : subscribe_to_radar_baseband_q15 -- begin
    0.025992 : subscribe_to_radar_baseband_q15 -- end
    0.025992 : open -- begin
    0.025992 : creating moduel IO

    0.025992 : OverlappedModuleIo
    0.028991 : open COM6
    0.028991 : Opening serial port "\\.\COM6" - here we go
    0.028991 : Error creating file

    0.028991 : module_io::eek:pen returned error
    0.028991 : open -- end
    0.028991 : open -- end
    0.028991 : __create_module_connector 67 - ERROR allocating radar
  8. wen shun

    wen shun New Member

  9. wen shun

    wen shun New Member

  10. Luyao Tang

    Luyao Tang New Member

    Hi there,

    It is good to see the module connector can work by MATLAB and python, thanks a lot to Charlie and Allen.

    There is one more question I would like to ask, which is about the raw data I can get. It could be seen that the raw data I can get through the Module Connector (e.g. Presence State, Pulsedoppler, noisemap) is the data processed by XeThru. What if I would like to get the raw data (e.g. single transmit pulse signal and its reflection signal) and process it by myself. Is there any possible to do that by the Module Connector? Or I need to access that by similar coding of Module Connector? Does that need any authority?

    It will be great if you guys can help me!

  11. Luyao Tang

    Luyao Tang New Member

    Please check if you are using XeThru Explorer when you try to access by Module Connector, they cannot work together.
  12. Luyao Tang

    Luyao Tang New Member

    Some Supplementary Question

    If we want to develop our own custom development, should we continue use the X4M300 sensor, or we need to buy the Custom Sensor Development X4M03?

  13. Allen Wu

    Allen Wu Moderator Staff Member

    Hi Luyao,

    It really depends on what you want to do. For X4M300, it has baseband data output as well as processed data output such as Presence State. X4M03 is our development platform, for custom sensor development, and support RF and baseband data output. The XEP running on X4M03 is also what we used to develop the firmware of X4M200 and X4M300, the only thing developer need to focus on is their own DSP development.

    It is suggested to first use module connector. If you really want to go low level, you should look into the MCPW and maybe XEP source code.

    Here's an introduction to tools, resources, and documentation:

  14. Luyao Tang

    Luyao Tang New Member

    Hi Allen,

    Thanks for your reply.

    I am a little confused about the baseband data output. Because I could get the baseband data from the additional python script from github (xt_sensors_plot_record_playback_baseband_IQ_AP_message), but what you defined I and Q is confused me. And in the code, it provides another type of data which is amplitude and phase. But when I try to run this type function, there is an error occurred. The error I showed below,


    Could you please tell me how you defined the baseband data? What is the mean of "I" and "Q"? Does the micro controller processed the baseband data to get others data such as presence state and pulsedoppler data?

    In addition, I get a application note which called XeThru Module Firmware Programming. In this note, it said costumers could clear the programming of the MCU on x4m300(X4M02), and reprogramming it. What I am looking for is whether reprogramming the MCU could help to do the customer signal processing. I am just wondering how we can do that specifically? For example, can we use the USB interface to connect module? Do we need any other connector to programming the MCU? It will be great if there is a tutorial for this kind of problems.

  15. Luyao Tang

    Luyao Tang New Member

    Hi there,

    If you can help me for these questions, that will be great.