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:
The first 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.
To change the board target, simply click the Tools > Board menu item and then select Adafruit WICED Feather under the 'Adafruit Feather Boards' heading:
The actual position of the board in your menu will depend on your system setup, but it should resemble the following image:
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:
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):
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).
With the right serial port selected (normally the numerically lowest number is the Serial Monitor COM port, though it´s random and may change from one system to the next), 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).
While you should never have to update the USB DFU bootloader on your WICED Feather, if you have a Segger J-Link or an STLink/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 > Programmer menu (only the J-Link or STLink options will work!):
You can then click the Burn Bootloader menu entry and the Arduino IDE will attempt to use the JLink or STLink (via AdaLink) to reflash the bootloader for you.
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:
- 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: