This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Help with the zb-cli-wrapper python package for a ZigBee application.

Hi,

I am using the BMD340 module from Rigado. The module is connected to a raspberry compute module via UART. The design implemented is the  “CLI co-processor design” where the ZigBee stack is installed and running on the SoC (https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v3.2.0%2Fzigbee_example_cli_agent.html). I am able to connect to the CLI and interact with it using the zb-cli-wrapper python package on python3.7.6. But for some reason when I am trying to run my application (simple application based on the example in the package) from a python virtual environment (also python3.7.6), the application hangs. I can create the ZbCliDevice object, but when I want to set channels and the role (cli_dev.bdb.channels = [16] and cli_dev.bdb.role = 'zc'), the application hangs.

I tried to debug it and found that the function that hangs is tcdrain(). This function is called by zb_cli_wrapper/src/utils/connection.py module at line 240. It tries to flush the serial buffer but hangs and I don't understand why.

Greetings,
Damien

Parents
  • I found the issue. Our hardware is not connected to the serial flow control (RTS/CTS), and when installing the zb-cli-wrapper package, it assumes that it is connected. So I modified these attributes (self._serial.dtr = False, etc...):

    class UartConnection(Connection):
    
        def __init__(self, port, baudrate, name=None):
            super(UartConnection, self).__init__()
    
            self._port = port
            self._baudrate = baudrate
    
            self._serial = None
            self.name = name
    
        def __del__(self):
            if self._serial is None:
                return
    
            self.close()
    
        def open(self):
            self._serial = serial.Serial(timeout=0, write_timeout=1.0)
            # Workaround to avoid serial communication failures
            # DTR - Data Terminal Ready
            # DSR - Data Set Ready
            # RTS - Request To Send
            # CTS - Clear To Send
            self._serial.dtr = False  # True
            self._serial.rtscts = False  # True
            self._serial.dsrdtr = False  # True
            self._serial.port = self._port
            self._serial.baudrate = self._baudrate
    
            self._serial.open()

    BR,
    Damien

Reply
  • I found the issue. Our hardware is not connected to the serial flow control (RTS/CTS), and when installing the zb-cli-wrapper package, it assumes that it is connected. So I modified these attributes (self._serial.dtr = False, etc...):

    class UartConnection(Connection):
    
        def __init__(self, port, baudrate, name=None):
            super(UartConnection, self).__init__()
    
            self._port = port
            self._baudrate = baudrate
    
            self._serial = None
            self.name = name
    
        def __del__(self):
            if self._serial is None:
                return
    
            self.close()
    
        def open(self):
            self._serial = serial.Serial(timeout=0, write_timeout=1.0)
            # Workaround to avoid serial communication failures
            # DTR - Data Terminal Ready
            # DSR - Data Set Ready
            # RTS - Request To Send
            # CTS - Clear To Send
            self._serial.dtr = False  # True
            self._serial.rtscts = False  # True
            self._serial.dsrdtr = False  # True
            self._serial.port = self._port
            self._serial.baudrate = self._baudrate
    
            self._serial.open()

    BR,
    Damien

Children
No Data
Related