Proprietary Knowledge Base

    Publish
     
      • SEGGER SystemView for non-OS projects

        sza2 | 12/345/2017 | 04:59 PM

        SEGGER SystemView is a real-time recording and visualization tool. It is freely available from SEGGER’s website.

        This article describes how to setup SEGGER SystemView for a non-OS project and shows how to modify a simple Flex / RAIL example to call SEGGER SystemView routines.

        Since Simplicity Studio contains the SystemView, it is only necessary to download the "SystemView Target Sources" package from https://www.segger.com/downloads/free-utilities/#SystemView

         

        The steps below described how to add SystemView capability to an example project and how to run it:

        • Extract SystemView source files from the downloaded archive (.zip) file to an arbitrary directory
        • Open the RAIL: Simple TRX example project and click on "Generate" to let Studio to generate the necessary files
        • From the previously extracted SystemView source files / directories copy "Config" and "SEGGER" directories and "Sample\NoOS\Config\Cortex-M\ SEGGER_SYSVIEW_Config_NoOS.c" file to the project’s root directory
        • Add the copied directories to the include path of the project:

         

        • Open and edit "main.c" and add the following lines to the code:

        #include "SEGGER_SYSVIEW.h"

        SEGGER_SYSVIEW_Conf();

        SEGGER_SYSVIEW_Start();

        #include "rail_config.h"
        #include "hal_common.h"
        #include "SEGGER_SYSVIEW.h" // include SystemView header file
        
        
        // Memory manager configuration
        #define MAX_BUFFER_SIZE  256
          // Initialize Radio
          radioInit();
        
          SEGGER_SYSVIEW_Conf(); // initialize SystemView
          SEGGER_SYSVIEW_Start(); // start SystemView
        
          // Configure RAIL callbacks
          RAIL_ConfigEvents(railHandle,
                            RAIL_EVENTS_ALL,
        • Open and edit "emdrv\gpiointerrupt.c" and add the following lines to the code:

        #include "SEGGER_SYSVIEW.h"

        SEGGER_SYSVIEW_RecordEnterISR();

        SEGGER_SYSVIEW_RecordExitISR();

        Note, "gpiointerrupt.c" is a shared SDK file, when you start to edit a popup will appear:

        It is recommended to choose "Make a Copy" to keep the original file intact.

        
        void GPIO_EVEN_IRQHandler(void)
        {
          SEGGER_SYSVIEW_RecordEnterISR(); //emit Enter ISR signal
        
          uint32_t iflags;
        
          /* Get all even interrupts. */
          iflags = GPIO_IntGetEnabled() & 0x00005555;
        
          /* Clean only even interrupts. */
          GPIO_IntClear(iflags);
        
          GPIOINT_IRQDispatcher(iflags);
        
          SEGGER_SYSVIEW_RecordExitISR(); //emit Exit ISR signal
        }
        
        • Compile and run the project as usual. SystemView does not require to project to debug, it will work if the code is just running.
        • Click on the SystemView icon in Studio to start SEGGER SystemView application:

        • When SystemView started, click on the green ‘Play’ icon.

        • A configuration window pops up. Leave all setting as their default and click "OK".

        • The SystemView application starts running. Pressing PB0 pushbutton on the WSTK board will result in events recorded:

         

      • How many preamble bytes does Si446x need for antenna diversity?

        zopapp | 12/342/2017 | 09:23 AM

        Note that at the time of writing this article this information is captured incorrectly in the data sheets. The following minimum preambe length requiements are needed for packet loss free reception and no sensitivity loss compared to non antenna diversity applications (less the the insertion loss of the T/R switch and the longer traces obviously).

        When AFC is not enabled antenna diversity requires 80 bits of preamble.

        When AFC is enabled antenna diversity requires 88 bits of preamble.

        Si446x revC2A and A2A devices support antenna diversity with DSA. This operation requitres 64 bits of preamble. Note however that co-channel rejection with DSA in antenna diversity mode is poor so this configuration is not recommended.

        Leave all the antenna diversity parameter calculations to WDS. Make sure you transmit the minimum length of preamble and Rx will just work. 

      • 4GFSK Sync word

        sza2 | 12/342/2017 | 02:42 AM

        Although, the Radio Configurator supports 4FSK modulation, the sync word is 2FSK by default and in the GUI interface it is not possible change this parameter currently.

        However, 4FSK sync word option is available by editing the generated project files.

        The following steps shows how to set the sync word to 4FSK:

        • Open an example or create a new Flex 2.0 project
        • Set the required parameters in the Application Builder
        • Click on “Generate” button and allow the Simplicity Studio to generate the necessary files
        • If the generation was successful, open the project’s rail_config.h file in the project’s root directory.
        • In const uint32_t generated[] = {} configuration array find address 605C and set bit 12 to “1”
        • Save the modified file and continue with compilation as usual

        Exampe:

        const uint32_t generated[] = {
          0x01040FF0UL, (uint32_t) generated_phyInfo,
             /* 0FF4 */ 0x00000000UL,
             /* 0FF8 */ 0x0003C000UL,
             /* 0FFC */ 0x0003C00FUL,
          0x00020004UL, 0x00000000UL,
             /* 0008 */ 0x00000000UL,
          0x00020018UL, 0x0000000FUL,
             /* 001C */ 0x00000000UL,
          0x00070028UL, 0x00000000UL,
               .
               .
               .
             /* 6058 */ 0x000004CDUL,
             /* 605C */ 0x22140A04UL, /* Change this value from 0x22140A04UL to 0x22141A04UL */
             /* 6060 */ 0x504B4133UL,
          0x00037014UL, 0x000270F8UL,
             /* 7074 */ 0x00000433UL,
             /* 7078 */ 0x00552300UL,
               .
               .
               .
          0xFFFFFFFFUL,
        };
        
        Keep in mind, if tweaking rail_config.c (or other auto-generated files) manually, then changes will be overwritten on the next re-generation of files.
      • RF range factors

        zovida | 12/341/2017 | 11:16 AM

        The achievable RF range is affected by many factors as listed below. 

        - Transmit power and TX antenna gain

        - Receive sensitivity and RX antenna gain

        - Frequency: It is related to the gain and effective area of the antenna. It can simply translate into that the lower frequency the link operates at the better RF range can be achieved. 

        - Antenna radiation pattern: The best RF range can be achieved if the TX and RX antennas are facing to each other in their maximum radiation lobes. There could be some directions where the antennas' radiation patterns do have minimum notches and thus the RF range could be poor in these directions. 

        - Interference, noise: Any in-band noise does have severe negative effects on the range since it can mask out the wanted signal at the RX side (see the co-channel rejection parameter). But, stronger out-of-band noise can also degrade the RF range based on the receiver's ACS and blocking performances.  

        - Frequency offset between TX and RX: It can become more critical in narrow-band systems where the exact carrier frequencies must correctly be set. 

        - Final product placement and enclosure: The antenna performance can be affected by any material in the close proximity of the antenna and by the antenna placement. In order to avoid any de-tuning effect (and thus RF range degradation) make sure about the recommended antenna (or i.e. module) placement and clearance. 

        - Environment: Ideal case is an outdoor environment where there are no reflections (e.g. no walls, big obstacles, trees, houses) and there is a direct line-of-sight (LOS) between the TX and RX and there isn't any obstacle in the Fresnel ellipsoid too (see online calculators for the Fresnel zone/ellipsoid). Less ideal case is an urban area, or when there is no LOS between the TX and RX. The worst situation is an office indoor environment where there is typically no LOS and there are walls, obstacles and thus reflections. Propagation constant can describe the environment which is typically 2.5...3.5 in an outdoor environment with LOS between the TX and RX nodes, while can even be 4...6 in an indoor environment.  

        - Transmitter and receiver heights: This is also related whether there is any obstacle, e.g. ground, in the Fresnel ellipsoid. If so, the RF range is negatively affected. Thus, the higher the nodes are placed at the bigger RF range can be achieved.  

         

        See a related KBA link on this topic below which describes an example estimator/calculator for the RF range.

        https://www.silabs.com/community/wireless/proprietary/knowledge-base.entry.html/2017/05/02/rf_range_calculator-SYIA

         

      • Si4x6x/EZR32芯片中不用到的管脚怎么连

        JunFan | 11/311/2017 | 02:52 AM

        实际应用中,客户经常问到以上芯片不用的管脚怎么连接,经查KBA非常感谢Daniel的建议如下:

        • TX脚: 不连
        • RXP, RXN脚: 不连
        • 其它GPIO 脚: 不连
      • 实用的通信距离计算器

        JunFan | 11/311/2017 | 02:36 AM
        Silabs已发布了通信距离计算器。该工具可以根据通信场合,发射功率,接收灵敏度,频率,天线增益等参数来计算真空中及实际应用场合的通信距离。英文板的KBA如下地址:https://www.silabs.com/community/wireless/proprietary/knowledge-base.entry.html/2017/05/02/rf_range_calculator-RtCs
      • 建立C++的BLE工程

        Kevin_Fu | 10/290/2017 | 11:10 PM

        使用BLE协议栈建立C++工程需要如下步骤:

        1. 在main.cpp注释掉att.h并使用extern C围绕所有头文件。

        2. 建立att.c文件,其包含stdint.h和att.h,并将其加入工程。

        3. 使用C/C++编译选项:auto(extension-based)

      • PCB number of layers vs Output power

        dasimon | 08/229/2017 | 07:33 AM

        Using a 2-layer PCB in the application hardware is usually preferred by customers due to cost saving purposes. Still, based on the RF output power level, unwanted radiation of top or bottom layer traces (mostly VDD or digital) can occur, which causes that the application can violate the harmonic limits of the related standards. In order to minimize the possibility of unwanted trace radiations, Silicon Labs recommends to use multilayer PCBs in the following cases:

         

        • >=16dBm output power at sub-GHz frequencies
        • >=10dBm output power at 2.4GHz

        Note that the actual recommendation depends on which standard (ETSI, FCC, ARIB, etc.) the application has to be compliant with.

         

        One can notice that not all Silicon Labs reference design follows the above listed recommendations. EZRadioPRO reference design boards are made on 2 or 4 PCB layers based on the output power, while all EZR32 and EFR32 reference design boards are using 4 or 6 PCB layers due to the complexity of the design. In the latter case, the layout routing could not be realised on a 2-layer PCB if all digital traces were intended to be used. Of course, on a custom design where the complexity of the design is much less, 2-layer PCBs can be used for EZR32 or EFR32 applications as well considering the above listed recommendations.

      • 如何使用Network rejoin加入网络?

        Lesun | 08/218/2017 | 10:39 PM

        问题

         

        设备如何使用Network rejoin方式加入网络?

        答案

         

        本文主要讲解设备在拥有网络信息的情况下,如何通过NWK rejoin的方式入网。通常可通过外部的方式将网络信息传送给某设备节点,该设备节点获取所需要的网络信息后,直接通过NWK rejoin加入网络。此时该网络不需要处于允许设备入网状态(即PJoin状态未开启也可以入网)。下面通过一个例子来讲解该过程。本实验使用两块WSTK+4151radio板。

         

        首先,将UART Bootloader以及NCP firmware烧录一个4151radio板。将板子连接电脑,使用Simplicity Command进行烧录,在CM中输入如下命令:

         

        C:\Users\Lesun>commander flash C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\protocol\zigbee_5.10\ncp-images\efr32mg1p232f256gm48\ncp-uart-rts-cts-use-with-serial-uart-btl-5.10.1.s37 C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\protocol\zigbee_5.10\tool\bootloader-efr32mg1p232f256gm48\serial-uart-bootloader\serial-uart-bootloader.s37

         

         其次,在Cgywin中编译Z3Gateway sample,并运行Host程序,使用如下命令建立网络。使用info CLI命令查看当前网络信息,在下一步设备加入网络时需要用到,包括网络PANID、信道、Network Key等,如下图所示。在Host端输入keys print可以查看该网络的Network Key。

         

        1.png

         

        然后,使用Z3Light sample作为基础示例,在其Z3LightSOC_callback.c上增加如下核心代码:

           

        EmberStatus MyNodeSecurityInit()
        {
                 EmberInitialSecurityState state;
                 EmberStatus status;
                 EmberKeyData NetworkKey = {0x58,0x12,0x17,0x34,0x64,0xC7,0x7A,0xDC,0x40,0xD9,0x39,0x01,0xFB,0xD0,0xF4,0xAE,};
         
                 MEMSET(&state, 0, sizeof(EmberInitialSecurityState));
                 state.bitmask |= EMBER_HAVE_NETWORK_KEY;
         
                 MEMMOVE(emberKeyContents(&state.networkKey),
                         emberKeyContents(&NetworkKey),
                         EMBER_ENCRYPTION_KEY_SIZE);
         
                 emberAfSecurityPrintln("set state to: 0x%2x", state.bitmask);
                 status = emberSetInitialSecurityState(&state);
                 if (status != EMBER_SUCCESS) {
                   emberAfSecurityPrintln("security init node: 0x%x", status);
                   return status;
                 }
         
                 return EMBER_SUCCESS;
        }

         

        void findingAndBindingEventHandler()
        {
        #if 0
          if (emberAfNetworkState() == EMBER_JOINED_NETWORK) {
            emberEventControlSetInactive(findingAndBindingEventControl);
            emberAfCorePrintln("Find and bind target start: 0x%X",
                               emberAfPluginFindAndBindTargetStart(LIGHT_ENDPOINT));
          }
        #else
               EmberStatus status = EMBER_INVALID_CALL;
               EmberNodeType nodeType = EMBER_ROUTER;
               EmberNetworkParameters networkParams;
         
               MEMSET(&networkParams, 0, sizeof(EmberNetworkParameters));
               networkParams.radioChannel = 25;
               networkParams.radioTxPower = 8;
               networkParams.panId = 0x08B6;
               networkParams.joinMethod = EMBER_USE_NWK_REJOIN_HAVE_NWK_KEY;
         
         
               emberEventControlSetInactive(findingAndBindingEventControl);
         
               status = MyNodeSecurityInit();
         
               emberAfCorePrintln("MyNodeSecurityInit status = 0x%X", status);
         
               status = emberJoinNetwork(nodeType, &networkParams);
         
               emberAfCorePrintln("%ping on ch %d, panId 0x%2X.  status = 0x%X",
                                   "Join",
                                                    networkParams.radioChannel,
                                                    networkParams.panId, status);
        #endif
        } 

         

         

        最后,将Bootloader以及编译生成的应用程序烧录另一个4151radio板,按下WSTK地板上任何一个按键,可以看到该设备成功加入刚才建立的网络。输入info CLI命令可以查看该设备的网络信息,如下图所示。

         2.png

         

        总结:以上主要介绍一种out-of-band的实现方式。当设备获取网络参数之后,可以通过NWK rejoin加入网络,即通过调用emberJoinNetwork()以及在此之前调用emberSetInitialSecurityState()来实现。其中需要将安全状态的bitmask 设置为EMBER_HAVE_NETWORK_KEY,并设置正确的网络Key。

      • EmberZnet调试UART-NCP(基于EFR32MG)的一些实用方法

        Lesun | 07/208/2017 | 11:04 PM

        问题

         

        EmberZnet调试UART-NCP(基于EFR32MG)的一些实用方法

        答案

         

        通常客户在设计Gateway的时候使用Host+NCP模式。在客户的设计中常用32Pin的EFR32MG的芯片进行Gateway设计开发,其中NCP与UART使用两线串口(Tx/Rx)相连。本文提供在该情境下调试NCP的一些实用方法。

         

        首先,由于Silicon Labs在stack中只提供关于标准无线板(如BRD4151/BRD4161 radio board)的预制固件,包括Bootloader以及NCP firmware。任何其它型号的芯片,尤其是32Pin的EFR32MG芯片的固件都需要客户自己进行自定义编译。

         

        在此有两篇关于如何编译自定义固件的KBA,供客户参考。

        Make customized ZigBee bootloader for the EFR32MG1 QFN32 parts

        Make customized ZigBee xNCP images for EFR32MG parts 

         

        注意:在编译NCP的时候,最关键的几点内容如下:

         

        • UART的GPIO管脚是否配置正确
        • 客户版上是否使用外部的768K低频晶振。(stack中默认是不使用此外部晶振,可以在程序头文件中使用宏来控制)
        • NCP的Plugin中流控类型选定为software control

        当编译好板子对应的固件(Bootloader以及NCP firmware)的时候,现在需要对板子进行烧录和调试。

         

        • 使用Silicon Labs的WSTK主版作为烧录器,将WSTK的10Pin调试口与客户版的10Pin Mini-Simplicity Connector相连。打开Simplicity Studio,将WSTK主板的“Debug Mode”设置为OUT。
        • 可以通过烧录RAILTest或Nodetest或自己编译的SOC程序验证串口是否正常工作。
        • 将Bootloader先烧录到客户板中,注意:烧录的时候先擦除芯片,保证此时只烧录Bootloader。这样做的好处是芯片在上电启动之后直接进去Bootloader模式,正常情况下在串口中可以看到打印信息,以表明串口的硬件连接没有问题。
        • 将客户板的串口连上UART转USB口模块,并连接上PC电脑(在此以Win7系统为例)。在电脑上打开串口工具,正常情况下,可以看到如下类似信息即表明串口以及Bootloader已经正常工作。

        1.png

        • 继续在客户版中烧录已经编译好的NCP固件。在Win7 PC机上面的Cygwin环境中编译Host程序验证NCP是否正常工作,可以直接使用Z3GatewayHost例程。
        • 输入以下命令,启动Host程序:

        ./build/exe/Z3GatewayHost.exe -n 1 -p com44

         

        如果能看到如下信息,表明NCP程序工作正常。

        2.png