Adafruit Feather M0 WiFi with ATWINC1500 Created by lady ada Last updated on 2019-09-05 09:40:59 PM UTC
Overview 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 Feather M0 WiFi w/ATWINC1500 - our take on an 'all-in-one' Arduino-compatible + high speed, reliable WiFi with built in USB and battery charging. Its an Adafruit Feather M0 with a WiFi module (http://adafru.
You might be wondering why use this when you can get a HUZZAH Feather? (http://adafru.it/2821) Well, you get A highly-capable Cortex M0+ processor with ton more I/O pins, lots of 12-bit ADCs, a 10-bit DAC, 6 total SERCOMs that can each do SPI, I2C or UART (3 are used by the existing interfaces, leaving you 3), plenty of timers, PWMs, DMA, native USB, and more (check out the Datasheet (https://adafru.
At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0 processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new Arduino Zero (http://adafru.it/2843). This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and 32K of RAM (16x as much)! This chip comes with built in USB so it has USB-to-Serial program & debug capability built in with no need for an FTDI-like chip.
switch over to USB power when its available. We also tied the battery through a divider to an analog pin, so you can measure and monitor the battery voltage to detect when you need a recharge. Here's some handy specs! Like all Feather M0's you get: Measures 2.1" x 0.9" x 0.3" (53.65mm x 23mm x 8mm) without headers soldered in. Note it is 0.1" longer than most Feathers Light as a (large?) feather - 6.1 grams ATSAMD21G18 @ 48MHz with 3.3V logic/power 256KB FLASH, 32KB SRAM, No EEPROM 3.
Comes fully assembled and tested, with a USB bootloader that lets you quickly use it with the Arduino IDE. We also toss in some header so you can solder it in and plug into a solderless breadboard. Lipoly battery (https://adafru.it/e0v) and MicroUSB cable (https://adafru.it/aM5) not included (but we do have lots of options in the shop if you'd like!) © Adafruit Industries https://learn.adafruit.
Pinouts Note AREF in the diagram should be marked PA03 not PA02 The Feather M0 Adalogger is chock-full of microcontroller goodness. There's also a lot of pins and ports. We'll take you a tour of them now! © Adafruit Industries https://learn.adafruit.
Power Pins GND - this is the common ground for all power and logic BAT - this is the positive voltage to/from the JST jack for the optional Lipoly battery USB - this is the positive voltage to/from the micro USB jack if connected EN - this is the 3.3V regulator's enable pin. It's pulled up, so connect to ground to disable the 3.3V regulator 3V - this is the output from the 3.3V regulator, it can supply 600mA peak Logic pins This is the general purpose I/O pin set for the microcontroller. All logic is 3.
be aware that this pin naturally 'sits' at around 2VDC due to the resistor divider #10 - GPIO #10 #11 - GPIO #11 #12 - GPIO #12 #13 - GPIO #13 and is connected to the red LED next to the USB jack A0 - This pin is analog input A0 but is also an analog output due to having a DAC (digital-to-analog converter). You can set the raw voltage to anything from 0 to 3.3V, unlike PWM outputs this is a true analog output A1 thru A5 - These are each analog input as well as digital I/O pins.
SWCLK & SWDIO - These pads on the bottom are used to program the chip. They can also be connected to an SWD debugger. © Adafruit Industries https://learn.adafruit.
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! The first option is soldering in plain male headers, this lets you plug in the Feather into a solderless breadboard © Adafruit Industries https://learn.adafruit.
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 © Adafruit Industries https://learn.adafruit.
We also have 'slim' versions of the female headers, that are a little shorter and give a more compact shape © Adafruit Industries https://learn.adafruit.
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 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 Add the breakout board: Place the breakout board over the pins so that the short © Adafruit Industries https://learn.adafruit.
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 (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
Solder the other strip as well. © Adafruit Industries https://learn.adafruit.
You're done! Check your solder joints visually and continue onto the next steps Soldering on Female Header 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 Flip & Tack Solder After flipping over, solder one or two points on each strip, to 'tack' the header in place © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
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 (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Power Management Battery + USB Power We wanted to make the Feather easy to power both when connected to a computer as well as via battery. There's two ways to power a Feather. You can connect with a MicroUSB cable (just plug into the jack) and the Feather will regulate the 5V USB down to 3.3V. You can also connect a 4.2/3.7V Lithium Polymer (Lipo/Lipoly) or Lithium Ion (LiIon) battery to the JST jack. This will let the Feather run on a rechargable battery.
The above shows the Micro USB jack (left), Lipoly JST jack (top left), as well as the 3.3V regulator and changeover diode (just to the right of the JST jack) and the Lipoly charging circuitry (to the right of the Reset button). There's also a CHG LED, which will light up while the battery is charging. This LED might also flicker if the battery is not connected. The charge LED is automatically driven by the Lipoly charger circuit. It will try to detect a battery and is expecting one to be attached.
You can read this pin's voltage, then double it, to get the battery voltage. #define VBATPIN A7 float measuredvbat = analogRead(VBATPIN); measuredvbat *= 2; // we divided by 2, so multiply back measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage measuredvbat /= 1024; // convert to voltage Serial.print("VBat: " ); Serial.println(measuredvbat); ENable pin If you'd like to turn off the 3.3V regulator, you can do that with the EN(able) pin.
unexpected behavior and the EN pin will no longer. Also this doesn't provide power on BAT or USB and some Feathers/Wings use those pins for high current usages. You may end up damaging your Feather. Connect an external 5V power supply to the USB and GND pins. Not recommended, this may cause unexpected behavior when plugging in the USB port because you will be back-powering the USB port, which could confuse or damage your computer. Power Usage & Saving with WiFi WiFi is a very power-hungry protocol.
WiFi.lowPowerMode(); Note that 10mA or so is for the ATSAMD chip, so that means you've got ~12mA for the WiFi module. If you want ultra-low power you can manage the WINC1500 module your own with WiFi.setSleepMode(M2M_PS_MANUAL, 1); And then when you want it to go to sleep call: WiFi.requestSleep(sleeptimeinmilliseconds) With this mode, you can get much much lower power when you call the requestSleepmode (basically 1-2mA) and still have an active live WiFi connection...
© Adafruit Industries https://learn.adafruit.
Arduino IDE Setup The first thing you will need to do is to download the latest release of the Arduino IDE. You will need to be using version 1.8 or higher for this guide https://adafru.it/f1P https://adafru.it/f1P After you have downloaded and installed the latest version of Arduino IDE, you will need to start the IDE and navigate to the Preferences menu. You can access it from the File menu in Windows or Linux, or the Arduino menu on OS X. A dialog will pop up just like the one shown below.
We will be adding a URL to the new Additional Boards Manager URLs option. The list of URLs is comma separated, and you will only have to add each URL once. New Adafruit boards and updates to existing boards will automatically be picked up by the Board Manager each time it is opened. The URLs point to index files that the Board Manager uses to build the list of available & installed boards.
Here's a short description of each of the Adafruit supplied packages that will be available in the Board Manager when you add the URL: Adafruit AVR Boards - Includes support for Flora, Gemma, Feather 32u4, Trinket, & Trinket Pro.
Using with Arduino IDE The Feather/Metro/Gemma/Trinket M0 and M4 use an ATSAMD21 or ATSAMD51 chip, and you can pretty easily get it working with the Arduino IDE. Most libraries (including the popular ones like NeoPixels and display) will work with the M0 and M4, especially devices & sensors that use I2C or SPI. Now that you have added the appropriate URLs to the Arduino IDE preferences in the previous page, you can open the Boards Manager by navigating to the Tools->Board menu.
Install Adafruit SAMD Next you can install the Adafruit SAMD package to add the board file definitions Make sure you have Type All selected to the left of the Filter your search... box You can type Adafruit SAMD in the top search bar, then when you see the entry, click Install Even though in theory you don't need to - I recommend rebooting the IDE Quit and reopen the Arduino IDE to ensure that all of the boards are properly installed.
Install Drivers (Windows 7 & 8 Only) When you plug in the board, you'll need to possibly install a driver Click below to download our Driver Installer https://adafru.it/EC0 https://adafru.it/EC0 Download and run the installer Run the installer! Since we bundle the SiLabs and FTDI drivers as well, you'll need to click through the license © Adafruit Industries https://learn.adafruit.
Select which drivers you want to install, the defaults will set you up with just about every Adafruit board! Click Install to do the installin' Blink Now you can upload your first blink sketch! Plug in the M0 or M4 board, and wait for it to be recognized by the OS (just takes a few seconds). It will create a serial/COM port, you can now select it from the drop-down, it'll even be 'indicated' as Trinket/Gemma/Metro/Feather/ItsyBitsy/Trellis! © Adafruit Industries https://learn.adafruit.
Now load up the Blink example // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output.
Compilation Issues If you get an alert that looks like Cannot run program "{runtime.tools.arm-none-eabi-gcc.path}\bin\arm-non-eabi-g++" Make sure you have installed the Arduino SAMD boards package, you need both Arduino & Adafruit SAMD board packages Manually bootloading If you ever get in a 'weird' spot with the bootloader, or you have uploaded code that crashes and doesn't auto-reboot into the bootloader, click the RST button twice (like a double-click)to get back into the bootloader.
Using the WiFi Module Once you have your Feather working, you probably want to rock out with some Wireless connectivity. Luckily, Atmel & Arduino have written a great library for supporting the WINC1500 Install the Library We will start by installing the official Arduino WiFi101 library (https://adafru.it/kUF). We want the latest version so visit the Library Manager © Adafruit Industries https://learn.adafruit.
Type in wifi101 and when the library comes up, click Install or Update to make sure its the most recent one! If you're not familiar with installing Arduino libraries, please visit our tutorial: All About Arduino Libraries (https://adafru.it/aYM)! Restart the Arduino IDE. You may need to use Arduino 1.6.5 or later Check Connections & Version Before we start, its important to verify you have the right setup & firmware version.
Note that to use the official Arduino WiFi101 Library, we must configure it to use the pins specific to the ATWINC1500 Feather. With each example sketch, you'll need to add WiFi.setPins(8,7,4,2); to the top of the setup function! //Configure pins for Adafruit ATWINC1500 Feather WiFi.setPins(8,7,4,2); Like so: Upload to your Arduino and open up the Serial Console at 9600 baud: You should see the firmware version.
If you have version 19.3 or less, the firmware is too old If you get not response, the firmware is either waaay to old, or something is amiss with your wiring! Scanning WiFi Now that you have the right firmware version, lets scan for network! Run the WiFi101->ScanNetworks example to see a list of available visible networks Don't forget to add WiFi.setPins(8,7,4,2) at the top of setup() © Adafruit Industries https://learn.adafruit.
Connect & Read Webpage OK finally you get to connect and read some data! Open up the WiFi101->WiFiWebClient example Edit the ssid and pass variables to contain your network and password Add the following lines at the top of setup() //Configure pins for Adafruit ATWINC1500 Feather WiFi.setPins(8,7,4,2); It will connect to the website in server and read the webpage manually: Creating an Access Point + Webserver © Adafruit Industries https://learn.adafruit.
This demo will let you create a new WiFi AP with the Feather M0 which you can connect to from any WiFi capable device. It will also create a Server so you can connect and turn on/off the onboard LED Launch the WiFi101->AP_SimpleWebServer example You can change the SSID & LED ( LED_BUILTIN is #13, the onboard feather LED) Upload and open up the serial console to start the AP © Adafruit Industries https://learn.adafruit.
Your computer will see the new AP and you should connect to it Back over at the serial console, the Feather will have started up a server, it will print out the IP address and instructions © Adafruit Industries https://learn.adafruit.
Go to the IP address and you will see the mini webpage, click on the links to turn on/off the LED In the serial console you will see the data received from the webbrowser client That's it! pretty easy, huh? There's other examples you can try such as server mode, UDP data transmission & SSL © Adafruit Industries https://learn.adafruit.
Updating Firmware If you're running 19.5.2 there is no need to update to 19.5.
setPins()! If you are using a WiFi101 or WINC1500 shield, you do not have to add setPins() code Upload it to your board. Make sure the Serial console is not open before or after uploading. Then select the Updater tool built into the IDE Select the right COM port, and click Test Connection If all is good you'll get a confirmation © Adafruit Industries https://learn.adafruit.
Next, select the firmware - we of course recommend the latest version! If you don't see the right/matching version you may need to update the IDE © Adafruit Industries https://learn.adafruit.
Once you feel ready - make sure the USB cable is connected solidly! Click Update Firmware © Adafruit Industries https://learn.adafruit.
And a minute or two later... Now you're ready to rock! Reload the Firmware Check sketch from before, this time you will see: © Adafruit Industries https://learn.adafruit.
Updating SSL Certificates If you're trying to connect to a computer or service via SSL and the connection is failing, you may need to update the certificates built into the WINC1500. By default it comes with many of the most popular SSL certificates but you may bump into a site that requires one that isnt included.
Upload it to your Feather. Make sure the Serial console is not open before or after uploading. Then select the Updater tool built into the IDE Select the right COM port, and click Test Connection If all is good you'll get a confirmation © Adafruit Industries https://learn.adafruit.
Now at the bottom of the page, click Add Domain and type in the URL of the site you want to access: Then click Upload Certificates A few moments later...success! © Adafruit Industries https://learn.adafruit.
What SSL/TLS support is available with the WINC1500? Officially Atmel lists TLS 1.0 & 1.1, however we have noticed that the firmwares shipping on boards today seem to also support TLS 1.2 (verified by checking the results of www.howsmyssl.com). The supported ciphers are: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_128_GCM_SHA256 TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_128_CBC_SHA © Adafruit Industries https://learn.
© Adafruit Industries https://learn.adafruit.
Adapting Sketches to M0 & M4 The ATSAMD21 and 51 are very nice little chips, but fairly new as Arduino-compatible cores go. Most sketches & libraries will work but here’s a collection of things we noticed. The notes below cover a range of Adafruit M0 and M4 boards, but not every rule will apply to every board (e.g. Trinket and Gemma M0 do not have ARef, so you can skip the Analog References note!). Analog References If you'd like to use the ARef pin for a non-3.
AnalogWrite / PWM on Feather/Metro M0 After looking through the SAMD21 datasheet, we've found that some of the options listed in the multiplexer table don't exist on the specific chip used in the Feather M0. For all SAMD21 chips, there are two peripherals that can generate PWM signals: The Timer/Counter (TC) and Timer/Counter for Control Applications (TCC). Each SAMD21 has multiple copies of each, called 'instances'. Each TC instance has one count register, one control register, and two output channels.
TX and SDA (Digital pins 1 and 20) analogWrite() PWM range On AVR, if you set a pin's PWM with analogWrite(pin, 255) it will turn the pin fully HIGH. On the ARM cortex, it will set it to be 255/256 so there will be very slim but still-existing pulses-to-0V.
float f = (float)mybuffer; You can't be guaranteed that this will work on a 32-bit platform because mybuffer might not be aligned to a 2 or 4byte boundary. The ARM Cortex-M0 can only directly access data on 16-bit boundaries (every 2 or 4 bytes). Trying to access an odd-boundary byte (on a 1 or 3 byte location) will cause a Hard Fault and stop the MCU. Thankfully, there's an easy work around ...
Pretty-Printing out registers There's a lot of registers on the SAMD21, and you often are going through ASF or another framework to get to them. So having a way to see exactly what's going on is handy. This library from drewfish will help a ton! https://github.com/drewfish/arduino-ZeroRegs (https://adafru.it/Bet) M4 Performance Options As of version 1.4.0 of the Adafruit SAMD Boards package in the Arduino Boards Manager, some options are available to wring extra performance out of M4-based devices.
There’s usually more than one way to solve a problem, some more resource-intensive than others. Since Arduino got its start on resource-limited AVR microcontrollers, the C++ compiler has always aimed for the smallest compiled program size. The “Optimize” menu gives some choices for the compiler to take different and often faster approaches, at the expense of slightly larger program size…with the huge flash memory capacity of M4 devices, that’s rarely a problem now.
Downloads Datasheets & Files Atmel Software Programming guide for WINC1500 (https://adafru.it/ldD) - this is for the underlying ASF codebase that is 'wrapped' in Adafruit_WINC1500 but its still very handy reference ATSAMD21 Datasheet (https://adafru.it/ldE) - Its long, but its a good read EagleCAD PCB Files on GitHub (https://adafru.it/oeK) https://adafru.it/z4e https://adafru.
© Adafruit Industries https://learn.adafruit.
Feather HELP! Even though this FAQ is labeled for Feather, the questions apply to ItsyBitsy's as well! My ItsyBitsy/Feather stopped working when I unplugged the USB! A lot of our example sketches have a while (!Serial); line in setup(), to keep the board waiting until the USB is opened. This makes it a lot easier to debug a program because you get to see all the USB data output.
My Feather never shows up as a COM or Serial port in the Arduino IDE A vast number of Itsy/Feather 'failures' are due to charge-only USB cables We get upwards of 5 complaints a day that turn out to be due to charge-only cables! Use only a cable that you know is for data syncing If you have any charge-only cables, cut them in half throw them out.
Ack! I "did something" and now when I plug in the Itsy/Feather, it doesn't show up as a device anymore so I cant upload to it or fix it... No problem! You can 'repair' a bad code upload easily. Note that this can happen if you set a watchdog timer or sleep mode that stops USB, or any sketch that 'crashes' your board 1. 2. 3. 4. 5. 6. 7. 8. 9.
© Adafruit Industries https://learn.adafruit.
I can't get the Itsy/Feather USB device to show up - I get "USB Device Malfunctioning" errors! This seems to happen when people select the wrong board from the Arduino Boards menu. If you have a Feather 32u4 (look on the board to read what it is you have) Make sure you select Feather 32u4 for ATMega32u4 based boards! Do not use anything else, do not use the 32u4 breakout board line.
I'm having problems with COM ports and my Itsy/Feather 32u4/M0 Theres two COM ports you can have with the 32u4/M0, one is the user port and one is the bootloader port. They are not the same COM port number! When you upload a new user program it will come up with a user com port, particularly if you use Serial in your user program. If you crash your user program, or have a program that halts or otherwise fails, the user COM port can disappear.
I don't understand why the COM port disappears, this does not happen on my Arduino UNO! UNO-type Arduinos have a seperate serial port chip (aka "FTDI chip" or "Prolific PL2303" etc etc) which handles all serial port capability seperately than the main chip. This way if the main chip fails, you can always use the COM port. M0 and 32u4-based Arduinos do not have a seperate chip, instead the main processor performs this task for you. It allows for a lower cost, higher power setup...
I'm trying to upload to my 32u4, getting "avrdude: butterfly_recv(): programmer is not responding" errors This is likely because the bootloader is not kicking in and you are accidentally trying to upload to the wrong COM port The best solution is what is detailed above: manually upload Blink or a similar working sketch by hand by manually launching the bootloader © Adafruit Industries https://learn.adafruit.
I'm trying to upload to my Feather M0, and I get this error "Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding" You probably don't have Feather M0 selected in the boards drop-down. Make sure you selected Feather M0. © Adafruit Industries https://learn.adafruit.
I'm trying to upload to my Feather and i get this error "avrdude: ser_recv(): programmer is not responding" You probably don't have Feather M0 / Feather 32u4 selected in the boards drop-down. Make sure you selected Feather M0 (or Feather 32u4). © Adafruit Industries https://learn.adafruit.
I attached some wings to my Feather and now I can't read the battery voltage! Make sure your Wing doesn't use pin #9 which is the analog sense for the lipo battery! © Adafruit Industries https://learn.adafruit.
The yellow LED Is flickering on my Feather, but no battery is plugged in, why is that? The charge LED is automatically driven by the Lipoly charger circuit. It will try to detect a battery and is expecting one to be attached. If there isn't one it may flicker once in a while when you use power because it's trying to charge a (non-existant) battery. It's not harmful, and its totally normal! © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
© Adafruit Industries Last Updated: 2019-09-05 09:40:59 PM UTC Page 77 of 77