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:
(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 they 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