RuntimeError: Timeout waiting for response

Discussion in 'X4M03' started by JBull, Feb 4, 2019.

  1. JBull

    JBull New Member

    I've got X4M03 kit and I'm currently working with python3 on MacOS.

    Most of the times things work fine - I can run reset module, run demos, etc. However, every now and then, I get timeouts when I initially connect the radar to my computer. I need to disconnect and reconnect the radar in order for it to work. Is there a workaround to that? Could I somehow programmatically force it to work?

    The radar is connected and recognised by MacOS (see attachment). The serial port is listed, too:
    Code:
    $ ll /dev/cu.usbmodem1441
    crw-rw-rw-  1 root  wheel   21, 243  3 Feb 21:52 /dev/cu.usbmodem1441
    
    However, python cannot reset the module, nor successfully run ping:
    Code:
    Python 3.7.0 (default, Jun 29 2018, 20:13:13)
    [Clang 9.1.0 (clang-902.0.39.2)] on darwin
    Type "help", "copyright", "credits" or "lineicense" for more information.
    >>> from pymoduleconnector import ModuleConnector
    >>> mc = ModuleConnector("/dev/cu.usbmodem1441", log_level=0)
    >>> xep = mc.get_xep()
    >>> xep.module_reset()
    8.817863 : Timeout waiting for response
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/libs/ModuleConnector/python37-x86_64-apple-darwin/pymoduleconnector/moduleconnectorwrapper/__init__.py", line 6102, in module_reset
        return _moduleconnectorwrapper.PyXEP_module_reset(self)
    RuntimeError: Timeout waiting for response
    
    >>> print(hex(xep.ping()))
    50.227737 : Timeout waiting for response
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/libs/ModuleConnector/python37-x86_64-apple-darwin/pymoduleconnector/moduleconnectorwrapper/__init__.py", line 6143, in ping
        return _moduleconnectorwrapper.PyXEP_ping(self)
    RuntimeError: Timeout waiting for response
    
    I open XeThru explorer, but it cannot see the radar neither. I need to reconnect the radar and then, most of the time, I can use the radar again.

    Any suggestion is very welcome.

    Thanks,
    J.
     

    Attached Files:

  2. Charlie Shao

    Charlie Shao Moderator Staff Member

    Hi JBull, it is not necessary to reset module when you run the script, the module_reset() do a complete power toggle, so you have to wait at least 3s to redo the connection. I suggest you just follow the procedure of example scripts.
    The latest ModuleConnector python examples are maintained here:
    https://github.com/xethru/XeThru_ModuleConnector_Examples/tree/master/PYTHON