Reply
Highlighted
Posts: 6
Registered: ‎06-04-2015

EM35X Dev Kit - Primer for NCP to Host communication setup

Here is a summary of the steps I followed to get a PC HOST RS-232 communicating with a Em357 with USER-BUILT NCP software with the EM35x Dev kit. The Em357 modules do not come with any software. The following guides one through installing the development tools, building the NCP software for the module and the host, and the required hardware setup. Hope this helps...

 

1) Don't install S/W from cd's. Out of date, does not work.
Create a support account with SiLabs and create a case to request access to
the s/w downloads. Once granted, download the zigbee stack, Ember Desktop and
IAR embedded workbench.


2) On the Windows PC, install EmberZNet-Z5.4.2.0-b993.exe.
This is the Zigbee stack and example apps.

3) On the Windows PC, install Ember_Desktop_Installer_3.3b1785.exe

4) In Ember Desktop, set location of zigbee stack (from #2)
via File->preferences->network Applications. Click Add,
and browse to Folder the stack was installed at.

5) Create the NCP template app for the EM357

In Ember Desktop, to create a template app,
File->New->Application Framework Configuration
This will have a list of the available templates,
Including the extensible NCP This will create a '.isc' file.

5a) In the 'plugins' tab when viewing the .isc file,

Select

Core->NCP-UART

and change the
'Flow Control Type' from 'Software' (XON-XOFF) to 'hardware' (CTS/RTS)
Failure to do so will set the baud to 57.6 xon/xoff. 'Hardware' is 115K8N1/RTS/CTS. Its funny how all the doc says h/w flow control is

recommended but the wizard defaults to s/w flow Robot Happy.

5b) Click Generate to produce the IAR
files. Note that the IAR workspace and project files
in the zigbee stack folder are not complete You must follow this wizard.

6) Install EWARM-7301.exe - IAR workbench. License key fun.

7) In IAR, open the workspace that was created in #5. F7 to build. This produces a .s37 for the Em357

 

8) Back in EmberDesktop, right click on the discovered node and select 'upload application' Browse the the s37. See note below about the bootloader.


Notes:
*The code has to be flashed via Ember Desktop before debugging.
*The bootloader must be programmed at least once. The
Ember Desktop loader has a flash bootloader option. The bootloader
is in the zigbee stack distribution,
C:\EmberZNet5.4.2-GA\tool\bootloader-em357\serial-uart-bootloader\serial-uart-bootloader.s37

*If you do not need to customize/debug the NCP, the stock NCP image is
C:\EmberZNet5.4.2-GA\em35x-ezsp-images\EM357\ncp-uart-rts-cts-use-with-serial-uart-btl-5.4.2.s37
Instructions for building a custom ncp is outlined above. I personally did not try this image.

9) Jumpers on the zigbee development boards need tweaking:
9a) Remove J27 PB1 and PB2 - these put the serial i/o on the jtag
9b) Place J22,25,24,26 across Em35xx pin and RS-232.

The default jumpers seem to be set up for serial emulation from jtag.

10) Linux NCP HOST Example App
---------------------------
This is a bit of a pain. The app needs to be generated in EmberDesktop(Windows)
and built in Linux.

10a) In Ember Desktop, to create a template app,
File->New->Application Framework Configuration
-> ZCL Application Framework V2
--> Ember Znet GA Em35X EZSP
---> Start with template
----> xNcpLedHost
10b) Copy the stack with this template app over to a Linux PC.
This HOST template uses sources from the stack too.

Run make.
I built on ubuntu. Beyond the basic make utilities, the default build required
sudo apt-get install libreadline6-dev
sudo apt-get install libncurses5-dev

 

10c) Connect a standard serial cable from the PC to the dev board.


10d) Finally, run the ncpHost (or whatever you named it) with the options
./ncpHost -b 115200 -f r -s 1 -p ttyS0 -r r
Yields:
ncpHost>
>?             #gives help
>custom set-led 0    #turns on led on Em357 module (not dev board)
>custom set-led 1    #turns off led

The additional option '-t 15' produces debug output.

Posts: 201
Registered: ‎02-05-2014

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

Thanks, Ed.  Nice writeup here. 

 

Note that over the next few months, we're migrating the Ember Desktop functionality into Simplicity Studio (http://www.silabs.com/products/mcu/Pages/simplicity-studio.aspx), which supports Ubuntu Linux and Mac OSX, so that should make your Linux host builds a little cleaner as you won't have to cross-compile or move the generated Makefile/gcc content over to the embedded Linux target.

 

Also note that regarding the trace flags for debugging the host app process, there are 5 bits worth of trace flags, so you can actually use "-t 31" to get the full set of diagnostics out of the host app, as per app/ezsp-uart-host/ash-host.h:

 

// Bits in traceFlags to enable various host trace outputs
#define TRACE_FRAMES_BASIC        1   /*!< frames sent and received */
#define TRACE_FRAMES_VERBOSE      2   /*!< basic frames + internal variables */
#define TRACE_EVENTS              4   /*!< events */
#define TRACE_EZSP                8   /*!< EZSP commands, responses and callbacks */
#define TRACE_EZSP_VERBOSE        16  /*!< additional EZSP information */

 

Also note that all options you specified except the serial port are defaults, so you can do the following as a shortcut to get the same behavior:

./ncpHost -p 0

 

Good point about the flow control default in the NCP UART plugin.  That's definitely worth changing.

--------
The views represented in this post are the independent views of the author and don't necessarily represent the official views of Silicon Labs.
Posts: 3
Registered: ‎09-09-2015

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

 

I followed the steps mentioned in "EM35X Dev Kit - Primer for NCP to Host communication setup".

 

a. I connected my windows laptop to the J5 connector of the Breakout Board in the Dev kit which has EM357x module plugged in. 

 

b. I followed steps [1, 2, and 3] as mentioned in the primer. My Ember desktop is Version: 3.3.1915 (Beta) Date: 20150717.

 

c. I followed steps 4 and 5.

 

d. In 5a, I could not find "Core" under plugins tab.

 

Can you please let me know how to specify the NCP-UART option?

 

Posts: 201
Registered: ‎02-05-2014

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

Lalitha - Did you make sure to choose "NCP Framework" as the framework type when prompted for which framework to use when creating a new application?  That's the one you'd use to create new NCP firmware (if you want to recompile from source instead of using pre-built binaries).  If you chose "ZCL Application Framework" with "EM35x-EZSP" as your platform, you'll be building the host application side of things.

 

Note that it's not necessary to rebuild the NCP firmware from source.  Most people do just fine with the provided binary files in em35x-ezsp-images folder, but if you want to customize the GPIO or add custom EZSP commands to the NCP, then building from source allows for that.

--------
The views represented in this post are the independent views of the author and don't necessarily represent the official views of Silicon Labs.
Posts: 3
Registered: ‎09-09-2015

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

Thanks a lot for your immediate response.

I am working on building my own application using the Ember Znet stack for the Host + NCP model.

I have queries related to building the application and also related to the hardware setup.Can you please clarify them?

Hardware setup:

1. I connected my windows 7 laptop to the Breakout board using the USB serial cable.

2. The device could not be accessed from my laptop as I did not have the driver. Should I be downloaded the device driver for it?

3. Can I use Ember Desktop for uploading the application? If so is it necessary for the Breakout Board in the dev kit to be connected to the Debug Adapters. Should the

debug adapters be in turn connect to the PoE switch and should I connect my laptop also to the same switch like the way they have shown the demo in the App dev guide? If this is true I am not clear how accessing the Breakout board with serial USB cable would work?

4. Overall, I need to have the setup described in (1) above and get the setup working. Can you please let me know the set that I should do for the same?

w.r.t building the application, I have the following doubts.

1. In my Ember Desktop I chose "File" tab and selected "New" -> "Application Framework Configuration" -> "Manage SDKs" -> "Network Application" and I selected "EmberZNet 5.4 GA EM35XEZSP".

2. If I chose "Plugins" tab I do not see Core -> NCP -> UART. Instead I am seeing "Utility" -> "EZSP" and "NCP configuration" enabled in that.

3. Please let me know if this is fine or should I enable anything else under plugin. I do not see anything related to enabling "UART".

4. Can you please let me know whether I have to do any changes while building the application for redirecting the debug messages to the host?


5. Is there any specific change I have to make in the "HAL configuration" tab specific to my setup?

Thanks,
Lalitha
 

Posts: 6
Registered: ‎06-04-2015

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

Lalitha,

I suggest that you back up some. Get your system up and going with the pre-built NCP image first. Start with the Development Kit getting started guide to hook up the development board and Debug Adapter(ISA3). This can be done over Ethernet or USB. Ethernet allows many Debug Adapters/boards. USB allows one. I used Ethernet.  Make sure that you can detect the Debug Adapter and attach to the CPU on the Development board. Right click on the Detected ISA3 and choose connect. Assume success, right click and choose upload s/w. Set up the upload to install the NCP UART stock image and the serial bootloader.

Once you have success getting the Development board running the NCP, move on to the serial client.

 

For the connection  PC <-> NCP, use the DB9 connector on the Development board to connect to the PC. The jumpers on the development board need adjustment to use the DB9 connector.  See jumpers J22-27 in the schematics. You want to direct the Em35x UART to the DB9 connector.

 

Once the hardware connection to the PC is set up, use a terminal program (hyperterminal or the like) to connect to the Serial port on the PC. use 115200/8n1 with hardware flow control. Hit <cr> a couple times and you should see the NCP menu prompt.

Posts: 3
Registered: ‎09-09-2015

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

Thanks a lot for clarifying my doubts.

 

I have some queries. Can you please clarify them.

 

1. In the Host NCP model, I read that the host applications run on the HOST and only the ZigBee stack along with EZSP, ASH, SERIAL DRIVER, UART are on the NCP.

 

2. Suppose I want to create a ZigBee Gateway for HA, does it mean that ZigBee Gateway would be the host application?

 

Thanks,

Lalitha.

Posts: 201
Registered: ‎02-05-2014

Re: EM35X Dev Kit - Primer for NCP to Host communication setup

Yes, Lalitha, your understanding (1 and 2) is correct.

--------
The views represented in this post are the independent views of the author and don't necessarily represent the official views of Silicon Labs.