This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux: Ubuntu x64 ZigBee 3.0 Linux Gateway issue

Other Parts Discussed in Thread: CC2531, CC2531EMK

Tool/software: Linux

I installed Zigbee Linux Gateway according to the instructions in this post.

Ubuntu x64 is installed in VirtualBox, the installation was made from scratch.

The sudo ./zigbeeHAgw x86 command starts the servers and finds CC2531 USB dongle, but starting the application ./start_application from another terminal window results in an error like:

received from NWK_MGR: len=68, cmd_id=8, subsystem=114
 Raw=44:00:72:08:08:08:12:40:08:00:11:CE:6B:66:01:00:4B:12:00:20:07:2A:20:08:04:10:84:02:18:07:20:00:28:00:28:03:28:81:0A:30:06:30:04:30:05:30:80:0A:30:09:30:81:02:30:20:2A:0D...
[                           NWK_MGR>>>>>>>>>>>SMPLAPP] NwkGetLocalDeviceInfoCnfERROR: signal 11 was trigerred:
  Fault address: 0x78e54048
  Fault reason: address not mapped to object
Stack trace folows (partial):
../app/main.bin(segmentation_fault_handler+0xf4)[0x55f976f91a4f]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f45e2695f20]
../app/main.bin(print_unpacked_pb_msg+0x6b2)[0x55f976fbada2]
../app/main.bin(print_unpacked_pb_msg+0xc31)[0x55f976fbb321]
../app/main.bin(print_pb_msg+0x5fe)[0x55f976fbc138]
../app/main.bin(tcp_socket_event_handler+0x2fc)[0x55f976f940b1]
../app/main.bin(polling_process_activity+0xde)[0x55f976f9211f]
../app/main.bin(main+0x199)[0x55f976f91d35]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f45e2678b97]
../app/main.bin(_start+0x2a)[0x55f976f917fa]
Executing original handler...
Segmentation fault (core dumped)
Done

The video can be found here.

Is it a way to fix this issue?

The execution environment:
VirtualBox 5.2.26 r128414
Host: Windows 10 x64
Guest: Ubuntu x64 4.18.0-17-generic #18~18.04.1-Ubuntu SMP Fri Mar 15 15:27:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Please refer to the Firmware/README.html document and also try flashing your CC2531EMK with the following firmware

    CC2531ZNP-GwZ3.hex

    Regards,
    Ryan

  • I use Firmware\znp\CC2531_GW_ZNP_Dongle_USB.hex firmware. With the CC2531ZNP-GwZ3.hex you proposed, result is the same.

    If I comment out the line "#define SKIP_BOOTLOADER_VALIDATION" in npi_lnx_ipc.c according to Firmware/Readme.txt, then the server does not find the CC2531 dongle at all. I tried the option suggested here, then the server finds the CC2531, but ./start_application leads to the same Segmentation fault.

  • I attach usb traffic capture file. Lines 1-177 is server initialization, lines 178-181 - application is launched.

    1-177-server-178-181-app.zip

  • Hi,

    This may have to do with the fact that you are using a 64 bit OS, whereas the print_unpacked_pb_msg is assuming 32 bit: LITTLE_ENDIAN_STREAM_TO_UINT32.

    Please try modifying the following makefiles as shown below. Then rebuild and try.

    Zigbee_3_0_Linux_Gateway_1_0_0/source/Projects/zstack/linux/demo/project/makefile:

    main.bin: $(OBJS)
    	@echo "Building $@..."
    	@$(CC) -m32 $(LIBS) -rdynamic -o $@ $(OBJS)  -lprotobuf-c 
    	@if [ -n "$(EXTRACT_FILES)" ]; then echo $(MAKEFILE_LIST) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep -v /usr/ >actual_specific_project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep /usr/ >actual_standard_project_file_list.txt; fi
    	mv $(OBJS) $(OBJ_DIR)
    
    %.o: %.c 
    	@echo "Compiling $< into $@"
    	@$(CC) -m32 $(CFLAGS) $(INCLUDE) $(DEFS) $< -o $@
    	@if [ -n "$(EXTRACT_FILES)" ]; then $(CC) -M $< $(INCLUDE) $(DEFS) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    

    Zigbee_3_0_Linux_Gateway_1_0_0/source/Projects/zstack/linux/RemoTI-Linux-master/Projects/tools/LinuxHost/makefile:

    $(OBJS)/NPI_lnx_x86_server: $(SERVER_OBJS)
    	@echo "Building target" $@ "..."
    	@$(COMPILO) -m32 -o $@ $(SERVER_OBJS) $(LIBS_x86)
    	@if [ -n "$(EXTRACT_FILES)" ]; then echo $(MAKEFILE_LIST) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep -v /usr/ >actual_specific_project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep /usr/ >actual_standard_project_file_list.txt; fi
    	@echo "********************************************************" 
    

    Zigbee_3_0_Linux_Gateway_1_0_0/source/Projects/zstack/linux/zstackserverznp/Makefile:

    $(TARGET_NAME): title $(OBJS)
    	@echo "Linking $@"
    	@$(COMPILER) $(LIBS) -rdynamic -m32 -o $@ $(OBJS) -lpthread -lprotobuf-c
    	@if [ -n "$(EXTRACT_FILES)" ]; then echo $(MAKEFILE_LIST) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep -v /usr/ >actual_specific_project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep /usr/ >actual_standard_project_file_list.txt; fi
    	@mv $(OBJS) $(OBJ_DIR)
    	@echo "********************************************************" 
    	@echo
    

    Zigbee_3_0_Linux_Gateway_1_0_0/source/Projects/zstack/linux/hagateway/Makefile:

    $(OBJS)/GATEWAY_SRVR_x86: $(APP_OBJS)
    	@echo "Building target" $@ "..."
    	@$(COMPILO) -m32 $(PROTOC_LIB_PATH_x86) -rdynamic -o $@ $(APP_OBJS) $(LIBS_x86)
    	@if [ -n "$(EXTRACT_FILES)" ]; then echo $(MAKEFILE_LIST) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep -v /usr/ >actual_specific_project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep /usr/ >actual_standard_project_file_list.txt; fi
    	@echo "********************************************************" 
    

    Zigbee_3_0_Linux_Gateway_1_0_0/source/Projects/zstack/linux/nwkmgr/Makefile:

    $(OBJS)/NWKMGR_SRVR_x86: $(APP_OBJS)
    	@echo "Building target" $@ "..."
    	@$(COMPILO) -m32 $(PROTOC_LIB_PATH_x86) -rdynamic -o $@ $(APP_OBJS) $(LIBS_x86)
    	@if [ -n "$(EXTRACT_FILES)" ]; then echo $(MAKEFILE_LIST) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep -v /usr/ >actual_specific_project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep /usr/ >actual_standard_project_file_list.txt; fi
    	@echo "********************************************************" 
    

    Zigbee_3_0_Linux_Gateway_1_0_0/source/Projects/zstack/linux/otaserver/Makefile:

    $(OBJS)/OTA_SRVR_x86: $(APP_OBJS)
    	@echo "Building target" $@ "..."
    	@$(COMPILO) -m32 $(PROTOC_LIB_PATH_x86) -rdynamic -o $@ $(APP_OBJS) $(LIBS_x86)
    	@if [ -n "$(EXTRACT_FILES)" ]; then echo $(MAKEFILE_LIST) | $(EXTRACT_FILES) >> project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep -v /usr/ >actual_specific_project_file_list.txt; fi
    	@if [ -n "$(EXTRACT_FILES)" ]; then sort -u -V project_file_list.txt | grep /usr/ >actual_standard_project_file_list.txt; fi
    	@echo "********************************************************"
    

    Regards,
    Toby

  • I followed your instructions and modified makefiles by adding -m32 to the specified places.
    Having run setup.sh, I got a few errors and did not get the x86 executable files. The log is attached to this message.
    Does this mean that Ubuntu 18.04 x64 does not have 32-bit libraries by default? If so how to install/build needed 32-bits libs?

    setup.sh.txt

  • Can you try the following:
    Install the libprotobuf-c libraries for 32bits using sudo apt-get install libprotobuf-c-dev:i386
  • Thanks. I was able to build and run the 32-bit version, but this required additional editing of makefiles and installing two libraries.
  • It seems that the settings in the file NPI_Gateway.cfg do not matter, server always tries to open /dev/ttyACM0.
  • That's because zigbeeHAgw has the following: export ZBEE_SERIAL_PORT=/dev/ttyACM0.

    I believe devPath in NPI_Gateway.cfg would determine which hardware resources are used (for example, refer to beaglebone.cameon.net/.../serial-ports-uart )