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.

CC2531: How to properly build for cc2531 in Z-Stack linux gateway

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

Hey all, 

I'm currently trying to use IAR embdedded workbench to rebuild firmware for the cc2531. I'm using the cc2531 dongle as the rf interface to the Linux Z-Stack gateway. Currently the dongle is flashed with the provided CCC2531-GW-ZNP_38724.hex. What I'm trying to do is see the source for that code, add low-level debugging to it, and then re-flash to the dongle and have the dongle provide the same functionality to the gateway application. 

I created a hex file using IAR workbench (based off the Sample thermostat example) and can successfully flash it to the dongle, but now when running the gateway scripts, it fails to see the dongle device and properly bring up the servers. I'm willing to bet that some source is missing.... Any ideas?

If its easier to move the code to the gateway application code instead of the dongle, I can try and do that, but as far as I'm aware, there's no high level to peek into into the gateway's message buffers at that level. 

Any advice on how to proceed, would be great.

Spencer 

  • The FW running on CC2531EMK-USB should be based on ZNP project.

  • Great that makes some level of sense. Is there source to that anywhere so I know how I should edit appropriately? 

  • It’s ZNP example in Z-Stack installation folder.
  • Thanks, found it. One question, I'm trying to build the cc2531 with no serial bootloader example to a hex file that I can flash with flash programmer. Any clue what compile flags / linker options I need to do this.
  • If I remember correctly, the default project settings would generate hex file.
  • Sucesssfully built and flashed the CC2531 - ZNP-with-SBL example as a hex file to the cc2531 using the flash programmer. Now while trying to use it in conjunction with the Z-Stack Linux gateway, I'm getting no signs of life from the usb. I keep getting the "Could not open device.." error. Generally we the pre-built hex file, I'm able to the gateway up within a minute or two. No activity here. lsusb and /var/log/syslog show no indications of recognizing the dongle. Worth mentioning that the gateway setup operates well enough with the default hex file. 

    Any thoughts? Thanks for all the help by the way, really appreciate it.

    Spencer

  • Try to add ENABLE_MT_SYS_RESET_SHUTDOWN to compile options of ZNP to rebuild it and test again.
  • Tired this, but got compile issues of the:


    Error[Pe223]: function "MAC_RADIO_RXTX_OFF" declared implicitly C:\Texas Instruments\Z-Stack 3.0.1\Components\mt\MT_SYS.c 2150
    Error[Pe223]: function "MAC_RADIO_FLUSH_RX_FIFO" declared implicitly C:\Texas Instruments\Z-Stack 3.0.1\Components\mt\MT_SYS.c 2153
    Error[Pe223]: function "MAC_RADIO_CLEAR_RX_THRESHOLD_INTERRUPT_FLAG" declared implicitly C:\Texas Instruments\Z-Stack 3.0.1\Components\mt\MT_SYS.c 2156
    Error[Pe223]: function "MAC_RADIO_TIMER_SLEEP" declared implicitly C:\Texas Instruments\Z-Stack 3.0.1\Components\mt\MT_SYS.c 2159
    Error[Pe223]: function "MAC_RADIO_TURN_OFF_POWER" declared implicitly C:\Texas Instruments\Z-Stack 3.0.1\Components\mt\MT_SYS.c 2162 

    Not sure where these functions are supposed to be defined... ill try to dig a bit more. I saw there was another thread with someone who had this issue, but there didn't seem to be a clean resolution. 

  • Figured out that

    #include "mac_radio_defs.h" needed to be added to MT_SYS.c in order for compiler to play nice with ENABLE_MT_SYS_RESET_SHUTDOWN.

    Still no luck with the gateway though. lsusb and syslog still don't pick up the device...

    Any recommendations from here out would be appreciated.
  • Hi,

    What are you using as your Linux host? This may be a silly question but have you verified that the USB port is providing power? I find that sometimes with the BBB, the USB port stops powering the dongle when the gateway's reset scripts are used.

    By the way, to see if the device is enumerating, I generally call " ls /dev/tty* ", you should see the dongle show up as /dev/ttyACM0 if it is being recognized.
  • Jason,

    I'm using Ubuntu 14.04, 64 bit processor built for x86. I know that the usb is not the issue since I am able to flash the GW_ZNP_3875 .hex (actual name might differ, i'm doing this from memory) file (this is the one that comes with the z-stack source) cleanly, and use it when plugged into the machine with the gateway, just fine. The device shows up as ttyACMO and it's able to start the NPI as desired. I try to compile the cc2531 znp source (with serial bootloader) (which also comes with zstack) with no source added by myself, and I able to produce a hex file that is able to be flashed and verified to the target cc2531 via flash programmer.

    However, that hex image produces no signs of life when plugged into the same port, trying to run the same gateway scripts that worked with the provided hex file. There is no life from the on-board led, there is no device that shows up under lsusb or /dev/. Syslog doesn't give any information, and I'm not sure how to best proceed.

    Again though, I appreciate you guys looking into this.

    Spencer
  • Okay, so I'm guessing you're building ZNP from Z-Stack 3.0.1 and trying to use it with the (deprecated) HA 1.2 Linux Gateway which is currently available on the web, this may have something to do with the issue you are experiencing.

    We have a Zigbee 3.0 gateway package that is going to become available on the web soon, I will send you a direct message with more information.
  • I had built CC253x ZNP from Z-Stack Home 1.2.2a and make it work with Z-Stack Linux Home GW. Which Z-Stack version do you use to build ZNP example?
  • I'm using Z-Stack 3.0.1 with the Linux gateway src version 1.0.1.
  • I suggest you to use Z-Stack Home 1.2.2a since it Z-Stack Linux Home GW.
  • Hi Spencer,
    Make sure that, you are using the correct hex file from this directory-C:\Texas Instruments\Z-Stack 3.0.1\Projects\zstack\ZNP\CC253x\dev

    I had tested cc2531 znp (z-stack 3.0) with z-stack linux HA gateway available on web , it works.
  • Hey Dhanraj,

    Thanks for the reply. I see that the hex file exists, and when I flash it, it works. What I'm trying to do however is build that hex file from source... Figuring out where that source lives is the current problem.
  • what source/Info you are looking for ??
  • So the Z-Stack Linux Gateway Src folder comes with a file in the firmware directory called cc2531-GW-ZNP_38724.hex

    This is the default image that when flashed on to the cc2531 and used with the Linux gateway scripts, works. What I'm trying to do is add code at the dongle firmware level - so being able to simply compile + peer at the source of the above mentioned hex file, would be great. Cause in theory it should compile to the same hex file and work as the hex file out of the box does.

    Spencer
  • Yikai,

    I downloaded the Z-stack Home 1.2.2a and am trying to reproduce your results. Could you please clarify which file/ build options you used to get to this point. It'd be worth knowing what your Linux host is.
  • Gonna just bump this since it's currently blocking my work, but does anyone have the source file / workspaces for the default cc3521 hex files that get shipped with the various Z-stack firmware directories? All the znp src examples that I find and flash to the cc3531 don't have the same behavior as the shipped binary.

    Spencer
  • I had tested a lot of Linux Host, such as X86 Ubuntu, AMD64 Ubuntu, Raspberry Pi and BBB. All of them can run Z-Stack Linux Home GW without problem.
  • Yeah again, It's the firmware that's actually on the cc2531 and not the gateway itself. Can anyone speak to git.ti.com/.../znp-host-framework ? and whether this would work on the cc2531? It fails to mention anything about it in the documentation.
  • Hi Spencer,

    Are you using the Zigbee 3.0 Linux gateway package with the Z-Stack 3.0.1 ZNP image?
  • That code repository is for this TID: www.ti.com/.../TIDC-ZNP-HOST-SW3

    Designed for the CC2538EM and not initialized for a gateway connection to the internet.

    Regards,
    Ryan
  • Jason,

    No. I was unable to properly compile + run, the ZigBee 3.0 Linux Gateway on my x86 Ubuntu host despite changing the all #defines in the build script. I know it's meant for the beaglebone out of the box, but its not worth my time at this point to try and compile the new image for this host. I only am to get the old gateway script to work properly. I want to see raw mac frames on the network!! I need to see incoming and outcoming frames that are over the air!! the MT_MAC api looked promising, but that seems to be depreciated? All of this is largely moot since I can't for the life of me get ZNP source for the cc2531 dongle to compile and run nicely w the gateway. I have to use to the default hex, so I'm left looking for how to do this on the application layer. Currently i'm doing this with AF_INCOMING_MSG, but this isn't great because there's no guarantee it represents an OTA command and because only the endpoint is given.

    I'm sorry for the warbled rant, I appreciate all the suggestions you guys have given me, it just really feels like this shouldn't be such a pain.

    Spencer
  • Do you mean ZigBee 3.0 Linux Gateway or Z-Stack Linux Home GW reference design?
  • Okay, if you want to use the HA 1.2 gateway (the one available on the web currently), you will need to build a ZNP using Z-Stack Home 1.2.2a for CC253x (which is now deprecated)

    It is available here as Z-STACK-HOME:
    www.ti.com/.../Z-STACK-ARCHIVE

    The ZNP project built for CC2531 (ProdHex) should work as the ZNP device for the gateway.