Electronics

Adafruit's FeatherM0_WiFi - An Odyssey

2016-08-18 06:30

Getting exited

For my R1 project I was looking for an MCU that could:

Since the 8bit ATmega328P is really a pleasure to work with and since I collected a lot of stuff from Atmel over the last year for other projects, I thought my best option was to use there WINC1500 WLAN module for the PC connection.

The Atmel Xplained boards I have (like the one for the WINC1500) are nicely supported by their IDE "AtmelStudio", but the are a little bulky for being carried around by my little R1.

Sourcing the Net for parts to build my own design, I ran into a company called Adafruit and it looked like they are selling pretty much the perfect package ready made:

These modules come in Adafruit's very compact Feather format sharing a common interface layout. By using some long contact headers you can stack different Feather modules on top of each other, avoiding a lot of cables.

Sounds like the perfect solution, right?

So I ordered:

It just sounded too good to be true...

Getting started

All started quite innocent. I just followed the instructions on Adafruit's web site for the FeatherM0-WiFi setup:

I got an error at the end, but the LED blinked. So I did not worry too much about it.

Getting frustrated

That changed, when I tried to upload the OLED demo.

All of a sudden there was no response from the board anymore.

To cut a long and very frustrating experience short.

The FeatherM0 has some serious issues:

Adafruit has some serious issues too:

Solving the problem

What you need to solve the problem is:

Preparations

  1. Build your own cable

    • crimp the 50mil IDC Socket to the ribbon cable

    • splice the other end of the cable and solder the cables to the back of the FeatherM0

      We need to use the Atmel ICE in SWD mode, since that is what is supported by the FeatherM0.

      Using the SAM port of the Atmel SAM ICE:

      PINSWD function FeatherM0's connection
      1 VTG (target voltarge)has to go to the 3V pin
      2 SWDIO that is the left pads on the back
      3 GND is soldered to the GND pin
      4 SWDCLK the right pad on the back
      10 RST gets soldered to the RST pin

      That is all that's needed. All the other pins and wires can be ignored.

      Beware!
      If you are stucked with the original Atmel ICE cable remember that the RST line (pin 10) is not connected to the 100mil 6 pos connector. You may have to use a lab probe to connect to the back of the header directly.

  2. Install and fire up AtmelStudio
  3. Connect the Atmel Programmer/Debugger

Running an Arduino sketch on the FeatherM0

  1. Open a new Project and select "Create from Arduino sketch"
    E.g. use the Blink example, that can be found in your Arduino IDE installation's example path.
  2. After the generation of the AtmelStudio solution is finished make sure to select the correct device (ATSAMD21G18A) and the correct tool (SWD on Atmel-ICE).
  3. Now you can run the solutions.

    This will:

    • delete the broken bootloader from the FeatherM0
      (Don't worry, with the tools we have now, we can restore the bootloader, if needed.)
    • upload the firmware to the FeatherM0 and execute it

What we have gained

  1. We got rid of the annoying FeatherM0 bootloader problem.
  2. We work in a proper IDE, with goodies like code completion, etc.
  3. We still can use all the Arduino sketches and libraries, that make life so easy in the Arduino eco system.
  4. We can debug our firmware directly on the hardware.
    I'm actually amazed, that anyone tries at all to take on a serious software project (embedded or not) without having a proper debugger in place. I'm doing software development for 30 years and still my programs have unintended features, that I have to learn about.

My conclusion

Having said that, IMHO, if you are serious about MCU development, you should do that anyway or maybe have a look at the products of Cypress. Their (also free of charge) PSoC Creator IDE is in my opinion by far superior to AtmelStudio and their inexpensive PSoC hardware plays in a completely different league.