Broadcom ThingWorx Broadcom BCM943364WCD1 C-SDK Setup Manual

Page 1
! ! ! ! ! ! ! ! ! !
!
!
!
!
!
!
Broadcom!BCM943364WCD1!C-SDK! Setup!Guide!
Version!1.0
Page 2
Copyright © 2016 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
Information described herein is furnished for general information only, is subject to change without notice, and should not be construed as a warranty or commitment by PTC. PTC assumes no responsibility or liability for any errors or inaccuracies that may appear in this document.
The software described in this document is provided under written license agreement, contains valuable trade secrets and proprietary information, and is protected by the copyright laws of the United States and other countries. It may not be copied or distributed in any form or medium, disclosed to third parties, or used in any manner not provided for in the software licenses agreement except with written prior approval from PTC.
UNAUTHORIZED USE OF SOFTWARE OR ITS DOCUMENTATION CAN RESULT IN CIVIL DAMAGES AND CRIMINAL PROSECUTION. PTC regards software piracy as the crime it is, and we view offenders accordingly. We do not tolerate the piracy of PTC software products, and we pursue (both civilly and criminally) those who do so using all legal means available, including public and private surveillance resources. As part of these efforts, PTC uses data monitoring and scouring technologies to obtain and transmit data on users of illegal copies of our software. This data collection is not performed on users of legally licensed software from PTC and its authorized distributors. If you are using an illegal copy of our software and do not consent to the collection and transmission of such data (including to the United States), cease using the illegal version, and contact PTC to obtain a legally licensed copy.
Important Copyright, Trademark, Patent, and Licensing Information: See the About Box, or copyright notice, of your PTC software.
UNITED STATES GOVERNMENT RESTRICTED RIGHTS LEGEND
This document and the software described herein are Commercial Computer Documentation and Software, pursuant to FAR
12.212(a)-(b) (OCT’95) or DFARS 227.7202-1(a) and 227.7202-3(a) (JUN’95), and are provided to the US Government under a limited commercial license only. For procurements predating the above clauses, use, duplication, or disclosure by the Government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software Clause at DFARS 252.227-7013 (OCT’88) or Commercial Computer Software-Restricted Rights at FAR 52.227-19(c)(1)-(2) (JUN’87), as applicable. 01012015
PTC Inc., 140 Kendrick Street, Needham, MA 02494 USA!
!
!
!
!
!
! !
Page 3
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 1! !
!
Software!Change!Log!....................................................................................................................................!2!
Introduction!.................................................................................................................................................!2!
About!the!Broadcom!BCM943364WCD1!.................................................................................................!2!
Installation!....................................................................................................................................................!3!
Downloads!and!Prerequisites!...................................................................................................................!3!
Configuration!and!Setup!..............................................................................................................................!5!
Compiling!and!Running!the!Application!...................................................................................................!8!
Binding!Properties!in!ThingWorx!...........................................................................................................!10!
Troubleshooting!.........................................................................................................................................!13!
Known!Limitations!......................................................................................................................................!15!
Compatibility!..............................................................................................................................................!15!
Document!Revision!History!........................................................................................................................!15!
!
Page 4
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 2! !
Software!Change!Log!
!"#$%&'(
)"*"+$"(,+-"(
./+'0"$(
1.0!
4/7/2016!
Initial!Release!
! Introduction!
! The!Edge!MicroServer!is!a!powerful!component!of!the!ThingWorx!architecture.!!The!Edge!MicroServer! allows!for!the!rapid!deployment!of!connections!between!the!ThingWorx!platform!and!an!associated! data!reporting!device,!with!minimal!design!requirements!on!the!part!of!the!user.! ! The!Edge!MicroServer!provides!an!“always-on”!connection!to!the!platform,!and!it!opens!a!local!web! server!that!interacts!with!the!REST!API!available!on!the!platform.! This!document!provides!installation!and!usage!instructions!for!setting!up!the!Edge!MicroServer!via!a! ThingWorx!C-SDK!Implementation!on!a!Broadcom!BCM943364WCD1.! !
About!the!Broadcom!BCM943364WCD1!
!
!
! The!Broadcom!BCM943364WCD1!module!is!mounted!on!a!full-featured!USB-based!evaluation!and! development!board!that!is!fully!compatible!with!the!WICED!Wi-Fi!Software!Development!Kit!(SDK).! Designed!to!be!a!lower!cost!alternative!to!the!popular!BCM43362,!the!onboard!SIP!mo du le!leve rage s! the!BCM43364!2.4!GHz!WLA N !IEEE!80 2.11 b/ g/n !M AC /ba seb an d /rad io.!In!add ition ,!the!m od ule ! integrates!a!power!amplifier!(PA)!that!meet s!t h e!o u tp u t!p o wer!requirements!of!most!handheld!syste ms,! a!low-noise!amplifier!(LNA)!for!best-in-class!receiver!sensitivity,!and!an!internal!transmit/!receive!(iTR)! RF!switch,!further!reducing!the!overall!solution!cost!and!printed!circuit!board!area.!Powered!by!the! STM32F411!32-bit!ARM!microcontroller,!the!board! is!also!provisioned!to!support!the!authentication! chip!utilized!by!Apple’s!HomeKit!offering.! ! The!Thingworx!C-SDK!distribution!may!be!installe d ! on!the!device,!and!this!guide!will!follow!th e ! procedure!for!doing!so.!!This!guide!will!also!follow! a!Reference!Implementation!proc ed u r e!fo r! connecting!the!device!to!a!remote!ThingWorx! server!with!a!simulated!“steam!sensor”!demo.!
Page 5
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 3! !
Installation! !
Setup!of!the!Broadcom!device!with!this!guide!will!require!the!use!of!a!Linux!operating!sys tem !on !eithe r!a! host!or!guest!(virtual!machine)!operating!system,!such!as!Ubuntu.!It!is!possib le !to !c o mpile!the!necessary! code!in!Windows,!but!this!guide!recommends!using!a!Linux!environment.!!!1*"+$"('&-"(-/+-(-/%$(02%3"( 4+$(4#%--"'(5&#(+(6&782-"#(#2''%'0(9%6#&$&5-(:%'3&4$(;(4%-/(+'(<=2'-2(>?@ABCAD(?%#-2+*(7+6/%'"B((! Refer!to!the!Troubleshooting!section!of!this!guide!for!help!with!frequently!asked!questions.!
Downloads!and!Prerequisites! !
1. !
Begin!by!downloading!the!WICED!3.5.x!(latest)!SDK!
from!
https://community.broadcom.com/community/wi ced-wifi/wiced-wifi-documentation.!!Follow!the!
link!at!the!bottom!of!t he !p a ge !fo r!t h e!“ WICED!SDK!
3.5.x!IDE!Installer!and!.7z!Source!Files”,!and!then!
locate!the!post!conta in ing !t he !* .7 z!z ip !file .! ! Refer!to!the!screenshots!for!guidance.! ! E&-"F!!For!a!build!on!Linux,!download!the!*.7z!files!
to!the!Linux!machine.!!If!you!are!compiling!on !
Windows,!you!may!download!the!.exe!executable!
version.! You!will!also!need!a!Broadcom!community!site!
account!in!order!to!access!these!pages.!!This!is!
free!to!create.!!
!
2. !
!
Page 6
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 4! !
3. !
Once!downloaded,!extract!the!compressed!
WICED-SDK.!!Install!p7zip!first!if!you!do!not!
already!have!it:!
sudo apt-get install p7zip-full
unzip <file_name>.7z.zip
7za x <file_name>.7z
!
4. !
!
!
5. !
!
!
Page 7
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 5! !
6. !
Next,!change!directory!to!the!demo!folder!in!your!
extracted!file!as!in:!WICED-SDK-3.5.x/apps/demo!
and!create!a!folder!named!‘thingworx’.!
mkdir thingworx
!
7. !
Download!the!ThingWorx!C-SDK!from!the!PTC!
support!site!(downloads!section)!at!
support.ptc.com.!
!
8. !
Open!the!Thingworx!C-SDK!and!copy!the!“src”!
folder!to!WICED-SDK-3.5.x/apps/demo/thingworx.!
!
!
!
Configuration!and!Setup!
!
1. !
Extract!the!Broadcom!zip!file!packaged!with!
this!Starter!Kit!onto!your!Linux!OS.!
!
2. !
Copy!the!‘thingworx.c’,!‘thingworx.mk’,!and!
‘wifi_config_dct.h’!files!to!the!WICED-SDK-
3.5.x/apps/demo/thingworx!directory,!created!
earlier.!
!
!
Page 8
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 6! !
3. !
Copy!!the!‘twWiced.c’,!‘twWiced.h’,!and!
‘twWicedThread.c’!files!(lo c a te d !i n !
…/src/porting!in!the!Extracted!Starter!Kit!
package)!to!WICED-SDK-
3.5.x/apps/demo/thingworx/src/porting/.!
!
!
!
4. !
Open!and!edit!the!file!
apps/demo/thingworx/src/porting/twOSPort.h@
@
@
@
@
Change!the!following!line:!!!
G%'6*23"(H:IJKILE.M<,N((
to((
G%'6*23"(O-4:%6"3B/P!
!
!
!
!
!
!
!
!
!
!
!
Page 9
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 7! !
!
5. !
Open!and!edit!the!file!apps/demo/thingworx/thingworx.c@
@
Edit!the!following!line!to!include!the!IP!address!of!the!ThingWorx!server!which!the!device!will!connect!to:!!!
G3"5%'"(H:IQJKH(O-R8"I%8I+33#"$$I/"#"P(
(
Edit!the!following!line!to!include!a!valid!AppKey!create d!on !this!serv er:!
G3"5%'"(H:IS11ITNU(O-R8"I+88IV"RI/"#"P!!
!
As!shown!below:!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
Page 10
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 8! !
6. !
Open!and!edit!the!following:!apps/demo/thingworx/wifi_config_dct.h@
!
Add!a!local!WIFI!SSID!as!a!value!to!.MLNEHIS1IKKL,(
Add!the!SSID!passphrase!to!the!value!.MLNEHIS1I1SKK1Q)SKN!
!
!
!
! Compiling!and!Running!the!Application!
!
1. !
Navigate!to!the!root!WICED-SDK-3.5.x!directory.!
2. !
Make!sure!that!the!Broadcom!device!is!connected!via!USB.!!E&-"F(If!performing!this!in!a!Linux!virtual!
machine!environment,!you’ll!need!to!set!up!the!VM!so!that!the!USB!device!is!connected!to!the!guest!virtual!
machine!instead!of!the!host!computer.!!!!
!
3. !
Execute!the!following!command!from!the!WICED-SDK-3.5.x!root!directory:!
sudo ./make demo.thingworx-BCM943364WCD1-FreeRTOS-LwIP download run
Confirm!that!you!see!the!message!above!when!the!build!is!complete.!The!build!may!take!a!few!minutes!to!
finish.!
Page 11
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 9! !
4. !
J8-%&'+*F!!Connect!to!the!device!via!serial!to!view!its!console!log!output.!This!is!especially!useful!for!
debugging!and!troubleshooting!purposes.!!This!can!be!done!from!either!Linux!or!Windows.! From!a!Linux!machine,!you!may!use!the!“screen”!command!when!the!device!is!connected!and!recognized!
via!serial!USB.!This!guide!will!cover!the!procedure!for!viewing!the!serial!output!via!Windows,!and!not!Linux.! ! From!Windows,!and!on!the!host!operating!system,!use!a!client!such!as!PuTTY.!!The!device!will!first!need!to!
be!connected!to!the!host!operating!system!and!the!virtual!machine!may!need!to!be!shut!down.! The!drivers!for!the!WICED!device!will!need!to!be!installed!on!the!Windows!machine.!!From!the!links!at!
https://community.broadcom.com/community/wiced-wifi/wiced-wifi-documentation,!download!the!
Windows!.exe!executable!and!install!the!IDE!program!when!finished.!Drivers!for!the!device!will!be!installed!
along!with!the!IDE.! !
At!this!point,!the!presence!of!the!WICED!device!should!be!recognized!as!connected!to!a!COM!port!in!
Windows.!!Re-connect!the!device!if!you!do!not!see!it,!and,!if!necessary,!restart!your!computer.!!
!
! ! ! ! ! ! ! ! ! ! ! !
!
Page 12
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 10! !
5. !
In!PuTTY!or!another!similar!program!such!as!HyperTerminal,!connect!to!the!device!at!the!COM!port!shown!
in!the!Device!Manag e r,!an d !c o n ne c t!via !S e rial!a t !ba u d !ra te !1 1 52 0 0 .!
! The!console!output!from!the!device!should!immediately!be!visible.!!Confirm!that!a!log!similar!to!the! following!is!shown.!
!
! Binding!Properties!in!ThingWorx! !
1. !
Navigate!to!your!ThingWorx!remote!server!
(same!server!configured!on!the!Bro ad co m !
device)!from!any!computer.!
!
Page 13
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 11! !
2. i!
Click!on!“Monitoring”!in!the!top-right!corner,!
and!then!select!“Remote!Things”.!!Next,!click!
on!“Unbound!Things”,!and!the!Broadcom!
device!should!be!visible!as!a!connected!
unbound!thing.!
!
3. !
To!connect!this!Unbound!Thing!to!a!Thing!and!begin!binding!properties,!follow!the!standard!procedure!for!
binding!a!Remote!Thing.!!! Create!a!new!Thing!in!Thingworx!Composer!with!the!same!name!as!the!remote!Unbound!Thing.! ! Ensure!that!this!Thing’s!Thing!Template!is!the!RemoteThing!Template.! !
!
!
4. !
Next,!edit!the!Thing’s!properties,!and!click!on!“Manage!Bindings”,!and!then!click!the!“Remote”!tab!in!the!
new!window!to!view!the!Thing’s!available!properties.!!In!this!guide,!the!properties!pushed!from!the!device!
Page 14
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 12! !
are!the!standard!“SteamSensor”!example!properties,!compiled!and!running!as!a!simulator!on!the!device.!!
They!include!Temperature!and!Pressure.!
Click!“Add!All!Above!Properties”!to!add!these!properties!to!the!Thing,!and!then!click!“Done”.!
!
!
!
5. !
After!saving!and!refreshing,!you!should!see!properties!updating!on!the!Thing!from!the!Properties!page.!
For!additional!help,!refer!to!the!Troubleshooting!section!below.!
!
!
Page 15
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 13! !
!
6. !
To!stop!the!device!from!running!the!simulator,!open!PuTTY!serial!connection,!and!press!“Q”!to!terminate!
the!device’s!program.! If!you!wish!to!restart,!t h e!p h y s ica l!“ RE S E T ” !b u tto n!on!the!device!mu st !b e !p re ss ed!once.!
!
!
!
Troubleshooting!
Problem
Solution(s)
1.
Unable to extract WICED zip; problems with
extracted file architecture
1. Make sure you have pzip installed on the linux machine, and make sure
you are using the proper extraction method. Type
sudo apt-get install p7zip-full
unzip <file_name>.7z.zip
7za x <file_name>.7z
2. Try extracting the files on a different machine first, and copy the
contents to the Linux machine.
3. Contact the Broadcom Community for further assistance.
2.
Problems with the compilation of the Broadcom
C-SDK
1. Double-check all steps to verify that the file structure and hierarchy is
exactly correct for all files, especially the edited files. Restart from
scratch if necessary.
Page 16
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 14! !
2. Verify that the edited files (SSID, Appkey, IP address) are exactly
correct with no syntax errors, such as a missing quotation mark. The
Appkey must be exactly correct, the server hostname should be correct
(for IP addresses, type the IP address without “http”).
3. Try to use a different version of either the WICED SDK or ThingWorx C-
SDK.
3.
The device is not visible via USB / Serial in
either a guest or host operating system
1. Follow directions from your virtual machine provider to ensure that the
device is connected via serial in “pass-through” from the host computer.
2. For problems with the host computer, make sure you have the WICED
drivers installed before connecting the device to your computer. Use
Windows and download/install the WICED 3.5.x .exe installer, which
includes serial drivers, from
https://community.broadcom.com/community/wiced-wifi/wiced-wifi-
documentation
4.
Cannot connect to the device via PuTTY or
another terminal program, or no console output
1. Verify that the device is properly connected to the computer or virtual
machine you are attempting to view the console from.
2. Verify that the proper USB serial drivers are installed.
3. Verify that the baud rate of the serial connection is 115200.
4. Verify that the SDK has compiled correctly on the device. Disconnect it
and reconnect it before trying again.
5. Try an alternative terminal program, such as PuTTY or HyperTerminal.
5.
Cannot bind a Thing to the Broadcom Device in
Thingworx.
1. Ensure that the Thing name you are creating is exactly the same as the
device’s ID in the ThingWorx Unbound Things page. The Thing name
can alternatively be customized if it is set to be an identifier in the
source code.
2. Ensure the Thing you are creating is of the RemoteThing Template.
3. Refer to ThingWorx support for further assistance.
6.
Device will not connect to ThingWorx server / is
not visible under “Unbound Things”.
1. Check the “All” tab instead of the unbound things tab to confirm that the
device is not already bound to a Remote Thing.
2. Double-check the connection settings in “thingworx.c”. Re-compile if
changes were necessary.
3. Confirm that the wifi network is active and that the connection
parameters in “wifi_config_dct.h” are exactly correct. Switch to testing
on an unsecured wifi network if necessary. Ensure you have the latest
WICED SDK installed. Contact Broadcom if the device will not connect
to any WiFi network.
4. Verify that no firewall or network configuration settings are preventing
the device from communicating with a remote ThingWorx server. This is
a common problem.
5. Test on a locally-hosted ThingWorx platform to rule out internet
connectivity issues.
!
Page 17
Broadcom BCM943364WCD1 C-SDK Setup Guide (v 1.0)!
! 15! !
Known!Limitations!
! This!device!has!the!following!known!limitation:!
1. The!Broadcom!device!does!not!currently!support!connection!via!HTTPS!(SSL!/!TLS).!
! !
Compatibility!
! This!guide!has!been!tested!for!compatibility!with!the!DEVICE!and!the!following!ThingWorx!platform!and! operating!system:!
ThingWorx!Platform!Version!
ThingWorx!7.0.0!
OS!
Windows!7,!Service!Pack!1!
OS!(Virtual!Machine)!
Ubuntu!14.04!
WICED!SDK!
v!3.5.2!
! ! !
Document!Revision!History!
!
)"?%$%&'(,+-"(
!"#$%&'(
,"$6#%8-%&'(&5(./+'0"(
April!7,!2016!
1.0!
Initial!Release!
!
Loading...