Showing posts with label Z-Stack Linux Home Gateway. Show all posts
Showing posts with label Z-Stack Linux Home Gateway. Show all posts

Tuesday, October 16, 2018

How to build TI Z-Stack Linux Home Gateway for Beaglebone Black


The following steps show you how to build TI Z-Stack Linux Home Gateway from source codes for Beaglebone Black.

1.Setup and run Ubuntu 18.04.01 on VirtualBox

2. Install build-essential with the following command

    sudo apt-get install build-essential

3. Change to home directory (mine is /home/yk) and install cross compiler for building BBB binary.
    
    wget -c https://releases.linaro.org/components/toolchain/binaries/6.4-2018.05/arm-linux-gnueabihf/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
    
    tar xf gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz

4. Add cross compiler path into PATH variable

     export PATH=$PATH:/home/yk/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/bin

5. Add TCLIB path by the following command

     export TCLIB=/home/yk/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/lib

6. Download Z-STACK-LINUX-GATEWAY and install to home directory (mine is ~/Z-Stack_Linux_Gateway-1.0.1-src).

7. Change directory to ~/Z-Stack_Linux_Gateway-1.0.1-src/Source and run "./build_all"

8. Will see the following error after build finished and it doesn't matter. You can find z-stack_linux_gateway_arm_binaries_.tar under /home/yk/Z-Stack_Linux_Gateway-1.0.1-src/Source/ERROR__out and you can scp z-stack_linux_gateway_arm_binaries_.tar to BBB to run/test it.




Friday, June 23, 2017

Build TI Z-Stack Linux Home Gateway reference design to run on both Linux 16.04 AMD64 (64Bit) and x86 (32Bit).

1. Download Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run from http://www.ti.com/tool/z-stack-archive.

2.a. If you use  Linux 16.04 x86 (32Bit), you can run Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run to extract Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src

2.b. If you use  Linux 16.04 AMD64 (64Bit),you can refer to http://processors.wiki.ti.com/index.php/Sitara_Linux_SDK_64_Bit_Ubuntu_Support and have to run the following apt-get install command to install necessary packages before you run Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run 32 bit script to unpack Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src.

 sudo apt-get install libc6:i386
 sudo apt-get install libx11-6:i386 libasound2:i386 libatk1.0-0:i386 libcairo2:i386 libcups2:i386 libdbus-glib-1-2:i386 libgconf-2-4:i386 libgdk-pixbuf2.0-0:i386 libgtk-3-0:i386 libice6:i386 libncurses5:i386 libsm6:i386 liborbit2:i386 libudev1:i386 libusb-0.1-4:i386 libstdc++6:i386 libxt6:i386 libxtst6:i386 libgnomeui-0:i386 libusb-1.0-0-dev:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386

3. Revise the build script package_builder_bbb (in red) under “your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\scripts\”

...
#Target platform:
    #export TARGET_PLATFORM="BEAGLEBONE_BLACK"
    export TARGET_PLATFORM="x86"

...
    cd $NPI_SOURCE/Projects/tools/LinuxHost
    make clean
    make create_output
    #make arch-all-armBeagleBone CC_armBeagleBone=$COMPILER |& tee -a $MAKE_LOG_FILE
    make $BUILD_TYPE |& tee -a $MAKE_LOG_FILE

...
# *** Copy resources ***********************************************************************************

#cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_armBeagleBone_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server
cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_${PLATFORM_SUBSTRING}_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server


4.Download protobuf 2.5.0-9ubuntu1 source package from https://launchpad.net/ubuntu/+source/protobuf/2.5.0-9ubuntu1 and build/install it with the following steps.
 
   4.a. Extra protobuf 2.5.0-9ubuntu1 to protobuf 2.5.0 folder and switch into protobuf 2.5.0 folder
   4.b. run "./configure"
   4.c. run "make"
   4.d. run "sudo make install"
   4.e. run "sudo ldconfig"

5.Download protobuf-c 0.15-1build1 source package from https://launchpad.net/ubuntu/+source/protobuf-c/0.15-1build1 and build/install it with the following steps.
 
   5.a. Extra protobuf-c 0.15-1build1 to protobuf-c-0.15 folder and switch into protobuf-c-0.15 folder
   5.b. run "./configure"
   5.c. run "make"
   5.d. run "sudo make install"
   5.e. run "sudo ldconfig"

6. Create a new folder "tools" and export TCLIB to it using the following lines:

   cd ~
   mkdir tools
   export TCLIB=~/tools

7. Switch to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ and run ./build_all

8. The output will be at "your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ERROR_out\z-stack_linux_gateway_x86_binaries.tar". The build error is due to the lack of comparison file but the output binaries still work on x86 environment.

9. Copy and untar “z-stack_linux_gateway_x86_binaries.tar” to your working directory on x86 (called ).

10. Disable flowcontrol in NPI_Gateway.cfg like the followings:

    ...
    [UART]
    speed=115200 ; speed
    flowcontrol=0 ; 1=enabled 0=disable
    ...

11. Please follow the (Z-Stack Linux Gateway User Guide.pdf, Chap 6.3) to start the application. Please note you have to specify x86 when you run zigbeeHAgw like "sudo ./zigbeeHAgw x86" in one terminal and run "./start_application" on another terminal.

















Wednesday, March 29, 2017

Build TI Z-Stack Linux Home Gateway reference design for x86 Linux

The following steps show you hot to build TI Z-Stack Linux Home Gateway reference design for x86 Linux.

1. Download Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run from http://www.ti.com/tool/z-stack-archive.

2. Setup a 32 bit Ubuntu and run Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run to extract Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src

3. Revise the build script package_builder_bbb (in red) under “your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\scripts\”

...
#Target platform:
    #export TARGET_PLATFORM="BEAGLEBONE_BLACK"
    export TARGET_PLATFORM="x86"

...
    cd $NPI_SOURCE/Projects/tools/LinuxHost
    make clean
    make create_output
    #make arch-all-armBeagleBone CC_armBeagleBone=$COMPILER |& tee -a $MAKE_LOG_FILE
    make $BUILD_TYPE |& tee -a $MAKE_LOG_FILE

...
# *** Copy resources ***********************************************************************************

#cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_armBeagleBone_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server
cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_${PLATFORM_SUBSTRING}_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server


4.a Install protobuf by doing the following two apt-get install

       sudo apt-get install protobuf-c-compiler
       sudo apt-get install protobuf-compiler

4.b Create a new folder "tools" and export TCLIB to it using the following lines:
  
       cd ~
       mkdir tools
       export TCLIB=~/tools/

5. Switch to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ and run ./build_all

6. The output will be at "your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ERROR_out\z-stack_linux_gateway_x86_binaries.tar". The build error is due to the lack of comparison file but the output binaries still work on x86 environment.

7. Copy and untar “z-stack_linux_gateway_x86_binaries.tar” to your working directory on x86 (called ). Please follow the (Z-Stack Linux Gateway User Guide.pdf, Chap 6.3) to start the application. Please note you have to specify x86 when you run zigbeeHAgw like "sudo ./zigbeeHAgw x86"

8. If you run it successfully, you will see the results like the following screen shot.


Monday, January 4, 2016

How to run TI Z-Stack Linux Home Gateway on BeagleBone Black with CC2530DK.

The following steps show you how to run TI Z-Stack Linux Home Gateway on BeagleBone Black with CC2530DK.

1. Add ENABLE_MT_SYS_RESET_SHUTDOWN to compile options of ZNP CC2530-ProdHex project and set znpCfg1 = ZNP_CFG1_UART in InitBoard().

2. Build it to get CC2530ZNP-Prod.hex under \Projects\zstack\ZNP\CC253x\dev and download it to CC2530DK using Flash Programmer.

3. Connect the following pins between CC2530DK UART (P0.2 as RX and P0.3 as TX) and BeagleBone Black UART4.

       CC2530DK UART RX P0.2 (P18 Pin9)   <-------> BBB UART4 TX (P9 Pin13)
       CC2530DK UART TX P0.3 (P18 Pin11) <-------> BBB UART4 RX (P9 Pin11)
       CC2530DK GND (P18 Pin20)                 <-------> BBB DGND (P9 Pin1)




4. Change devPath="/dev/ttyACM0" to devPath="/dev/ttyO4" in NPI_Gateway.cfg

5. Revise the followings in zigbeeHAgw.

    "ZBEE_SERIAL_PORT=ttyACM0" to "ZBEE_SERIAL_PORT=ttyO4"

    "../tools/gw_soc_fw_version_query.bin /dev/ttyACM0" to "../tools/gw_soc_fw_version_query.bin /dev/ttyO4"

6. Comment out the folllowing lines in in zigbeeHAgw.

    "../tools/bbb_usbreset.bin"
    "echo -n  " sleeping $hw_reset_sleep seconds after reset... ""
    "sleep $hw_reset_sleep"

7. Add the following line to /media/BEAGLEBONE/uEnv.txt to enable UART4 on BBB.

    optargs=quiet drm.debug=7 capemgr.enable_partno=BB-UART4

8. Restart BBB and make sure ttyO4 shows under /dev

9. run ./zigbeeHAgw bbb on current terminal and ./start_application on another to test TI Z-Stack Linux Home Gateway.

Tuesday, December 1, 2015

How to do porting of TI Z-Stack Linux Home Gateway to Raspberry Pi

The following steps show you how to do porting of TI Z-Stack Linux Home Gateway to Raspberry Pi.

1. Sign SLA with TI to get source code installer "Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run"

2. Run "chmod +x Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run".

4. Run "./Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run" in VirtualBox 32 Bit Ubuntu to install source code to "/home/yk/Z-Stack_Linux_Gateway-1.0.1-src".

5. Run "sudo apt-get install git" to install git first and run "git clone https://github.com/raspberrypi/tools" to get cross compiler and tool chain for Raspberry Pi.

6. vi .bashrc under /home folder and add the following two lines

     export PATH=$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
     export TCLIB=~/tools/arm-bm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/

7. Restart terminal to make .bashrc deployed.

8. Change directory to /home/yk/Z-Stack_Linux_Gateway-1.0.1-src/Source and run "./build_all"

9. After build complete, you will get z-stack_linux_gateway_arm_binaries_.tar under /home/yk/Z-Stack_Linux_Gateway-1.0.1-src/Source/out/Precompiled_arm.

10. scp  z-stack_linux_gateway_arm_binaries_.tar to you Raspberry Pi and plugin CC2531 USB dongle with FW CC2531-GW-ZNP_38724.hex.

11. Open 2 SSH client shells on your host PC and connect them to Raspberry Pi.

12. In one of SSH login, untar Z-Stack Linux Gateway Binaries
      $ cd ~
      $ mkdir z-stack_linux_gateway_arm_binaries
      $ tar xvf z-stack_linux_gateway_arm_binaries_.tar -C z-stack_linux_gateway_arm_binaries

13. In the same SSH login, run the following commands to start Z-Stack Linux Gateway servers.

      $cd ~/z-stack_linux_gateway_arm_binaries
      $cp protobuf/libprotobuf-c.so.0 /usr/lib/
      $cd servers
      $chmod +x ./zigbeeHAgw
      $./zigbeeHAgw beaglebone

14. On another SSH login, run the following commands to start Z-Stack Linux Gateway application
      $ cd ~/z-stack_linux_gateway_arm_binaries/servers
      $ chmod +x ./start_application
      $ ./start_application