Zigbee & Thread Knowledge Base

    Publish
     
      • Can CSLIB be used with the Thread SDK?

        JohnB | 12/345/2017 | 11:53 PM

        I'm wondering if/when you'll have a sample project for utilizing the capacitive touch features of the EFR32 parts.

        As an investigation, I tried porting the sample code found in...


        C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v2.0\app\mcu_example\SLSTK3402A_EFM32PG12\cslib

        ...but I stumbled on conflicting definitions of LDMA_IRQHandler from the required "dmadrv" module (I believe the serial plugin uses this).

        Are you planning on integrating CSLIB with Thread sample projects anytime soon? Perhaps in the form of a plugin?

         

        For starters, it's important to note that if you are using the serial plug-in for the Thread SDK, it makes use of UARTDRV, which, in turn, depends on DMADRV. Both of these drivers are components of emdrv, a driver abstraction layer that is part of the Gecko SDK platform. It is common for other emdrv components, like GPIOINT, RTCDRV, SLEEP, TEMPDRV, and USTIMER, to be used in a Thread application, including the samples that can be selected when creating a new project in Simplicity Studio.

         

        Emdrv, in turn, sits on top of emlib, which is the hardware abstraction layer for the EFM32 and EFR32 device families and is also part of the Gecko SDK platform. So, while emlib simplifies the task of configuring the underlying MCU hardware on a given EFM32 or EFR32 device, emdrv allows portable code to be written that can run on any EFM32 or EFR32 device. These distinctions are important because they help explain why the CSLIB example code for the Pearl Gecko 12 Starter Kit cannot be incorporated into a Thread project.

         

        In particular, the conflicting definitions of the LDMA_IRQHandler() occur because CSLIB has its own implementation of the function in the device_CSEN/hardware_routines.c file that is a required part of all projects that make use of CSLIB:

         

        void LDMA_IRQHandler(void)
        {
          uint32_t pending;
          /* Read and clear interrupt source */
          pending = LDMA_IntGetEnabled();
        
          if ((pending & 3) == 3) {
            /* Setup LDMA for next transfer, common for single and scan mode */
            LDMA->IFC = 0x03;
            setupCSENdataDMA();
            CSLIB_autoScanComplete = 1;
            CSENtimerTick = 1;
          }
        }

         

        This is not allowed in a project that makes use of UARTDRV because DMADRV (which is required by UARTDRV) must have its own implementation of LDMA_IRQHandler() in order to dispatch callback functions. Furthermore, CSLIB performs its own LDMA configuration using emlib functions:

         

        static void setupCSENdataDMA(void)
        {
          static const LDMA_Init_t ldma_init = LDMA_INIT_DEFAULT;
        
          LDMA_TransferCfg_t csenTransfer =
            LDMA_TRANSFER_CFG_PERIPHERAL(LDMA_CH_REQSEL_SIGSEL_CSENDATA | LDMA_CH_REQSEL_SOURCESEL_CSEN);
        
          LDMA_Descriptor_t csenTransferDesc = LDMA_DESCRIPTOR_SINGLE_P2M_BYTE(&CSEN->DATA,
                                                                               CSLIB_autoScanBuffer,
                                                                               DEF_NUM_SENSORS);
        
          LDMA_TransferCfg_t baselineTransfer =
            LDMA_TRANSFER_CFG_PERIPHERAL(LDMA_CH_REQSEL_SIGSEL_CSENBSLN | LDMA_CH_REQSEL_SOURCESEL_CSEN);
        
          LDMA_Descriptor_t baselineTransferDesc = LDMA_DESCRIPTOR_SINGLE_M2P_BYTE(CSLIB_autoScanBuffer, &CSEN->DMBASELINE,
                                                                                   DEF_NUM_SENSORS);
        
          /* Initialize descriptor for CSEN DATA LDMA transfer */
          LDMA_descCh0 = csenTransferDesc;
          LDMA_descCh0.xfer.doneIfs = 0;
          LDMA_descCh0.xfer.blockSize = ldmaCtrlBlockSizeUnit1;
          LDMA_descCh0.xfer.ignoreSrec = 0;
          LDMA_descCh0.xfer.reqMode = ldmaCtrlReqModeBlock;
          LDMA_descCh0.xfer.size = ldmaCtrlSizeWord;
        
          /* Initialize descriptor for CSEN BASELINE LDMA transfer */
          LDMA_descCh1 = baselineTransferDesc;
          LDMA_descCh1.xfer.doneIfs = 0;
          LDMA_descCh1.xfer.blockSize = ldmaCtrlBlockSizeUnit1;
          LDMA_descCh1.xfer.ignoreSrec = 0;
          LDMA_descCh1.xfer.reqMode = ldmaCtrlReqModeBlock;
          LDMA_descCh1.xfer.size = ldmaCtrlSizeWord;
        
          /* Initialize the LDMA with default values. */
          LDMA_Init(&ldma_init);
          LDMA_StartTransfer(1, &baselineTransfer, &LDMA_descCh1);
          LDMA_StartTransfer(0, &csenTransfer, &LDMA_descCh0);
        }

         

        As you might imagine, this programming of the LDMA is not possible because DMADRV must handle the allocation of all channels and manage all descriptors. This is especially important when you consider that DMADRV manages LDMA resources dynamically while the emlib code above does so in a static fashion. Put simply, DMADRV and CSLIB, as currently written, cannot coexist because it would be a case of the right hand not knowing what the left is doing.

         

        Radio stack plug-in support for CSLIB is in development. For users with immediate needs, setupCSENdataDMA() could be rewritten to use DMADRV, and the LDMA_IRQHandler() instance in device_CSEN/hardware_routines.c would be eliminated and replaced with a callback function.

      • Setting up Serial Output Using Hardware Configurator

        ADKates | 12/337/2017 | 04:18 PM

        As of the Q3 2017 release of Simplicity Studio, the Hardware Configurator allows you to set up USARTs for UART, with many options such as Virtual COM  (VCOM), Virtual UART (VUART), and configure the many options and pins within the HWCONF interface for Zigbee, Thread, Flex/RAIL and even the Gecko Bootloader. Conveniently, these settings can be shared among stacks by importing the .hwconf file.

        Here is a quick overview of the key requirements for setting up your serial ports and some tips which may not be immediately obvious.

        The Serial section contains the following buttons: Serial, Virtual COM and Virtual UART

        Clicking on the Serial button displays the Serial Properties to the right, but you need to check the box to enable it.

         

         

         

         

        When you enable Serial, you need to decide where the signal is directed, either to a physical UART on one of the USART peripherals, in which case you must enable the corresponding USARTx peripheral module, or the Virtual UART (VUART), in which case you must enable the Virtual UART peripheral block and set the output method (usually SWO). SWO is a normal function of the SerialWire/JTAG [SWJ] peripheral, so you’re not precluding debug by enabling this.

        USART ports can be separately selected for Application serial comms, and Asserts. Note: in EmberZNet and SL-Thread, most asserts are sent via the Application comms. 

        You can configure Wake from GPIO RX and must select the LEUART or the USARTs for serial.

        Peripherals

        One of the USART0, USART1, USART2, USART3, LEUART0 and VUART peripherals must be selected in the Serial peripheral, but they must also be configured and selected in the Peripherals section as well. 

        NCP

        To use them, SPI NCP and UART NCP need to have USART ports selected, along with a few other pins.

        Virtual COM 

        VCOM is only for WSTK interaction when you’re routing VCOM_TX/RX lines from a physical USART back through the WSTK board controller for hosting through the USB/Ethernet console rather than the expansion header.  The check box in Hardware Confgiurator is used to select the pin that will be driven high to enable VCOM. This is usually PA5, but check your radio card Reference Manual to confirm. (For example search for VCOM_ENABLE in www.silabs.com/documents/public/reference-manuals/brd4151a-rm.pdf) 

        If you don’t pick the correct pin, you won’t get VCOM and will need to view the serial I/O through the EXP Header on the WSTK.  If you try to set the picklist for the pin to “Disable” it’s just floating the pin, which gives you ambiguous behavior, unless you add init code as shown in the note below.

        EXP (Expansion Port) Hardware UART

        When VCOM is not set up, the UART will come out as TTL signals on the WSTK expansion port pins. 

        Important: As of December 1, 2017, simply disabling Virtual COM in Hardware Configurator will not achieve this setting; to send UART out via EXP on WSTK, follow these steps:

        • Check the Virtual COM box
        • Configure the VCOM by setting it to Disable (ie, set the VCOM pin low)
        • Configure the VCOM pin (usually PA5) with the following custom code in an init callback:
          • GPIO_PinModeSet(gpioPortA, 5, gpioModePushPull, ENABLE_VCOM)

        VIRTUAL UART

        VUART provides serial communications over Serial Wire (SWO) or RTT (Real Time Terminal). It uses fewer pins and runs faster than a traditional UART connection (500kbps). To enable it:

        Turn on Serial and Virtual UART(and turn off Virtual COM). In Serial, pick VUART as the Application and Assert comms. In Virtual UART, set the VUART Type to SWO (less commonly, to RTT). Turn off all of the USART/LEUART peripherals.Turn on the GPIO peripheral and in most cases leave the value at the default PF2 pin.

        In Simplicity Studio, you'll see VUART on the Serial0 tab of the Console or via telnet on port 4900.

        Important: As of December 1, 2017 there is an open bug where the required baud rate value is not set for Virtual UART in the hal-config.h file, so you'll need to add it manually (use 115200):

        Near, but outside the // $[SERIAL] ... //[SERIAL]$ block, add

        #define HAL_SERIAL_APP_BAUD_RATE 115200

        (Note that items inside the // $[]..// []$ tags will get written over anytime Hardware Configurator changes, which is why you should put this line outside of the tags)

        SERIAL TIPS AND TRICKS

        • If you are working with a custom board (not a Silabs Radio Card) and connecting to the WSTK via the Mini-Simplicity Connector, set the WSTK mode to OUT and (counter-intuitively) uncheck the Virtual COM Port. VCOM is seen in Simplicity Studio on the Serial1 tab of the Console or telnet on Port 4901.
        • Although the SWO pin is unchecked, SWO is enabled on the Silabs Radio Boards. The most consistent way to see SWO output is via Simplicity Commander's CLI: enter "commander swo read". 
        • Always Save after modifying the Hardware Configurator file and before Generating and Building. (Save sometimes takes much longer than expected.)
        • After setting up serial, sometimes you need to reset the board, WSTK or even your computer (to clear the computer's COM ports if you are using the USB for VCOM). 
      • How to enable voltage scaling in EM2 mode for EFR32MG12 and later devices

        satownse | 11/332/2017 | 01:17 PM

        The EFR32MG12 and later devices (MG13, MG14) list EM2 sleep current in the datasheet with voltage scaling enabled.  However, the default energy mode configuration for EM2 is voltage scaling disabled.  To enable voltage scaling, select the "DefaultMode Peripherals" tab of the hwconf file and click on the EMU peripheral.

         

        In the properties window, change the property "EM2/3 voltage scaling level" from "Fast wake-up" to "Low power".

         

        Click the Save icon and then Generate and Build your project.

        Note: A feature request has been logged to enable voltage scaling in EM2 mode for sleepy device types selected in AppBuilder.

      • How to use End Device Timeout Request Command on sleep end device

        JasonHou | 11/332/2017 | 04:39 AM

        The End Device Timeout Request command is sent by an end device informing its parent of its timeout requirements.This allows the parent the ability to delete the child entry from the neighbor table if the child has not communicated with the parent in the specified amount of time.(For more details please refer to zigbee Specification Revision 22).Stack will send End Device Timeout Request Command to praent automaticaly when the sleep end device join/rejoin to the network.User can modify the timeout value through modifying EMBER_END_DEVICE_POLL_TIMEOUT and EMBER_END_DEVICE_POLL_TIMEOUT_SHIFT.The timeout value in seconds is EMBER_END_DEVICE_POLL_TIMEOUT<< EMBER_END_DEVICE_POLL_TIMEOUT_SHIFT.

      • Access to Silicon Labs wireless mesh networking stacks

        RonB | 11/326/2017 | 01:11 PM

        Silicon Labs is the vendor of choice for OEMs developing Zigbee and Thread networking into their products by providing reliable, low-power, secure, and scalable networking solution for connecting Things to the IoT.  The Silicon Labs EmberZNet platform is the most integrated, complete and feature rich Zigbee solution available.  While the Silicon Labs Thread platform is a proven IPv6-based mesh networking protocol.  Both solutions help accelerate time to market with the most reliable, scalable and advanced Zigbee and Thread software, supported by best-in-class development tools.

        Requirements for Stack Access

        Access to our wireless mesh stacks requires the purchase of one of our full mesh networking development kits (such as the EFR32 Mighty Gecko Wireless Starter Kit, the EM35x Mesh Networking Development Kit or the Samsung ARTIK 030 Development Kit) or being a contract manufacturer for an existing customer (contact your FAE for these requests).

        This does not include non-mesh wireless development kits, like the Flex Gecko or Blue Gecko kits.  And unfortunately at this time, the Thunderboards (React, Sense and Sense 2), ETRX Development Kits and the Connected Home Reference Designs do not grant access to our stacks.

        It is important for customers to have one of Silicon Labs development kits as they provide a complete mesh networking platform environment to develop and deploy successful ZigBee and Thread applications.  With multiple nodes you can develop a complete mesh network and the WSTK development boards provide a full JTAG debugging and programming solution.

        To unlocking stack access.

        First locate your development kit software serial number.  The location of the serial number depends on your development kit:
         

        EM35x Development Kit - a 24-digit hex number found on the bottom right of the back of the user quick start guide

         


        Mighty Gecko Starter Kit - a 10-digit hex number found on the label on the side of the box

         


        ARTIK 030 Development Kit - a 10-digit hex number found on the label on the side of the box

         

        Once you have located the serial number, you can register you kit in one of two ways:

        1. Log in to your portal account and register your software serial number at:  https://siliconlabs.force.com/KitRegistration

         

        2. Download and install Simplicity Studio.
           From the launcher view, the Sign In menu includes a Kit Registration option

         

         

        Once the registration is successful you will have access to our most recent stacks in Simplicity Studio v4 (required for use with the stack).  All software and stacks can be found in the portal.

         


        Contact support with any questions or problems.

      • How to Create Smart Energy Customized NCP project with Pre-Built NCP images Config

        Azam Chatta | 11/320/2017 | 03:49 AM

        Silicon Labs provides pre-built NCP images and sample NCP applications for different use cases in the stack. The customer has the option either use one of the pre-built NCP images or use sample NCP applications or a blank NCP application to build customised NCP application.

        The below resopurces provide good information before continue with generating Smart Energy customized NCP image.


        The AN1010 application note provides detailed guide about building a customised NCP appliocation.
        You can find this here:

        https://www.silabs.com/documents/public/application-notes/an1010-customized-ncp.pdf

        Another useful application note is AN714, this guide provides information about smart energy ECC-enabled device setup process.
        You can find this here:

        https://www.silabs.com/documents/public/application-notes/AN714-SmartEnergyECCEnabledDeviceSetupProcess.pdf


        The KBA at below link provides information about the ECC libraries and adding them to the stack.

        https://www.silabs.com/community/wireless/zigbee-and-thread/knowledge-base.entry.html/2017/06/05/how_to_add_ecc_libra-IQL1


        Although the customer cannot generate exactly NCP binary as pre-built, however if they use one of NCP sample applications and make below changes then they can generate a NCP image functionaly similar to pr-built NCP image.
         
          The steps to generate smart energy NCP image similar to pre-built smart energy NCP image:


          (1) Start a new customised NCP project based on one of sample NCP applications. You may select 'xncp-commshub-uart-dual'   sample NCP application for ComsHub and 'ncp-uart-hw' for end device depending on your needs.
         
          (2) Select the following plugins and do not change any other already selected plugins.
            
          XNCP Stub Library
          Zigbee PRO Stack Library
          Zigbee Light Link Stub Library
          Zigbee PRO Core Security Library
          Security Link Keys Library
          End Device Bind Library
          Binding Table Library
          ECC 163k1 Library
          ECC 283k1 Library
          CBKE Core Library
          CBKE 163k Library
          CBKE 283k Library
          Install Code Library
          CBKE DSA Verify Library
          CBKE DSA Sign Stub Library
          CBKE 283k DSA Verify Library
          Packet Validate Library
          Multi-Network Stub Library
          GreenPower Stack Stub Library
          Concentrator Support Library
          Manufacturing Library
        (3) Select Zigbee PRO Stack Library plugin and set Child Table Size to 32. The other settings selected by sample NCP application are ok.
        (4) Generate and build the project.


         

      • HAL Configurator Reference ZNet 6.0 Thread 2.4

        ADKates | 11/313/2017 | 05:18 PM

        The attached document is a docx reference for the October release of the 6.0 ZNet Beta and the subsequent GA release of the 6.0 ZNet stack and the 2.4 Thread stack. If you do not have Microsoft Word, you can download the original .html reference in a .zip archive.

        The  stacks have a new Hardware Configurator which generates the #defines as seen in this document into the [part].hwconfig file and the config file for the particular stack, like hal-config.file or bootloader-configuration.h.

        For anyone not using the HWConf or having unexpected outputs in the Beta release, this reference document provides the defines, values and dependencies for the hardware, clock and peripheral options.

        For more context on these defines, this is an extension of the new HAL structure begun in the June 2017 release and described here:

        https://www.silabs.com/community/wireless/zigbee-and-thread/knowledge-base.entry.html/2017/06/07/migrating_to_thenew-mse3

        The new defines are more uniformly named and implemented, but the system is very similar. If you have implemented the June 2017 version, it should be easy to see what the new defines and values are.

      • Turning any EFR32 into a Zigbee or Thread Sniffer

        EzraHale | 11/313/2017 | 03:52 PM

        Any EFR32 can be easily turned into a Zigbee or Thread sniffer device using the Railtest sample application included in the free Flex SDK.

        In order to do this follow the steps below:

        1. Download the Flex SDK via Simplicity Studio V4.
        2. Create a new Railtest sample application for your desired part using the default Profile and PHY settings (Generate and compile using GCC or IAR)
        3. Load the built binary image onto your chosen EFR32 dev board.
        4. Connect to the console of your EFR32.
        5. In order to turn the Railtest image into a sniffer for 802.15.4 protocols like Zigbee and Thread you will need to issue the following commands over the console:
          1. > rx 0
            1. This will put the radio into an idle state so that you can configure it.
          2. > config2p4GHz802154
            1. This command configures the radio for the 802.15.4 phy
          3. > enable802154 rx 100 192 864
            1. Puts the radio into the right mode for 802.15.4 capture
          4. > setPromiscuousMode 1
            1. Puts the radio into promiscuous capture mode so it can act as a sniffer
          5. > setChannel <yourChannel, (11 - 26)>
            1. Sets the desired channel you wish to sniff.
          6. > rx 1
            1. Puts the radio back into receive mode.
        6. Now simply capture from your device in the Network Analyzer and you should start seeing traffic captured from the network.
      • How to build an EZSP-UART host application

        JasonHou | 11/305/2017 | 04:49 AM

        Here are some steps you can follow to build an EZSP-UART host application with an EFR32MG1 or EFR32MG12 device (on our dev kit) running a pre-built NCP-UART image of the latest EmberZNet stack, which is v6.0.0.0 at the time of this article.

         

        1. Create a new Silicon Labs AppBuilder Project in Simplicity Studio v4 of type "ZCL Application Framework V2", and choose the host (as apposed to SoC) flavor of the latest EmberZNet stack.

         

        2. Choose a sample application, such as Z3Gateway.choose "Noon(compatible)" in Part tab. and click "Finish"

         

        3. Generage the project without any modification.

         

        4. Build the host application.

        Building the Host application can be done on a Linux system(this sample built on Cygwin) and requires a number of development tools. We assume you have access to these tools. They are as follows:

        • Make

        • GCC

        • sed

        • awk

        • xargs

        • The standard C Library and its development headers

        • The Readline Library and its development headers

        • The Ncurses Library and its development headers

        . Run "make" on the generated Makefile from the directory<\SiliconLabs\SimplicityStudio\v4_4\developer\sdks\gecko_sdk_suite\v2.0\app\builder\Z3GatewayHost> and the compilation should complete successfully.

         

        5.Running the Host application

        The USB port is either COM1, COM2, COM3, and so on. The following example uses COM19.

        a. Launch a Cygwin Shell.

        b. Navigate to the directory where the project is located, for example:cd /cygdrive/c/SiliconLabs/SimplicityStudio/v4_4/developer/sdks/gecko_sdk_suite/v2.0/app/builder/Z3GatewayHost/build/exe

        c. Type the command: ./Z3GatewayHost.exe -n 0 -p COM19