Question

How to build a custom Xon/Xoff NCP firmware with 5.10.1 EmberZnet stack?

 

Answer

 

  • Prerequisite:
    • Silicon Labs “Simplicity Studio” 4.1.3 or later and has been installed
    • Gecko SDK 1.1 and Ember ZNet Pro 5.10.1 stack have been installed
  • File -> New -> Project. Select “Silicon Labs AppBuilder Project” and click “Next”

    1.png

  • Select “Customizable network coprocessor (NCP) applications” and click “Next”

    2.png

  • Select “EmberZNet 5.10.1.0 GA Network Coprocessor(NCP) Application Framework” and click “Next”

    3.png

  • Select “xNCP LED” sample application and click “Next”
  • 4.png
  • Use the default project name or “xncp-led” or rename the project and then click “Next”

    5.png

  • In “Boards” input box, selects “nothing”, in “Part” input box, selects as “EFR32MG1B232F256M32” then click “Finish”

    6.png

  • The project will now open up in the Simplicity IDE. Select the “Plugins” tab page. Type “ncp” in the input box and select the “NCP - UART” plugin. At right side, pick the Flow Control Type as “Software”

7.png

  • Select the “Plugins” tab page. Type “hal” in the input box and select the “HAL Configuration” plugin. At right side, pick the UART0 Flow Control mode as “HAL_USART_FLOW_CONTROL_SW”.

8.png

  • Select the “Other” tab page. In “Additional.c and .h files, include paths, libraries”, select “Add directory” button, input the following two paths:

C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\hardware\kit\common\bsp

C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\hardware\kit\EFR32MG1_BRD4151A\config

 

And select “Add file”, input the following file:

C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\hardware\kit\EFR32MG1_BRD4151A\config\ brd4151a.h

 

  • Modify the wstk-common.h to remove the repeated HalBoardLedPins define for LED.

9.png

#if 0
enum HalBoardLedPins {
  BOARDLED0 = 0,
  BOARDLED1 = 1,
  BOARDLED2 = BOARDLED0,
  BOARDLED3 = BOARDLED1,
  BOARD_ACTIVITY_LED  = BOARDLED0,
  BOARD_HEARTBEAT_LED = BOARDLED1
};
#endif
  • Save the project and click the top right “Generate” button to generate the NCP source codes in the project folder. Wait till code generation completes and then click “OK” to close the “Generation successful” dialog.
  • In current project directory, e.g. “c:\[User]”\SimplicityStudio\v4_workspace\xnap-ista90\.Replace the board header file ncp-board.h with following custom header file for IST-A90:
/** @file hal/micro/cortexm3/efm32/board/brd4151a.h
 * BRD4151A-EFR32MG 2.4 GHz 19.5dBm (SLWSTK6000A)
 * See @ref board for detailed documentation.
 *
 * <!-- Copyright 2016 Silicon Laboratories, Inc.                        *80*-->
 */

/** @addtogroup board
 *  @brief Functions and definitions specific to the breakout board.
 *
 *@{
 */

#ifndef __BOARD_H__
#define __BOARD_H__

#include "bspconfig.h"
//#include "mx25flash_config.h"

// This will only work on EmberZNet Stack 5.8 or later.
// Add this definition if your board lacks an external LFXO
// In prior versions of the EmberZNet Stack, this will have to be added
// as an additional macro on the Other tab of the ISC file.
#define RTCDRV_USE_LFRCO


// Comment out the xNCP build you are not using
// Leave the one you are using defined
#define UART_XNCP_BUILD
//#define SPI_XNCP_BUILD

// Define board features

// #define DISABLE_PTI

// #define DISABLE_DCDC



#ifdef UART_XNCP_BUILD
/**
 * Start - UART xNCP Definition Block
 * USART0 used for UART xNCP
 */

// Enable COM port to use retarget serial configuration
//#define COM_RETARGET_SERIAL
// Enable HW flow control
#define COM_USART0_HW_FC


// Refer to the EFR32MG1 Mighty Gecko Data Sheet Page 139
// http://www.silabs.com/Support%20Documents/TechnicalDocs/efr32mg1-datasheet.pdf
// GPIO   Location   Signal Name
//  PA0  - Loc 0  - US0_TX
//  PA1  - Loc 0  - US0_RX
//  PA2  - Loc 0  - US0_CTS      - NA
//  PA3  - Loc 0  - US0_RTS      - NA

// Define USART0 TX/RX Location
#define USART0_TX_LOCATION _USART_ROUTELOC0_TXLOC_LOC0
#define USART0_RX_LOCATION _USART_ROUTELOC0_RXLOC_LOC0

// Define USART0 flow control pins - CTS
//#define USART0_CTS_PORT gpioPortA
//#define USART0_CTS_PIN 2

// Define USART0 flow control pins - RTS
//#define USART0_RTS_PORT gpioPortA
//#define USART0_RTS_PIN 3

/**
 * End - UART xNCP Definition Block
 *
 */
#endif

#ifdef SPI_XNCP_BUILD
/**
 * Start - SPI xNCP Definition Block
 * USART1 used for SPI xNCP
 */

// Refer to the EFR32MG1 Mighty Gecko Data Sheet Pages 139-140
// http://www.silabs.com/Support%20Documents/TechnicalDocs/efr32mg1-datasheet.pdf
// GPIO   Location   Signal Name
//  PC6  - Loc 11 - US1_TX
//  PC7  - Loc 11 - US1_RX
//  PC8  - Loc 11 - US1_CLK
//  PC9  - Loc 11 - US1_CS
#define SPI_NCP_USART1                                                    \
{                                                                         \
  USART1,                       /* USART port                       */    \
  _USART_ROUTELOC0_TXLOC_LOC11, /* USART Tx pin location number     */    \
  _USART_ROUTELOC0_RXLOC_LOC11, /* USART Rx pin location number     */    \
  _USART_ROUTELOC0_CLKLOC_LOC11,/* USART Clk pin location number    */    \
  _USART_ROUTELOC0_CSLOC_LOC11, /* USART Cs pin location number     */    \
  0,                            /* Bitrate                          */    \
  8,                            /* Frame length                     */    \
  0xFF,                         /* Dummy tx value for rx only funcs */    \
  spidrvSlave,                  /* SPI mode                         */    \
  spidrvBitOrderMsbFirst,       /* Bit order on bus                 */    \
  spidrvClockMode0,             /* SPI clock/phase mode             */    \
  spidrvCsControlAuto,          /* CS controlled by the driver      */    \
  spidrvSlaveStartImmediate     /* Slave start transfers immediately*/    \
}

// Default nHOST_INT to PA4 -> EXP7 on WSTK6001
#define NHOST_INT_PORT gpioPortA
#define NHOST_INT_PIN 4

// Default CS/nSSEL to PC9 -> EXP10 on WSTK6001
#define NSSEL_PORT gpioPortC
#define NSSEL_PIN 9

// Default nWAKE_PORT to PB11 -> EXP9 on WSTK6001
#define NWAKE_PORT gpioPortB
#define NWAKE_PIN 11

// Default to using nWAKE for the bootloader recovery GPIO.
#define BUTTON_RECOVERY_PORT NWAKE_PORT
#define BUTTON_RECOVERY_PIN  NWAKE_PIN

/**
 * End - SPI xNCP Definition Block
 *
 */
#endif

#define halInternalConfigPa() do {                                 \
  RADIO_PAInit_t paInit = RADIO_PA_2P4_INIT;                       \
  RADIO_PA_Init(&paInit);                                          \
} while(0)

// Include common definitions
#include "board/wstk-common.h"

#endif //__BOARD_H__
/** @} END Board Specific Functions */

/** @} END addtogroup */
  • In Simplicity Studio top menu panel, pick from “Project” -> “Build Project”, wait till the compilation success. The xncp-led firmware is located at “C:\Users\[user]\SimplicityStudio\v4_workspace\xncp-ista90\IAR ARM - Default\”
  • Click the “Flash Programmer” button on the Simplicity Studio’s top command toolbar to launch the flash programmer utility. Select the firmware file “xncp-led_ista90.s37” and then flash the firmware image.

  • ZigBee and Thread
  • Thread SDK
  • Knowledge Base Articles