Build an EZSP-SPI host application on a Raspberry Pi

by <a href=""><font color="#000000"><font size="2">Hero Employee</font></font> </a> yuxiao ‎05-25-2017 01:30 PM - edited ‎05-25-2017 01:32 PM

Here are some steps you can follow to build an EZSP-SPI host application on a Raspberry Pi to interact with an EFR32MG1 or EFR32MG12 device (on our dev kit) running a pre-built NCP-SPI image (or an xNCP image built with SPI signal assignment compatible with our dev kit) of the latest EmberZNet stack, which is v5.9.1 at the time of this article. If you have custom hardware or a custom-built NCP image with non-default SPI pins,  make adjustments accordingly.


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, or start with a blank application and configure it appropriately.


3. Under "HAL configuration" tab of your project, choose EFR32-EZSP and Unix host under Platform configuration. Leave the "Api" field blank. Under the "Plugins" tab, select "EZSP SPI" and deselect EZSP UART.


4. Generate the host app, and build it on your Raspberry Pi.


5. Program your EFR32 device with the EZSP-SPI image. For example, you may use a pre-built NCP image for the BRD4153A radio module from:



6. Make hardware connections between the WSTK expansion header, and the Raspberry Pi expansion header:

Refer to this article on GPIOs used for the pre-built EFR32MG NCP images:

Refer to UG151 on the WSTK expansion header.

On the RasPi side:


nRESET:      GPIO23

nWAKE:       GPIO24

SPI_nCS:      SPI0_CE0_N




(Note: these are exactly the same as our SPI host set up for Silicon Labs Thread, so you can reference AN912 table 2).


7. Use these example commands to configure SPI GPIOs, and launch the host app, on your Raspberry Pi (note that there are different from SPI host set up for Silicon Labs Thread).

//Configure GPIO on the pi
sudo echo 8 > /sys/class/gpio/export && sleep 0.5
sudo echo 22 > /sys/class/gpio/export && sleep 0.5
sudo echo 23 > /sys/class/gpio/export && sleep 0.5
sudo echo 24 > /sys/class/gpio/export && sleep 0.5
sudo echo high > /sys/class/gpio/gpio8/direction && sleep 0.5
sudo echo in > /sys/class/gpio/gpio22/direction && sleep 0.5
sudo echo falling > /sys/class/gpio/gpio22/edge && sleep 0.5
sudo echo high > /sys/class/gpio/gpio23/direction && sleep 0.5
sudo echo high > /sys/class/gpio/gpio24/direction && sleep 0.5

//Command to launch host app

by <a href=""><font color="#000000"><font size="2">Star</font></font> </a> jees
on ‎07-27-2017 12:09 AM

Thanks for details step your write.


"4. Generate the host app, and build it on your Raspberry Pi."


I don't understand how to build it on RPi.

Could I find more details step about building on RPi ? or Is it need to specific commands or scripts for build on RPi ?





by <a href=""><font color="#000000"><font size="2">Star</font></font> </a> yuango
on ‎08-08-2017 04:30 AM

I think you can find "Makefile" on your project file after you generate project.

And you can try to use gcc to compile it such like this command "make -f Makefile" .


you also can refer AN728 "4.5 Build the Server",there have more detail about how to build ncp applayer code.