Electronics
Adafruit FeatherM0_WiFi - WINC1500 Firmware Upgrade
The source code for the tutorials can be found on GitHub.
Why?
From time to time, if you update your Atmel Software Foundation (ASF), you might run into problems, if you try to run a new ASF project on you WINC1500. Your program might produce an error like this:
-- DIT Adafruit FeatherM0 ASF Turorials - 06_WINC1500 --
-- Adafruit FeatherM0-WiFi --
-- Compiled: Jun 11 2017 07:10:42 --
(APP)(INFO)Chip ID 1503a0
(APP)(DBG)[nm_spi_init][1250][nmi spi]: chipid (001003a0)
(APP)(INFO)DriverVerInfo: 0x13521352
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(INFO)Firmware ver : 19.4.4 Svnrev 48184
(APP)(INFO)Firmware Build Nov 19 2015 Time 22:36:45
(APP)(INFO)Firmware Min driver ver : 19.3.0
(APP)(INFO)Driver ver: 19.5.2
(APP)(INFO)Driver built at Jun 11 2017 07:10:39
(APP)(ERR)[m2m_wifi_init][487]Mismatch Firmawre Version
main: m2m_wifi_init call error!(-13)
ASF version / WINC1500 firmware matching
Each ASF driver version requires a specific WINC1500 firmware version.
And while the WINC1500 driver does not change with every ASF update, when it does you need to update the WINC1500 to the matching firmware.
This table shows, what WINC1500 firmware is used in what ASF version (as far as I could find out):
ASF | WINC1500 | |
---|---|---|
Vers. | FW | Chip Vers. |
3.34 | 19.5.2 | B only |
3.29 | 19.4.4 | A & B |
3.26 | 19.3.0 | A & B |
3.25 | 19.2.1 | A & B |
3.24 | 18.3.0 | A & B |
3.23 | 18.1.1 | A & B |
Be aware!
The last firmware version that will work on a version A
WINC1500 is 19.4.4.
If you are "blessed" with an older WINC1500 eXplained board you might still have a version A
chip.
Nothing stops you from upgrading this chip, but the WINC1500-A will not come up.
Trying to run an ASF project against it produces:
-- DIT Adafruit FeatherM0 ASF Turorials - 06_WINC1500 --
-- Adafruit FeatherM0-WiFi --
-- Compiled: Jun 11 2017 06:50:06 --
(APP)(ERR)[nm_drv_init][295][nmi start]: fail init bus
main: m2m_wifi_init call error!(-6)
At least there is no problem to downgrade the version A chip firmware after a failed attempt.
Upgrading a WINC1500 eXplained Board
If you are working on a WINC1500 eXplained board, you have several options for upgrading the firmware, that are described in detail in Integrated Serial Flash Memory Download Procedure
I ended up populating the Serial Debug port, mainly because I run into the error!(-6)
problem and thought at first it was an upgrade method problem.
Here some additional info for this method, that I found in a thread of the Atmel community.
Firmware Upload without MCU or directly with PCs UART interface:
----------------------------------------------------------------------------------------
Please follow the steps to download the firmware without any MCU:
1. ATINC1500 UART interface pins Rx, TX, and GND to be connected to PC. Since ATWINC1500 UART is TTL level output, please take care about the RS232 converter to connect to the PCs COM port.
2. RESET_N and CHIP_EN pins to connected to GND to make it low while ATWINC1500 power up.
3. Power up the ATWINC1500 module with VCC 3.3 V and GND.
4. After the power up, CHIP_EN pin to be connected VCC 3.3V to make it high.
5. RESET_N pin to be connected to be VCC 3.3 V to make it high.
6. Once above mentioned procedure is done, Open the command prompt with folder path "WINC1500_FIRMWARE_UPDATE\src\firmware" folder.
7. run the command "download_all.bat UART", you can see the firmware update process in the window. First it will detect the COM port and will begin the download of the firmware.
8. After completion of firmware download, open "WINC1500_FIRMWARE_UPDATE\src\firmware\Tools\root_certificate_downloader\debug_uart" from cmd prompt, to download the root certificate to the ATWINC1500.
Note: RESET and CHIP_EN pins, low and high process important in this procedure.
Perform the following power sequence up sequence on CHIPEN and RESETN:
- pio_set_pin_low(CONF_WINC_PIN_CHIP_ENABLE);
- pio_set_pin_low(CONF_WINC_PIN_RESET);
- nm_bsp_sleep(100);
- Power up the board (Vcc-Gnd)
- pio_set_pin_high(CONF_WINC_PIN_CHIP_ENABLE);
- nm_bsp_sleep(100);
- pio_set_pin_high(CONF_WINC_PIN_RESET);
- nm_bsp_sleep(100);
- Run the "download_all.bat UART" command in the firmware folder
Upgrading a FeatherM0_WiFi
If your bootloader on the FeatherM0_WiFi is still working (or you can get it back working again), than you can use the Adafruit "Updating Firmware" method.
Otherwise an "Over the Air" upgrade is the only choice left, since the Adafruit FeatherM0_WiFi designers did not brake out the serial debug port of the WINC1500 module.
Over the Air WINC1500 firmware upgrade
- Set up a http-server, that can be reached from within your WiFi network.
If you do not have a http-server running yet, there is wide range of choices on the internet or you can use the very simple one I implemented in Lazarus, that can be found in my GitHub project.
Make sure you open the firewall port on the computer running the server. Maybe try to fetch the test-page with a web-browser, before getting on with the over-the-air-upgrade.
- In Atmel Studio create a
WINC1500_OTA_FIRMWARE_UPGRADE_EXAMPLE
with the ASF version for the firmware version your WINC1500 should be upgraded to.Do NOT burn this onto the FeatherM0_WiFi MCU, since this project will not yet run with your current WINC1500 firmware.
Since I wanted to upgrade from 19.4.4 to 19.5.2, I used the
WINC1500_OTA_FIRMWARE_UPGRADE_EXAMPLE
of ASF 3.34 (first version supporting 19.5.2 FW). - Extract the new WINC1500 firmware binary from the project directory
WINC1500_OTA_FIRMWARE_UPGRADE_EXAMPLE\Debug\src\firmware
.It is usually called something like
m2m_ota_3a0.bin
. - In Atmel Studio create a
WINC1500_OTA_FIRMWARE_UPGRADE_EXAMPLE
with the ASF version for the firmware version your WINC1500 is currently on.Since I wanted to upgrade from 19.4.4 to 19.5.2, I used the
WINC1500_OTA_FIRMWARE_UPGRADE_EXAMPLE
of ASF 3.33 (last version supporting 19.4.4 FW). - In
main.h
configure the WiFi access and the URL of a http-server to download the new firmware from. - Remember to connect a serial console to the FatherM0.
It will show debug messages during the upgrade.
- Burn the
WINC1500_OTA_FIRMWARE_UPGRADE_EXAMPLE
to the FeatherM0_WiFi.
Everything done right, the serial console should show something similar to this:
-- DIT Adafruit FeatherM0 ASF Turorials - WINC1500 OTA Firmware Upgrade --
-- Adafruit FeatherM0-WiFi --
-- Compiled: Jun 13 2017 05:53:07 --
-- Configured SSID: Drechsler --
-- OTA URL: http://192.168.0.18/winc1500_type_b_ota_19.3.2_asf_3.34_3a0.bin --
main: nm_bsp_init
main: m2m_wifi_init
(APP)(INFO)Chip ID 1503a0
(APP)(DBG)[nm_spi_init][736][nmi spi]: chipid (001003a0)
(APP)(DBG)[wait_for_firmware_start][531]ffff0000 ffff0000 2
(APP)(DBG)[wait_for_firmware_start][531]ffff0000 ffff0000 2
(APP)(DBG)[wait_for_firmware_start][531]ffff0000 ffff0000 2
(APP)(DBG)[wait_for_firmware_start][531]ffff0000 ffff0000 2
(APP)(DBG)[wait_for_firmware_start][531]ffff0000 ffff0000 2
(APP)(DBG)[wait_for_firmware_start][531]ffff0000 ffff0000 2
(APP)(INFO)Firmware ver : 19.4.4
(APP)(INFO)Min driver ver : 19.3.0
(APP)(INFO)Curr driver ver: 19.4.4
main: m2m_ota_init
main: m2m_wifi_request_scan( all channels )
wifi_cb: m2m_wifi_req_scan_result( 0 )
[0] SSID:Drechsler
Found Drechsler
wifi_cb: m2m_wifi_connect
wifi_cb: m2m_wifi_request_dhcp_client
Wi-Fi connected
Wi-Fi IP is 192.168.0.14
wifi_cb: m2m_ota_start_update
OtaUpdateCb: 1 0
OtaUpdateCb: m2m_ota_switch_firmware start
OtaUpdateCb: 2 0
OtaUpdateCb: OTA Success. Press RESET on your board.
After a successful upgrade, running an ASF 3.34 project will produce debug messages like this:
-- DIT Adafruit FeatherM0 ASF Turorials - 06_WINC1500 --
-- Adafruit FeatherM0-WiFi --
-- Compiled: Jun 11 2017 07:10:42 --
(APP)(INFO)Chip ID 1503a0
(APP)(DBG)[nm_spi_init][1250][nmi spi]: chipid (001003a0)
(APP)(INFO)DriverVerInfo: 0x13521352
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]13521352 13521352 102
(APP)(DBG)[wait_for_firmware_start][490]2532636 2532636 102
(APP)(INFO)Firmware ver : 19.5.2 Svnrev 14274
(APP)(INFO)Firmware Build Jan 26 2017 Time 22:13:34
(APP)(INFO)Firmware Min driver ver : 19.3.0
(APP)(INFO)Driver ver: 19.5.2
(APP)(INFO)Driver built at Jun 11 2017 07:10:39