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/cc2530: CC2530 as enddevice

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Tool/software: Linux

Hi 

   I am using z-stack HA profile 1.2 and IAR 10.1 . I am using SPI for interfacing CC2530 with IMX6 based custom board. I am trying to communicate between these two IMX6 based custom boards. I ran the script zigbeeHAgw and the servers were up and running. But on running the TI Demo application the coordinator came up and listed but no other nodes were getting listed on giving the permit join option. How can we configure one board as coordinator and other one as enddevice. I tried by adding -DZSTACK_DEVICE_BUILD= DEVICE_BUILD_ENDDEVICE in znp.cfg but it is giving some error on compiling with IAR. I am using Z-Stack Home 1.2.2a.44539/Projects/zstack/ZNP/CC253x/znp.eww  workspace file and CC2530-Debug configuration.

Thanks in advance !!

  • Z-Stack Linux Home GW can only acts as coordinator. For end device, you can use SampleLight example running on CC2530.
  • Hi YiKai Chen,

         In my case since I am using SPI for interfacing host processor with CC2530 is there anything with respect to SPI that need to be changed in z-stack Samplelight code.

  • I mean to run SampleLight in SOC mode instead of ZAP-ZNP.
  • Hi Yikai Chen,
    I compiled the samplelight code as enddevice and flashed it into the CC2530 but still its not getting listed in the TI Demo application running in the coordinator. Is there anything missing in configuration side?
  • I suggest you to use sniffer to check if your SampleLight on CC2530 sends beacon requests trying to join coordinator.
  • Hi Mariya,
    Those sample applications are meant to run on TI evaluation boards (SmartRf05), and the sample app is probably waiting on user interaction to join the network (I think press switch 2), you can go and look at the call to start network joining and make it part of the initialization process if you do not have switch user interface in your boards. I would also suggest you to read 'Z-Stack Home Sample Application User's Guide.pdf' on how the sample apps works
  • Hi Luis,

        Actually I had disabled ZCL_EZMODE, TC_LINKKEY_JOIN, HOLD_AUTO_START, NV_RESTORE from cfg files and also prepocessor defined symbols in IAR also I have made SECURE=0. Still the device is not getting listed in TI DEMO application running on the other board in which the SOC is programmed with ZNP image. Is there anything else I need to take care from ZNP / Enddevice image? 

  • If you set SECURE=0 on end device, do you also set SECURE=0 on coordinator?
  • Yes, I have disabled the above macros both in coordinator & end device side....
  • Do you use sniffer to check this issue?
  • Actually I dont have a CC2531-dongle for packet sniffer, Currently I am trying to use Mighty Gecko from silicon labs as packet sniffer, will that be fine?
    Is there any other way to debug this issue without packet sniffer?
  • It is no problem to use Mighty Gecko from silicon labs as packet sniffer.
  • Hi Yikai ,

    I captured packets using Mighty gecko as the sniffer and attached below are screenshots of packets. From the logs I think the coordinator is up and working fine but enddevice is not properly configured and responding. What can be the possible issue?

  • Do you remove HOLD_AUTO_START from compiler option of end device?
  • Yes I removed HOLD_AUTO_START from both coordinator & enddevice
  • Try to remove NV_RESTORE to test again.
  • I had set SECURE =0 and disabled ZCL_EZMODE, TC_LINKKEY_JOIN, HOLD_AUTO_START, NV_RESTORE from cfg files and also prepocessor defined symbols in IAR for both coordinator & end device. Any further changes needed?

  • I think you should focus on why your device doesn't send beacon requests to join coordinator.
  • Hi Yikai,

        From the screenshots we can see that enddevice is sending beacon requests and also the coordinator is sending beacon....Please correct me if am wrong..

  • Can you attach sniffer file instead of screenshot?
  • Hi,
    Since am using mighty gecko as sniffer the capture file is isd file I am not able to attach it.
  • You can zip the file to attach it.
  • You should attach isd file.
  • I use Ubiqua Protocol Analyzer to open it but It shows the file is empty. Are you sure you attach correct one?

  • Hi Yikai,

    Ubiqua Protocol Analyzer has psd file but this is isd is that the issue?

    I was able to open the file with SimplicityStudio.

  • Ubiqua Protocol Analyzer can open isd file without problem.
  • Hi Yikai,
    I was able to unzip the file both in Windows & Linux PC.
    Also I am able to open the file from SimplicityStudio .....
  • Anyway, I open it with my Simplicity Studio. I think your device had joined other Zigbee network so it won't join current one. I suggest you to do a factory reset to clear network information on your device and try to join it to the coordinator again.
  • Hi Yikai,
    I am using two identical IMX6 based boards with CC2530 as Coordinator & Enddevice. In the Coordinator I flashed the ZNP image in CC2530-Debug configuration and Samplelight application as enddevice configuration in Endevice.
    How can I do the factory reset of CC2530 ?
    If the device is already associated can we find to which coordinator it is connected?
    Since I have dissabled NV_RESTORE will the endevice get connected back to the previous coordinator on power cycle?
    Why the enddevice node is not listed in the simplicity studio ?
  • The easiest way is to disable NV_RESTORE on your SampleLight end device and erase/download it to your CC2530 to test again.
  • Hi Yikai,
    I have tried erase/download with NV_RESTORE dissabled in both Coordinator & Enddevice.
    If the device is already associated can we find to which coordinator it is connected?
    Since I have dissabled NV_RESTORE will the endevice get connected back to the previous coordinator on power cycle?
    Why the enddevice node is not listed in the simplicity studio ?
  • If the device is associated to a coordinator, you can check the connection from sniffer. Since your end device is sending beacon requests and not associated to any coordinator, it won't listed on simplicity studio. Since you have disabled NV_RESTORE, endevice shouldn't get connected back to the previous coordinator after power recycle.
  • Hi Yikai,
    Upto my understanding I think the enddevice sends beacon requests as soon as it is powered up and is ready to join, and the coordinator sends Beacon on receiving a beacon request from enddevice. From the sniffer logs it is seen that both are happening and neither my enddevice is associated with any other coordinator then why the device is not getting joined to coordinator on giving permit join from TI Demo app running in coordinator? Anything missing from configuration?
  • I think the problem is on end device and suggest you to set a breakpoint in ZDO_NetworkDiscoveryConfirmCB to check what happens.
  • Hi Yikai,
    Which are the registers/variables I need to check using the breakpoint
  • Sorry, you should set breakpoint in "case ZDO_NWK_DISC_CNF:" of ZDApp_ProcessOSALMsg and check why it doesn't join.
  • Hi Yikai,
    When I try to put breakpoint and run debug, IAR is throwing error "Could not go to main"
  • To better help on this: can you please describe your system better:
    On the coordiantor - you are running your linux host processor (running HAgateway reference code) + CC2530 (running ZNP application).
    Question:
    -- Are the linux host processor and CC2530 connected via UART? Please note UART is the only supported mode with the HAgateway linux application as a interface between the host and ZNP. If not I would recommend using uart interface between the linux host and CC2530. That may be the issue.

    On the end device side, the application and the stack are running on the CC2530. To test you are running the samplelight application?
  • Hi Suyash,

     I am working on  Z-stack linux gateway application and CC2530F256 with Z-stack Home automation profile on an IMX6 based custom board. Since all UARTs are preoccupied in our board we need to use SPI interface for connecting CC2530 with the host processor.

    I am trying to communicate between these two IMX6 based custom boards using zigbee. In the Coordinator I flashed the ZNP image in CC2530-Debug configuration and Samplelight application as enddevice configuration in Endevice.

    I compiled ZNP image with macros CC2530_MK and HAL_SPI=true in compiler options for IAR for enabling SPI.

    On Z-stack linux gateway application side I have made the following changes in the NPI_Gateway.cfg:

    [PORT]

    port=2533

    [DEVICE]

    #deviceKey=0 ; UART

    deviceKey=1 ; SPI

    #devPath="/dev/ttymxc2" ; UART/CDC

    devPath="/dev/spidev1.0" ; UART

    [GPIO_SRDY.GPIO]

    value="/sys/class/gpio/gpio124/value"

    direction="/sys/class/gpio/gpio124/direction"

    active_high_low=1 ; (Active Low=0, Active High=1)

    [GPIO_MRDY.GPIO]

    value="/sys/class/gpio/gpio134/value"

    direction="/sys/class/gpio/gpio134/direction"

    active_high_low=1 ; (Active Low=0, Active High=1)

    [UART]

    speed=115200 ; speed

    flowcontrol=0 ; 1=enabled 0=disable

    [SPI]

    speed=500000 ; Set default speed 500kHz

    [LOG]

    log="./NpiLnxLog.txt" ; file to log all event/error

    In the IMX6 device tree two pins are configured as GPIO for SRDY & MRDY.

    For interfacing with SPI, I used the generic SPI drivers with device entry as /dev/spidev1.0. The SPI interface is validated using oscilloscope and it is working fine.

    The current pin configurations of CC2530 for SPI mode are :

        P0_4 -> SSN

        P0_5 -> SCK

        P0_3 -> MOSI

        P0_2 -> MISO

        P1_2 -> CFG0

        P1_3 -> CFG1

        P1_4 -> MRDY

        P1_5 -> SRDY

    The corresponding pin configuration changes are made from zstack side.

    With the above changes on running the script zigbeeHAgw error happens and get restarted.However we were able to solve this issue by manually setting the GPIOs using /sys/class/gpio. On running the script zigbeeHAgw it was running properly. The following is the log :

    root@eliuaccs-dual:~/zigbee/servers# ./zigbeeHAgw bbb
    running zigbeegw.scr on an ARM
    skipping zigbee reset
    Starting the ZigBee gateway subsystem
    deviceKey = 1  (1 )
    devPath = '/dev/spidev1.0'
    logPath = './NpiLnxLog.txt'
    [CONFIG] Warning , key 'active_high_low' is missing for optional GPIO GPIO_SRDY.GPIO
    [CONFIG] Warning , key 'value' is missing for optional GPIO GPIO_SRDY.LEVEL_SHIFTER
    [CONFIG] Warning , key 'direction' is missing for optional GPIO GPIO_SRDY.LEVEL_SHIFTER
    [CONFIG] Warning , key 'active_high_low' is missing for optional GPIO GPIO_SRDY.LEVEL_SHIFTER
    [CONFIG] Warning , key 'active_high_low' is missing for optional GPIO GPIO_MRDY.GPIO
    [CONFIG] Warning , key 'value' is missing for optional GPIO GPIO_MRDY.LEVEL_SHIFTER
    [CONFIG] Warning , key 'direction' is missing for optional GPIO GPIO_MRDY.LEVEL_SHIFTER
    [CONFIG] Warning , key 'active_high_low' is missing for optional GPIO GPIO_MRDY.LEVEL_SHIFTER
    [CONFIG] Warning , key 'active_high_low' is missing for optional GPIO GPIO_RESET.GPIO
    [CONFIG] Warning , key 'value' is missing for optional GPIO GPIO_RESET.LEVEL_SHIFTER
    [CONFIG] Warning , key 'direction' is missing for optional GPIO GPIO_RESET.LEVEL_SHIFTER
    [CONFIG] Warning , key 'active_high_low' is missing for optional GPIO GPIO_RESET.LEVEL_SHIFTER
    [1495085459.091997 (+0. 91997)] ----- START RESET SLAVE ------------
    Reset High
    [1995575824][GPIO]Reset low
    [INT]: Interrupt Event Thread Started 
    [POLL] Locking Mutex for Poll Thread 
    [POLL] Thread Started 
    [415301:24918090:59.092702 (+0.   618)] Reset High
    [1995575824][GPIO]Reset High
    !!! return from HalGpioReset = 0
    Wait 500us for RNP to initialize after a Reset... This may change in the future, check for RTI_ResetInd()...
    [1495085459.093363 (+0.   661)] ----- END RESET SLAVE --------------
     
     
    -------------------- START GPIO HANDSHAKE -------------------
    [1495085459.093427 (+0.    64)] Handshake Lock SRDY... Wait for SRDY to go Low
    [1495085459.093460 (+0.     1)] Set MRDY Low
    [1495085459.093489 (+0.    29)] Wait for SRDY to go High
    [1995575824][GPIO][WARNING] Waiting for SRDY to go high timed out.
    [1495085459.594811 (+0.     4)] Set MRDY High
    [HANDSHAKE] unLock Poll ...(Handshake) success 
    -------------------- END GPIO HANDSHAKE -------------------
    ... freeing memory (ret 0)
    Port: 2533
    Following IP addresses are available:
     
     IPv4: interface: lo     IP Address 127.0.0.1
     IPv6: interface: lo     IP Address ::1
     IPv6: interface: eth0   IP Address fe80::280d:64ff:fe92:49e6
    The socket will listen on the following IP addresses:
     
      IPv4: 0.0.0.0
      IPv6: ::
    0.0.0.0 means it will listen to all available IP address
     
    waiting for first connection on #3...
    [POLL] Thread Continues After Synchronization
    NPI started (pid 545) at Thu May 18 05:31:03 UTC 2017
    Connected to #8.(127.0.0.1 / ::400:0:e05c:f276)
    ZLSZNP started (pid 550) at Thu May 18 05:31:07 UTC 2017
    [NWK_MGR/MAIN] :  there are 2 args
    [NWK_MGR/MAIN] :  argv[0] = ./NWKMGR_SRVR_arm
    [NWK_MGR/MAIN] :  argv[1] = 127.0.0.1:2536
    [NWK_MGR/MAIN] :  ************************************************
    [NWK_MGR/MAIN] :  *         Network Manager Server v1.0.1        *
    [NWK_MGR/MAIN] :  * The following are the avaible key commands:  *
    [NWK_MGR/MAIN] :  * Exit Program.                         -  q   *
    [NWK_MGR/MAIN] :  ************************************************
    NETWORK MANAGER started (pid 556) at Thu May 18 05:31:08 UTC 2017
    [GATEWAY/MAIN] : 
    [GATEWAY/MAIN] :  ************************************************
    [GATEWAY/MAIN] :  *            Gateway Server v1.0.1             *
    [GATEWAY/MAIN] :  * The following are the avaible key commands:  *
    [GATEWAY/MAIN] :  * Exit Program.                         -  q   *
    [GATEWAY/MAIN] :  ************************************************
    GATEWAY SERVER started (pid 562) at Thu May 18 05:31:10 UTC 2017
    [OTASRVR/MAIN] : 
    [OTASRVR/MAIN] :  ************************************************
    [OTASRVR/MAIN] :  *                OTA Upgrade Server 1.0.1      *
    [OTASRVR/MAIN] :  * The following are the avaible key commands:  *
    [OTASRVR/MAIN] :  * Exit Program.                         -  q   *
    [OTASRVR/MAIN] :  ************************************************
     
    OTA SERVER started (pid 570) at Thu May 18 05:31:12 UTC 2017
    starting tracker with our pid ./zigbeeHAgw and pid list 545 550 562 570
    ===================================================
    tracking 4 pids, 545 550 562 570
    when we see something missing we will send a SIGUSR2 to pid 491
    After running the script zigbeeHAgw in background, I started the TI demo application manually using the command ../app/main.bin 127.0.0.1 2540 127.0.0.1 2541 127.0.0.1 2525 and the demo app came up successfully. Even though the app came up when I gave permit join it is not listing the zigbee nodes.From Z-Stack Developer's Guide it is seen that the sample application requires key press for initiating the binding I disabled the security and EZMODE parameters from cfg files but still the enddevice is not getting bind.
    I had disabled ZCL_EZMODE, TC_LINKKEY_JOIN, HOLD_AUTO_START, NV_RESTORE, NV_INIT from cfg files and also prepocessor defined symbols in IAR also I have made SECURE=0 in both coordinator & endpoint.
    I captured packets using Mighty gecko as the packet sniffer and attached below are screenshots of packets. From the screenshots we can see that on giving the permit join request from TI Demo app in coordinator the packets are send so according to my understanding we can consider that SPI interface is fine. Also the enddevice is sending Beacon Requests then what can be the possible issue for binding?
     
    Is there anything else I need to take care from ZNP / Enddevice image side?
     
    Also do we need SPI related changes in enddevice stack?