zsmartsystems / com.zsmartsystems.zigbee.sniffer

ZigBee sniffer using Ember NCP and routing packets to Wireshark for display
Eclipse Public License 1.0
33 stars 18 forks source link

Unable to communicate with Ember NCP (HUSBZB-1) #35

Closed cradleinflames closed 1 month ago

cradleinflames commented 1 month ago

Hello! I'm trying to run your scripts with the HUSBZB-1 (factory firmware, haven't upgraded anything yet) and I'm running into an issue when trying to connect to the port.

HARDWARE/SW INFO

A bit about the ports:

/dev/ttyUSB0 is another peripheral on the board

When I plug in the device, /dev/ttyUSB1 and /dev/ttyUSB2 show up and my understanding is 1 would be z-wave and 2 would be zigbee (though I tried the script with both).

I'm using Raspbian (Debian 12/bookworm), python V3.10.14 (though I don't think the issue is related to that.

PROBLEM DESCRIPTION

I downloaded your jar in the releases section (it's labeled "com.zsmartsystems.zigbee.sniffer-1.0.2.jar"), navigated to the folder it was downloaded in and ran the following:

$ java -jar com.zsmartsystems.zigbee.sniffer-1.0.2.jar -port /dev/tty.SLAB_USBtoUART -baud 115200 -flow hardware
Z-Smart Systems Ember Packet Sniffer
NCP initialisation starting...
Opened serial port /dev/tty.SLAB_USBtoUART at 115200
[main] ERROR com.zsmartsystems.zigbee.serial.ZigBeeSerialPort - Error opening serial port.
jssc.SerialPortException: Port name - /dev/tty.SLAB_USBtoUART; Method name - openPort(); Exception type - Port not found.
    at jssc.SerialPort.openPort(SerialPort.java:219)
    at com.zsmartsystems.zigbee.serial.ZigBeeSerialPort.openSerialPort(ZigBeeSerialPort.java:133)
    at com.zsmartsystems.zigbee.serial.ZigBeeSerialPort.open(ZigBeeSerialPort.java:96)
    at com.zsmartsystems.zigbee.serial.ZigBeeSerialPort.open(ZigBeeSerialPort.java:90)
    at com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp.initialiseEzspProtocol(ZigBeeDongleEzsp.java:1289)
    at com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp.getEmberMfglib(ZigBeeDongleEzsp.java:408)
    at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.initialiseNcp(ZigBeeSniffer.java:435)
    at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.main(ZigBeeSniffer.java:264)
[main] WARN com.zsmartsystems.zigbee.serial.ZigBeeSerialPort - Unable to open serial port: Failed to open serial port: /dev/tty.SLAB_USBtoUART
[main] ERROR com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp - EZSP Dongle: Unable to open serial port
Unable to communicate with Ember NCP
[main] WARN com.zsmartsystems.zigbee.serial.ZigBeeSerialPort - Error closing serial port: '/dev/tty.SLAB_USBtoUART'
jssc.SerialPortException: Port name - /dev/tty.SLAB_USBtoUART; Method name - removeEventListener(); Exception type - Port not opened.
    at jssc.SerialPort.checkPortOpened(SerialPort.java:951)
    at jssc.SerialPort.removeEventListener(SerialPort.java:1141)
    at com.zsmartsystems.zigbee.serial.ZigBeeSerialPort.close(ZigBeeSerialPort.java:162)
    at com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp.shutdown(ZigBeeDongleEzsp.java:688)
    at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.shutdownNcp(ZigBeeSniffer.java:374)
    at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.shutdown(ZigBeeSniffer.java:378)
    at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.initialiseNcp(ZigBeeSniffer.java:445)
    at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.main(ZigBeeSniffer.java:264)
Unable to initialise NCP

I also tried the following (in case tty.SLAB_USBtoUART is intended to be a placeholder. If it's not, my issue might be related to getting whatever driver this might be sorted):

$ java -jar com.zsmartsystems.zigbee.sniffer-1.0.2.jar -port /dev/ttyUSB2 -baud 115200 -flow hardware
Z-Smart Systems Ember Packet Sniffer
NCP initialisation starting...
Opened serial port /dev/ttyUSB2 at 115200
Unable to communicate with Ember NCP
[main] INFO com.zsmartsystems.zigbee.serial.ZigBeeSerialPort - Serial port '/dev/ttyUSB2' closed.
Unable to initialise NCP

I tried it with /dev/ttyUSB1 as well just in case but got essentially the same thing. I assume I'm doing something fundamentally wrong here but maybe there's some other compatibility issue? Maybe I need newer firmware for the updated JAR file? Maybe I'm supposed to extract something from the *.jar file?

Let me know if I'm missing something here or if you want me to try anything else. It looks like you did all the hard work so it should be fairly easy for me to emulate but I haven't had any luck just yet.

Thanks!

cdjackson commented 1 month ago

The default baud rate on this device is 57600 - not 115200.

cradleinflames commented 1 month ago

The default baud rate on this device is 57600 - not 115200.

Ah, that makes perfect sense! Apologies, just got the device and am still working out the basics. Didn't even cross my mind to check the baud rate, which seems pretty obvious in hindsight . . . Thanks so much for your help! Looks like it's working just fine on my end now!

cdjackson commented 1 month ago

No problem - I'm glad it's working.