Getting the WiFi module to work

A project log for 12 channel LED controller

A MQTT controlled 12 channel LED dimmer for home use

Markus KastenMarkus Kasten 02/25/2018 at 19:480 Comments

I finally received my ATWINC module last week, that means I'm one step closer to finishing off the board design. I tested the module against a print of the footprint I came up with, and to my surprise, it actually fits perfectly. There was just a little problem in the symbol I noticed later, which resulted in VCC not being connected, but that was sorted out quickly. While I was at it I also added an extra bypass cap to buffer the huge current spikes this module might produce when transmitting, it's never a bad idea to have some headroom for bypass caps on your board I guess.

Next task is to get the module to actually talk to me, or my access point at home. Boy, what a mess it's been so far (well, to be fair, it could've been worse).

ATWINC adapter board, dead bug style

First of all I had to make an adapter board to get it hooked up to my dev board. I chose to solder it upside down, dead-bug style on a piece of perfboard and have all important connections available on a .1 inch header, plus add a couple of passives that are needed for proper operation. Soldering all these flimsy wires was a lot easier than I thought it would, with the exception of the ground pin which sucks all the heat away and makes soldering on wires a bit of a challenge. The board was done in two hours or so and didn't even show any fatal shorts upon checking it.

I had the firmware prepped to a point where I thought it would just connect up to my WiFi, and I could see what works and what doesn't from there on. Turns out, nothing all. The board was so silent with anything I thought I killed it upon soldering. At least half a day of debugging later it turns out, my BSP (board support package) I wrote for the ATWINC driver wasn't returning a status after handling bus (SPI) transactions, which resulted in huge amounts of error messages and complete silence on the module site. 

Next the driver greeted me with a pleasant "Firmware version mismatch" message, great. While updating the modules internal firmware isn't hard, the way of getting there had more hurdles than I would like. Most of the documentation and application notes only use the module with Atmels official dev board, which I don't have, so figuring how to get it to work without the board was one challenge. Luckily it can be updated over the internal UART after performing the reset sequence, which puts it in bootloader mode. The real frustrating part was getting the damn updater to update the module. Atmel only supplies the necessary tools for Windows, as binaries, without source code. I don't have a Windows machine, and I don't really want one. I tried to find how on earth these tools work to maybe make my own, but I couldn't find any documentation whatsoever on that. After probably spending another half day or so there wasn't really any other chance left than bite the bullet and find a Windows VM and update the firmware from there. Once all the undocumented options for the updater tool were figured out the updating was actually done rather easily, which is at least something positive in that experience. 

With those problems sorted out, it was time to finally have it connect to my WiFi. Actually no, there were more problems. Talking to the module worked so far, but anything RF related resulted in all sorts of weird bus errors, again. I was expecting that it may be a power problem, but some measurements showed there wasn't any significant dip in supply voltage. To cut the story short, it was a faulty SPI implementation on my part. I basically built my SPI code on what was provided in an example in the SDK, turns out that particular example was different from all the other ones and resulted in really weird behaviour from the module on the SPI part. I don't really know what the problems was 'til this day, but at least I got that sorted. What a relief it was when the module debug UART finally showed a beautiful "(220)(M2M)WIFI Connected" message.

But hey, Murphy gets you every time, right? The IRQ line isn't working (what else would I expect?), so no messages whatsoever get to my host mcu. So there is the next debugging task for the week. I already figured some problems, but it's still dead. Let's see what stupid mistake it's this time.

TL;DR: Got my WiFi module, spend at least three days with debugging problems so far. But I'm getting there eventually.