Building the Demo Application
The Wireless Connection Manager for WICED is bundled with the WICED SDK (6.0 or later). Go to the Cypress website to download the WICED SDK, and install it on your target platform. You'll find the documentation for the WCM in the SDK at <SDK_DIR>/43xxx_Wi-Fi/doc/WICED-ZipKey-Onboarding.pdf
The WCM library includes the demo app in <SDK_DIR>/43xxx_Wi-Fi/apps/demo/zipkey_example_app/
folder.
The demo app directory contents:
- zipkey_example_app.c - the app source file;
- zipkey_example_app.mk - the app build file;
- zipkey_app_dct.h - header file with a basic DCT structure;
- zipkey_app_dct.c - example DCT source file;
- dct_generate.sh - script for generating a DCT.
The WCM uses the Device Configuration Table (DCT) for storing network profiles and other internal volatile data. The basic DCT structure APP_DCT_T is defined in zipkey_app_dct.h. zipkey_app_dct.c contains example DCT data which represents ZipKey network configuration. A user could generate their ZipKey network configuration content in DCT format by using dct_generate.sh:
./dct_generate.sh account_id device_id secret > zipkey_app_dct.c
The WCM requires some patches which fix bugs and provide improvements in the Wi-FI stack. The following command will apply the patches that the WCM requires.
for i in libraries/daemons/WCM/patches/*; do patch -p0 < $i; done
To build and download the demo application firmware, run the following command using your board name:
./make demo.zipkey_example_app-<BOARD NAME> download run
Running the Demo Application
The demo app (in zipkey_example_app.c) configures and starts the WCM. The WICED board initial configuration is done in wiced_core_init() function. Next, the root certificates that the WCM will use are set up, by calling wiced_tls_init_root_ca_certificates(), passing in the two root certificates that the WCM needs. wcm.h contains WCM_PEM_CERT macro which defines the two PEM-formatted certificates: PEM_CERT_AMAZON is used to validate the Cirrent cloud connection, and PEM_CERT_RADIUS is used for connecting to ZipKey EAP networks. A user may add other certificates if required.
After this initialization work, the WCM is started by calling wcm_start() passing in the WCM configuration. The WCM will take care of the Wi-Fi stack initialization, so do not call any of the WICED Wi-Fi initialization functions (such as wiced_init(), wiced_wlan_connectivity_init(), wiced_network_init() etc). The first time that it is run, the WCM performs some one-time setup steps (e.g. generating the public/private key pair to protect network credentials), which could take up to a minute, depending on the platform.
When the WCM starts, a WCM-START log event appears on the serial console after the WCM successfully initializes. The WCM will then try to find and connect to a nearby ZipKey network, and will also start SoftAP. The LED_INDEX_1 LED will also show you the status of the WCM. The LED will blink three times with a one-second delay to indicate that the WCM is ready for onboarding through the mobile App.
PLATFORM_BUTTON_1 can be used to manually enable onboarding mode by holding the button for at least 3 seconds. If you hold it more than 10 seconds, then the WCM will perform a factory reset.
Comments
0 comments
Please sign in to leave a comment.