Wall's Corners Wall's Corners Author
Title: Introducing the Adafruit WICED Feather WiFi
Author: Wall's Corners
Rating 5 of 5 Des:
Overview Feather  is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed F...

Overview

adafruit_products_3056_iso_demo_ORIG.jpg

Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores. This is the Adafruit WICED Feather – it’s our most powerful Feather yet! We have other boards in the Feather family, check’em out here.

Say “Hi!” the WICED Feather! Perfect for your next Internet connected project, with a processor and WiFi core that can take anything you throw at it!

adafruit_products_3056_top_demo_ORIG.jpg

The WICED Feather is based on Broadcom’s WICED (Wireless Internet Connectivity for Embedded Devices) platform, and is paired up with a powerful STM32F205 ARM Cortex M3 processor running at 120MHz, with support for TLS 1.2 to access sites and web services safely and securely.

We spent a lot of time adding support for this processor and WiFi chipset to the IDE you know and love. doesn’t rely on any online or third party tools to build, flash or run your code.  You write your code in the Arduino IDE using the same standard libraries you’ve always used (Wire, SPI, etc.), compile locally, and the device is flashed directly from the IDE over USB.

Since the WICED Feather is based on the standard Adafruit Feather layout, you also have instant access to a variety of Feather Wings, as well as all the usual standard breakouts available from Adafruit or other vendors.

After more than a year of full time effort in the making, we think it’s the best and most flexible WiFi development board out there, and the easiest way to get your TCP/IP-based project off the ground without sacrificing flexibility or security. We even cooked in some built-in libraries in the WiFi core, wuch as TCP client and Server, HTTP client and server, and MQTT client (with easy Adafruit IO interfacing).

adafruit_products_3056_quarter_ORIG.jpg

The WICED Feather has the following key features:

  • Measures 2.0″ x 0.9″ x 0.28″ (51mm x 23mm x 8mm) without headers soldered in
  • Light as a (large?) feather – 5.7 grams
  • STM32F205RG 120MHz ARM Cortex M3 MCU
  • BCM43362 802.11b/G/N radio
  • 128KB SRAM and 1024KB flash memory (total)
  • 16KB SRAM and 128KB flash available for user code
  • 16MBit (2MB) SPI flash for additional data storage
  • Built in Real Time Clock (RTC) with optional external battery supply
  • Hardware SPI and (including clock-stretching)
  • 12 standard GPIO pins, with additional GPIOs available via SPI, UART and I2C pins
  • 7 standard PWM outputs, with additional outputs available via SPI, UART and I2C pins
  • Up to 8 12-bit ADC inputs
  • Two 12-bit DAC outputs (Pins A4 and SCK/A5)
  • Up to 3 UARTs (including one with full HW flow control)
  • TLS 1.2 support to access secure HTTPS and TCP servers
  • On board single-cell LIPO charging and battery monitoring
  • Fast and easy firmware updates to keep your module up to date
  • Based on the excellent community-supportedMaple project
adafruit_products_3056_kit_revised_ORIG.jpg

Comes fully assembled and tested, with a USB bootloader that lets you quickly use it with the Arduino IDE. We also toss in some headers so you can solder it in and plug into a solderless breadboard. Lipoly battery and MicroUSB cable not included (but we do have lots of options in the shop if you’d like!)

Our learn guide will show you everything you need to know to get your projects online, and connected to the outside world!

Board Layout

The WICED Feather uses the same standard pinout as the rest of the Feather family, allowing you to use the same Feather Wings across all your compatible devices.

It has the standard Feather on board LIPO battery charger (simply connect a LIPO battery and USB power at the same time), and 3.3V voltage regulation from either USB or VBAT (the LIPO cell) with automatic switching between power supplies.

Pin Multiplexing

The pins on the WICED Feather can be configured for several different purposes, with the main config options shown in the illustration below:

adafruit_products_WICEDPinout.jpg

Power Config

The WICED Feather can be run from either 5V USB power or a standard ~3.7V LIPO cell, and includes the ability to charge LIPO cells from USB power when both are connected at the same time.

adafruit_products_Power.jpg

The following pins are included as part of the WICED Feather’s power system:

  • 3V: The output of the on-board 3.3V 600mA voltage regulator
  • RTC: The input for the realt-time clock (RTC) on the STM32F205 (optional)
  • GND: The common/GND pin which should be connect to GND on any other boards you use
  • BAT: The input for the 3.7V LIPO cell
  • EN: The ‘EN’ switch for the 3.3V voltage regulator.  Set this to GND to disable power.
  • VUSB: The 5V USB power input (USB VBUS)
  • A1: This pin is optionally connected to a 10K+10K voltage divider that allows you to safely measure the output of the LIPO cell using the internal ADC (analog to digital converter).

LIPO Cell Power Monitoring (A1)

The LIPO battery level can optionally be monitored via a voltage divider configured on ADC pin A1.

To enable the 10K + 10K voltage divider (which will divide the LIPO voltage levels in half so that the ADC pin can safely read them), you need to solder shut the BATADC solder jumper on the bottom of the PCB:

adafruit_products_BATADC.jpg

This will allow you to read the voltage level of the LIPO cell using pin A1 where each value on the ADC is equal to 0.80566mVsince:

  • 3300mV / 4096 (12-bit ADC) = 0.80566406mV per LSB

You need to double the calculated voltage to compensate for the 10K+10K voltage divider, so in reality every value from the ADC is equal to 1.61133mV on the LIPO cell, although it appears on the ADC at half that level.

16 Mbit (2MByte) SPI Flash

The WICED Feather contains an optional (default = off) 16MBit SPI flash chip that is controlled by FeatherLib.

In order to keep the maximum number of pins available to customers, the SPI flash is currently disabled, but in a future version of the firmware the SPI flash will be enabled with USB Mass Storage support so that you can access the contents on the flash memory from your PC to easily exchange data and files.

The 16MBit SPI Flash chip is not currently enabled in FeatherLib, but will be enabled along with USB Mass Storage support in a future firmware release.
The SPI3 bus used for SPI flash is controlled by FeatherLib, and the four pins shown below should be avoided in your own sketches when SPI Flash is enabled in a future FeatherLib release.
adafruit_products_SPIFlash.jpg

SPI flash is disabled by default. It can be enabled by soldering the SPIFCS (A4) solder jumper on the back of the PCB closed before powering the board up, which will connect the CS/SSEL of the SPI flash to pin A4:

adafruit_products_SPIFlashSJ.jpg

Assembly

We ship Feathers fully tested but without headers attached – this gives you the most flexibility on choosing how to use and configure your Feather

Header Options!

Before you go gung-ho on soldering, there’s a few options to consider!

  • feather_3010-05.jpg
  • feather_3010-05.jpg
  • feather_3010-01.jpg

The first option is soldering in plain male headers, this lets you plug in the Feather into a solderless breadboard

  • feather_2886-01.jpg
  • feather_2886-01.jpg
  • feather_2886-02.jpg

Another option is to go with socket female headers. This won’t let you plug the Feather into a breadboard but it will let you attach featherwings very easily

  • feather_2940-01.jpg
  • feather_2940-01.jpg
  • feather_2940-04.jpg

We also  have ‘slim’ versions of the female headers, that are a little shorter and give a more compact shape

  • feather_2830-01.jpg
  • feather_2830-01.jpg
  • feather_2830-00.jpg

Finally, there’s the “Stacking Header” option. This one is sort of the best-of-both-worlds. You get the ability to plug into a solderless breadboard and plug a featherwing on top. But its a little bulky

Soldering in Plain Headers

  • feather_headers.jpg

Prepare the header strip:

Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard – long pins down

  • feather_solder1.jpg
  • feather_solder1.jpg
  • feather_solder2.jpg
  • feather_solder3.jpg

Add the breakout board:

Place the breakout board over the pins so that the short pins poke through the breakout pads

And Solder!

Be sure to solder all pins for reliable electrical contact.

(For tips on soldering, be sure to check out our Guide to Excellent Soldering).

  • feather_solder4.jpg
  • feather_solder4.jpg
  • feather_solder5.jpg
  • feather_solder6.jpg

Solder the other strip as well.

  • feather_done.jpg

You’re done! Check your solder joints visually and continue onto the next steps

Soldering on Female Header

  • feather_taped.jpg

Tape In Place

For sockets you’ll want to tape them in place so when you flip over the board they don’t fall out

  • feather_tack1.jpg
  • feather_tack1.jpg
  • feather_tack2.jpg
  • feather_tack3.jpg

Flip & Tack Solder

After flipping over, solder one or two points on each strip, to ‘tack’ the header in place

  • feather_soldre1.jpg
  • feather_soldre1.jpg
  • feather_solder2.jpg
  • feather_solder3.jpg

And Solder!

Be sure to solder all pins for reliable electrical contact.

(For tips on soldering, be sure to check out our Guide to Excellent Soldering).

  • feather_soldered.jpg
  • feather_soldered.jpg
  • feather_done.jpg

You’re done! Check your solder joints visually and continue onto the next steps

Get the WICED BSP

To use the WICED Feather, you first need to install a board support package (BSP) that includes all the classes, drivers and example code that make it possible to create projects that can talk to the STM32F205 MCU and Broadcom radio.  This guide will walk you through the process of getting the BSP setup on your development machine.

In a future release the WICED Feather BSP will be installable through the Arduino IDE’s Board Manager, but for the initial Developer Edition this is still a manual process.
This guide is based on Arduino 1.6.5 or higher. We suggest using a similar version of the Arduino IDE with the WICED Feather.

Setup Option 1: Download a Release from Github

The easiest method of getting the WICED Feather board support package onto your system is to go to the Releases Page in the Adafruit_WICED_Arduino Github repo and download a .zip file containing all the files you need.

1. Download the Release .zip File

  • From the Releases page download the .zip file for the release you want:
adafruit_products_Screen_Shot_2016-03-15_at_14.24.44.png
  • Unzip the downloaded file (simply double-click the file in most operating systems)
  • Rename the unzipped folder Adafruit_WICED_Arduino

2. Create the ‘Arduino/hardware’ Folder

Before you can start using the WICED Feather board support package that you just downloaded, you will probably need to setup a special ‘hardware‘ folder on your system, which is used to store special board support packages.

The exact location of this folder depends on your operating system:

OS X / Linux

From the command-line run the following commands to create the ‘Arduino/hardware’ folder:

  1. # Move to the Documents/Arduino folder
  2. $ cd $HOME/Documents/Arduino
  3.  
  4. # Create the ‘hardware’ folder if it doesn’t already exist
  5. $ mkdir hardware

Windows

On Windows, click on the My Documents icon in Windows Explorer, and then create a new folder name ‘hardware’ if it doesn’t already exists:

The ‘Arduino’ folder is usually found at ‘\Users\{yourusername}\Documents\Arduino’
adafruit_products_Screen_Shot_2016-03-09_at_15.00.07.png

3. Move the Repo into ‘Arduino/Hardware’

Once you’ve unzipped the WICED Feather board support package and created the ‘hardware’ folder, simply drag the ‘Adafruit_WICED_Arduino’ folder into ‘hardware’.

This should give you a folder structure like this:

adafruit_products_Screen_Shot_2016-03-09_at_15.13.46.png

 Setup Option 2: Clone Adafruit_WICED_Arduino

If you already have ‘git’ available on the command-line, the easiest way to clone the Adafruit_WICED_Arduino repo is to run the following command sequence from the ‘Arduino’ sub-folder in your local documents directory.

OS X / Linux Command Line

  1. # Move to the Documents/Arduino folder
  2. $ cd $HOME/Documents/Arduino
  3.  
  4. # Create the ‘hardware’ folder if it doesn’t already exist
  5. $ mkdir hardware
  6.  
  7. # Switch to the ‘hardware’ folder
  8. $ cd hardware
  9.  
  10. # Clone the Adafruit_WICED_Arduino repository
  11. $ git clone https://github.com/adafruit/Adafruit_WICED_Arduino.git

Windows Command Line

If you are using the Windows command line, we suggest using the latest git for Windows installer.

  1. # Move to the ‘My Documents\Arduino’ folder
  2. > cd \users\{yourusername}\documents\Arduino
  3.  
  4. # Create the ‘hardware’ folder if it doesn’t already exist
  5. > md hardware
  6.  
  7. # Switch to the ‘hardware’ folder
  8. > cd hardware
  9.  
  10. # Clone the Adafruit_WICED_Arduino repository
  11. > git clone https://github.com/adafruit/Adafruit_WICED_Arduino.git

Windows TortoiseGit

If you prefer to use TortoiseGit you need to create the My Documents/Arduino/hardware folder, and then clone the Adafruit_WICED_Arduino repository into that folder as shown below.

  • Right click inside the My Documents/Arduino/hardwarefolder in Windows Explorer and select the Git Clone… menu item:
adafruit_products_Screen_Shot_2016-03-09_at_14.45.21.png

Windows Setup

To setup the WICED Feather on Windows, the following steps are necessary:

This page assumes you have already installed the WICED Feather BSP, as detailed earlier in this guide.

Install Adafruit Windows Drivers

If you are using a Windows based system, you will need to install a set of drivers for the USB DFU, USB CDC and other USB interfaces used by the WICED Feather to perform fimware updates and communicate with the device.

Adafruit provides a convenient Adafruit Windows Drivers installer that takes care of the details for you.  Simply download and install the package below:

adafruit_products_Screen_Shot_2016-03-15_at_14.42.07.png

Once the installation process is complete, you should be able to plug your WICED Feather into your system and it will be recognized thanks to the signed drivers you just installed.

Install libusb 0.1 Runtime

To use libusb (which is required to communicate with the WICED Feather), you will first need to install a pre-compiled libusb runtime.

You can install this by downloading and running libusb-win32 driver, taking care to select the file named libusb-win32-devel-filter-1.2.6.0.exe.

Make sure to DISABLE the ‘Launch filter installer wizard’ option at the end of the installation process!

adafruit_products_Screen_Shot_2016-03-15_at_14.36.18.png

Install Python 2.7

Python is used by the WICED Feather for a number of cross-platform tools and scripts, meaning that you will need to installPython 2.7 (ideally 2.7.9 or higher) on your system in order to communicate with the board.

Depending on whether you are running a 32-bit (x86) or a 64-bit (AMD x64) version of Windows, download the installer linked below and start the installation process:

During the installation process make sure that you enable the option to add Python to the system path (the option is disabled by default). This is required for the Arduino IDE to be able to access the scripts it needs to communicate with the WICED Feather:

adafruit_products_Screen_Shot_2016-03-15_at_14.11.09.png

Testing the Python Installation

Once the installer is finished you can open the command line and enter the following command to test the availability of Python on your system:

  1. python version

You should see something like this:

  1. Python 2.7.11

Install Python Tools

The WICED Feather BSP uses a few Python based tools to allow the Arduino IDE to talk to the hardware in a platform-independent manner (specificallytools/feather_dfu/feather_dfu.py).

To use these Python tools, you will need a few additional libraries to make the scripts work.

Running the following command from the command line will install these dependencies:

  1. pip install pre pyusb
  2. pip install click

This will display some basic progress data on the installation process, and you should end up with something resembling the following output:

  1. C:\Users\me>pip install pre pyusb
  2. Collecting pyusb
  3. Downloading pyusb1.0.0rc1.tar.gz (53kB)
  4. 100% |################################| 57kB 1.3MB/s
  5. Installing collected packages: pyusb
  6. Running setup.py install for pyusb
  7. Successfully installed pyusb1.0.0rc1

Testing the Installation

You can test if Python is setup correctly by going to the ‘/tools/feather_dfu’ folder in the WICED Feather BSP and running the following command with the WICED Feather connected:

This step assumes you have already installed the Arduino IDE and the WICED Feather BSP, detailed earlier in this learning guide.
  1. $ cd \tools\feather_dfu
  2. $ python feather_dfu.py info

This should display something resembling the following output:

  1. Feather
  2. ST32F205RGY
  3. 353231313533470E00420037
  4. FF:FF:FF:FF:FF:FF
  5. 1.0.0
  6. 3.5.2
  7. 0.5.0
  8. 0.5.0
  9. Mar 8 2016

Optional: Install AdaLink

If you ever need to reflash the USB DFU bootloader on the WICED Feather (which will require either a Segger J-Link or anSTLink/V2), you will also need to install a utility called AdaLink.

AdaLink acts as a simple python-based abstraction layer between various HW debuggers, and the different ARM MCU families that we use at Adafruit.

For installation instructions on AdaLink see the Readme file in the git repository.

adafruit_products_Screen_Shot_2016-03-15_at_23.16.37.png

OS X Setup

To setup the WICED Feather on OS X, the following steps are necessary:

This page assumes you have already installed the WICED Feather BSP, as detailed earlier in this guide.

Install dfu-util

The WICED Feather uses USB DFU to perform firmware updates from the Arduino IDE.  To enable to Arduino IDE to talk to the board you will need to install dfu-util.

The easiest way to install dfu-util is to use homebrew, which can be installed with the following command if it doesn’t already exist on your system:

  1. /usr/bin/ruby e “$(curl -fsSL http://ift.tt/YQTuQh)”

Once homebrew is installed you can install dfu-util from the command line with the following command:

  1. brew install dfuutil

Testing the Installation

You can check if dfu-util was installed correctly by running the following command with the WICED Feather connected:

Make sure your board is in DFU mode before running this command. You can enter DFU mode by double-clicking the RESET button quickly, or by setting the DFU pin to GND at startup. You’ll know that are in DFU mode because the status LED will blink at a 5Hz rate.
  1. $ dfuutil list

This should give you results resembling the following output:

  1. dfuutil 0.8
  2.  
  3. Copyright 20052009 Weston Schmidt, Harald Welte and OpenMoko Inc.
  4. Copyright 20102014 Tormod Volden and Stefan Schmidt
  5. This program is Free Software and has ABSOLUTELY NO WARRANTY
  6. Please report bugs to dfuutil@lists.gnumonks.org
  7.  
  8. Deducing device DFU version from functional descriptor length
  9. Found DFU: [239a:0008] ver=0200, devnum=12, cfg=1, intf=0, alt=0, name=“@Internal Flash /0x08000000/02*016Ka,02*016Kg,01*064Kg,07*128Kg”, serial=“00000000001C”

Install Python Tools

The WICED Feather BSP uses a few Python based tools to allow the Arduino IDE to talk to the hardware in a platform-independent manner (specificallytools/feather_dfu/feather_dfu.py).

To use these Python tools, you will need to have Python available on your system (which OS X does by default), but you will also need a few additional libraries to make the python scripts work.

Running the following command from the command line will install these dependencies:

Depending on your system setup you may need to run the pip commands with ‘sudo’
  1. pip install pre pyusb
  2. pip install click
If you get an error like ‘-bash: pip: command not found’ you can install pip via ‘sudo easy_install pip’

Testing the Installation

You can test if Python is setup correctly by going to the ‘/tools/feather_dfu’ folder in the WICED Feather BSP and running the following command with the WICED Feather connected:

  1. $ cd tools/feather_dfu
  2. $ python feather_dfu.py info

This should display something resembling the following output:

  1. Feather
  2. ST32F205RGY
  3. 353231313533470E00420037
  4. FF:FF:FF:FF:FF:FF
  5. 1.0.0
  6. 3.5.2
  7. 0.5.0
  8. 0.5.0
  9. Mar 8 2016

Optional: Install AdaLink

If you ever need to reflash the USB DFU bootloader on the WICED Feather (which will require either a Segger J-Link or anSTLink/V2), you will also need to install a utility called AdaLink.

AdaLink acts as a simple python-based abstraction layer between various HW debuggers, and the different ARM MCU families that we use at Adafruit.

For installation instructions on AdaLink see the Readme file in the git repository.

Arduino IDE Setup

Once you have the WICED Feather board support package set up — as described in Get the WICED BSP earlier in this guide — you can start compiling code against FeatherLib or update the firmware on your device directly from the Arduino IDE.

To make sure that the Arduino IDE has access to all of the tools, libraries and config data it needs, however, you will first need to make some adjustments in the IDE:

Install an ARM Cortex M3 Toolchain

In order to build code for the STM32F205 ARM Cortex M3 MCU you will need to install and appropriate toolchain in the Arduino IDE. Thankfully, this is easy to do!

Simply go to the Tools -> Board -> Board Manager menu item:

adafruit_products_Screen_Shot_2016-03-11_at_01.43.07.png

If you don’t already have it installed, download the Arduino SAM Boards (32-bits ARM Cortex-M3) board support package:

adafruit_products_Screen_Shot_2016-03-11_at_01.44.14.png

This will install a version of GCC and related tools that is aimed at the ARM Cortex M3 mcu, and will allow you to produce machine code the the STM32F205 understands.

If you install or update the Arduino SAM ARM Cortex M3 board support package you will need to restart the Arduino IDE for the board support package changes to take effect!

Board Selection

The next thing to do (assuming that you already have the WICED BSP installed on your system, as describe in Get the WICED BSP earlier in this guide!) is to make sure that you have Adafruit WICED Feather selected as the Board target.

Selecting the right board target is critical since the board target is what causes the FeatherLib support files to be included as part of the build process!

To change the board target, simply click the Tools > Board menu item and then select Adafruit WICED Feather under the ‘Adafruit Feather Boards’ heading:

adafruit_products_Screen_Shot_2016-03-11_at_01.02.16.png

The actual position of the board in your menu will depend on your system setup, but it should resemble the following image:

adafruit_products_Screen_Shot_2016-03-11_at_01.02.45.png

Setting the ‘Section’

As described in the System Architecture page in this guide, the WICED Feather is broken up into three separate firmware images: the user code, FeatherLib, and the USB DFU bootloader.

Each of these firmware images exists in a specific section of the flash memory on the STM32F205 MCU, and you can switch between the two user-modifiable sections via the Tools > Section menu:

adafruit_products_Screen_Shot_2016-03-11_at_01.02.58.png

The following sections are available in the menu:

  • User Code: This section (which consists of 128KB flash and 16KB SRAM) is where your user sketches go, which is the project that you compile in the Arduino IDE.  This is the section you will want to use 99% of the time!
  • Feather Lib: This is the library that contains the low level WiFi stack and security layer, manage the RTOS (real time operating system) that schedules different tasks on the system, and does all of the heavy lifting for you.  By selecting ‘Feather Lib’ as the section and then flashing your WICED Feather like you would for a normal project you can either reflash or update the FeatherLib on your hardware.  If you update the WICED Feather BSP and a new version of FeatherLib is available, you would do this once to update your device and then switch back to ‘User Code’.
    • Feather Lib (Release): This will flash the latest release version of FeatherLib
    • Feather Lib (Beta): This will flash the latest BETA release of FeatherLib if one is available. If no BETA version is available, this is generally identical to the release files. You should check the FeatherLib version numbers to verify if there is a difference.
  • Factory Reset: Selecting this ‘section’ and then flashing your device is a bit of a hack since it won’t actually flash a sketch, but it will use the feather_dfu.py tool to perform a factory reset on your device in case it went off into the weeds somehow.
  • NVM Reset: Similar to the factory reset above, selectiing this section and then flashing your device will cause the non-volatile config memory on your WICED Feather to be reset to factory defaults (although the rest of the device, such as the user code, will be left untouched).

To flash the appropriate code to the device (or perform a factory reset or NVM reset), you simply need to change the section and click the Sketch > Upload tools menu, or click the arrow icon in the Arduino IDE (the second icon from the left below):

adafruit_products_Screen_Shot_2016-03-11_at_01.20.38.png
If you select FeatherLib, Factory Reset or NVM Reset (which require no code compilation themselves) a full project compilation will still take place before FeatherLib is flashed or a reset is performed. The compiled user code will not be used, but the compilation process can’t be avoided due to the nature of sections in the Arduino IDE.

Selecting the Serial Port

By default, two USB CDC serial ports will be enumerated with the WICED Feather.  One serial port will be used for general purpose serial data and is connected to the Serial Monitor.  This is the port you should normally select in the Arduino IDE.

The second port that is enumerated is for basic debugging and for future expansion, and enumerates a currently unused AT Parser that only supports a very basic set of commands (for example ‘ATI’ will return some basic information about the module).

adafruit_products_WICEDWinCOMPorts.png
adafruit_products_Screen_Shot_2016-03-11_at_01.27.32.png

With the right serial port selected (normally the numerically lowest number is the Serial COM port), you can open the Serial Monitor and you can send and receive serial data like you would with any other Arduino development board.

On Windows, you can verify which COM port corresponds to which function by opening the Device Manager and examining the list of serial ports. COM35 below is the Serial Monitor port (WICED Feather Serial) and COM36 is the AT parser port (WICED Feather ATParser).

adafruit_products_wicedcomports.png

Optional: Updating the Bootloader

While you should never have to update the USB DFU bootloader on your WICED Feather, if you have a Segger J-Link or anSTLink/V2 you can reflash the normally read-only bootloader from within the Arduino IDE.

A J-Link or STLink is required since this is the only way to talk to the STM32F205 if the bootloader is somehow erased.

To reflash the bootloader hook the SWDIO, SWCLK, RESET and GND pins up to the pins of the same name on the WICED Feather (see the JLink or STLink/V2 pinout to know where to find these pins on your debugger).  If you are using a JLink, make sure to also connect the VTRef pin to 3.3V on the WICED Feather since it needs to know the logic level for the target device.

Select the appropriate debugger from the Tools > Programmermenu (only the J-Link or STLink options will work!):

adafruit_products_Screen_Shot_2016-03-11_at_01.33.10.png

You can then click the Burn Bootloader menu entry and the Arduino IDE will attempt to use the JLink or STLink (viaAdaLink) to reflash the bootloader for you.

Compiling your Sketch

At this point you’re ready to start flashing your projects to the WICED Feather as you would with any other Arduino compatible development board!

If you run into any problems, make sure that the WICED Feather BSP is properly configured, that you have installed the appropriate ARM Cortex M3 toolchain, and that the IDE is setup with the following values:

System Architecture

One of the key challenges creating the WICED Feather is that it is based on the Broadcom WICED WiFi stack, and due to the license terms we’re unable to release any of the source files.

This poses a bit of a dilemma since we tested almost every embedded WiFi stack out there, and WICED easily climbed to the top in terms of features, performance and reliability.  We want that reliability and speed, but we also want to make sure customers have the flexibility to bring all kind of projects to life as well, without having to sign restrictive license agreements themselves.

So how do we make this available to customers in a way they can use in the real world, without signing NDAs themselves?

The answer wasn’t obvious at first, but FeatherLib was the end result of a lot of head scratching and firmware dead ends.

WICED WiFi + RTOS + SDEP = FeatherLib

The proprietary Broadcom WICED WiFi stack is designed around an RTOS (Real Time Operating System), which handles all of the various tasks involved in WiFi, such as async data requests, security and cryptography, etc. (If you’re not familiar with them, an RTOS breaks tasks into ‘threads’, and then shares MCU cycles between those threads, allowing you to effectively multi-task on a single MCU.)

The RTOS and all of the proprietary Broadcom WiFi stack and code runs behind the scenes in a binary black box we call theFeatherLib (see the Flash Memory Layout section below for details). By providing a binary black box, we solve the legal hurdles of working with WICED, but this still leaves the problem of exposing the WiFi functionality to end user.

We solved this by essentially ‘wrapping’ every useful function in the WICED stack with a custom command (using an in house protocol called SDEP), and then routing these commands between the Broadcom SDK in FeatherLib and end users. We can freely expose the source related to the SDEP commands (since we wrote 100% of it), while still hiding the proprietary Broadcom functions, header files and structs. The lawyers are happy, and hopefully our customers are too!

By basically reimplementing the entire Broadcom WICED WiFi stack with a new set of SDEP commands and a more focused custom API, you get access to Broadcoms high quality stack, without any of the legal headaches.  The headaches were all on our side reimplementing the wheel just to solve a legal problem. :)

Arduino User Code

This left the problem of how to allow users to write code themselves that talks to FeatherLib via SDEP.

Since FeatherLib runs on an RTOS,  we start a single RTOS ‘thread’ at startup that is used for the user code.  FeatherLib will start the Broadcom WiFi stack, and as part of that process it also start the ‘user code’ thread that runs the custom code that you write and compile in the Arduino IDE.

This custom user code is built in the Arduino IDE like you would for any other MCU, and gets written into a dedicate section of flash memory with it’s own chunk of SRAM reserved purely for the user code in Arduino land.

This setup allows you to share the MCU processing time between your own code and the lower level WiFi stack, but the process should normally be invisible to you, and you never really need to worry about the FeatherLib black box.

Inter Process Communication (SDEP)

Communication between the user code and the Feather lib happens via an in-memory messaging system, sending and receiving commands using a custom protocol we call SDEP(Simple Data Exchange Protocol).

An SDEP command is sent to the Feather lib, and a standard response is sent back and interpretted, allowing the two binary blobs to exist entirely independent of each other, and be updated separately.

You normally never need to deal with SDEP commands directly since the commands are all hidden in the public WICED Feather helper classes (AdafruitFeather, AdafruitHTTP, etc.). These helper classes and functions send the SDEP commands for you, and convert the responses into meaningful data.

There is a special AdafruitSDEP helper class that allows you to send SDEP commands directly if the need does every arise, though, and the SDEP commands are all documented elsewhere in this learning guide.

Flash Memory Layout

To keep things as simple as possible, and to make updates easy, the flash-memory and SRAM on the STM32F205 MCU is broken up into several Sections, as shown in the diagram below.

Keeping the sections independent allows you to update the user code without having to recompile and reflash the rest of the system, significantly speeding up build and write times.

adafruit_products_WICEDMemoryMap.png

User Code (128KB + 16KB SRAM)

Your own code (‘User Code’) will be compiled directly by the Arduino IDE, and has access to 128KB of flash and 16KB of SRAM.

Feather Lib (832 KB + 112KB SRAM)

The low level WiFi stack from Broadcom (‘Feather Lib’) is provided as a single pre-compiled .hex file that gets flashed to a dedicated location in flash memory on the STM32F205 MCU. Because most of the heavy lifting is done here, it has access to most of the flash and SRAM.

Config Data (32KB)

Two identical sets of non-volatile config data are stored in this section, and when any changes are made the bank used is switched to make sure that no data is lost during the updates. Normally you will never access this memory directly, and this is managed by the Feather Lib.

USB DFU Bootloader (32KB)

This code runs as soon as your device powers up and starts the Feather Lib, and also checks if any User Code is available.

This is what allows you to update the User Code or Feather Lib using USB DFU.

The bootloader code itself can be updated from the Arduino IDE as well, but it requires you have either a Segger J-Link or an STLink/V2 connected to the SWDIO and SWCLK pins on the WICED Feather, and you will normally never need to update the bootloader yourself.

  • Board: Adafruit WICED Feather
  • Section: User Code
  • Serial Port: Typically the numerically lowest WICED CDC port, but it should be set to the COM port that appears as ‘WICED Feather Serial‘ in the Device Manager on Windows where the order of enumeration may change.

Then just click the ‘Upload‘ arrow icon, and the compilation and USB DFU flashing process should start, which will result in the following output:

adafruit_products_Screen_Shot_2016-03-11_at_01.39.56.png

WICED Feather 

In order to simplify the most common activities with the WICED Feather, several helper classes have been added to the board support package.

These helper classes are described below, and detailed explanations of each class can be found later in this guide.

AdafruitFeather

This is the main class you will use to configure the WICED Feather. It contains functions to connect or disconnect to an AP, ping another device, set certificate details when using TLS and HTTPS, as well as a few more specialized commands like some MQTT commands to use the internal MQTT stack in the WICED Feather WiFi stack.

For detailed information see:AdafruitFeather and AdafruitFeather: Profiles

AdafruitTCP

The AdafruitTCP class provides helper functions to open, close and work with TCP based socket connections.  There are convenient callback functions for the socket disconnect events, as well as when data is received, and you can start an open or SSL based connection.

For detailed information see:AdafruitTCP and AdafruitTCPServer

AdafruitUDP

The AdafruitUDP class provides helper functions to open, close and work with UDP based socket connections. There is a callback function to handle data receive events.

For detailed information see: AdafruitUDP

AdafruitHTTP

This class provides a convenient wrapper for the most common HTTP activities, including a callback for when data is received, and helpers to deal with response headers and and TLS (for secure HTTPS connections).

For detailed information see: AdafruitHTTP

AdafruitMQTT

This class provides a basic MQTT client, allowing you to connect to remote MQTT brokers over a standard TCP connection.  You can establish open or secure connections to the MQTT broker, publish to topics, subscribe to up to eight topics (including using subscribe wildcards like ‘adafruit/+’ to subscribe to all changes above ‘/adafruit’), and capture subscribe events via a convenient callback handler.

For detailed information see:AdafruitMQTT and AdafruitMQTTTopic

AdafruitAIO

The AdafruitAIO family is a specialized version of the AdafruitMQTT classes, and is designed to work specifically withAdafruit IO.

For detailed information see: AdafruitAIO and AdafruitAIOFeed

AdafruitSDEP

This class handles sending and receiving SDEP messages between the user code and the lower level feather lib.  Normally you will never need to send SDEP messages yourself, and you will use the higher level helper classes mentionned elsewhere on this page, but AdafruitHTTP inherits from AdafruitSDEP, so you have access to all of the functions in AdafruitSDEP via the standard Feather object, such asFeather.sdep_n(…)Feather.errno(), etc.

For detailed information see: AdafruitSDEP

Client API

The WICED Feather board support package also includes support for the standard Arduino Client interface, which is common to almost every networking device in the Arduino family. The Adafruit helper classes mentionned above expose many standard Client functions, and you should be able to adapt Client based example code to the WICED Feather with minimal changes and effort.

For detailed information see: Client

Share This:

View more at: http://yoursmart.mobi

About Author

Advertisement

Post a Comment

 
Top