From cbcb62af0104bc8feadff06dc7b0905d8d43f4ed Mon Sep 17 00:00:00 2001 From: deadprogram Date: Tue, 11 May 2021 18:04:04 +0200 Subject: [PATCH] wifinina: update docs to simplify the nina-fw update process Signed-off-by: deadprogram --- wifinina/README.md | 52 ++++++++---------- .../SerialNINAPassthrough.ino.nano_33_iot.bin | Bin 0 -> 11468 bytes wifinina/updater/update_ninafw.sh | 15 +++++ 3 files changed, 37 insertions(+), 30 deletions(-) create mode 100755 wifinina/updater/SerialNINAPassthrough.ino.nano_33_iot.bin create mode 100755 wifinina/updater/update_ninafw.sh diff --git a/wifinina/README.md b/wifinina/README.md index 2239973..e9b7b5f 100644 --- a/wifinina/README.md +++ b/wifinina/README.md @@ -8,24 +8,13 @@ The way this driver works is by using the SPI interface of your microcontroller For information on how to use this driver, please take a look at the examples located in the [examples/wifinina](../examples/wifinina) directory. -## WiFiNINA Firmware Installation +## nina-fw Firmware -**PLEASE NOTE: New Arduino Nano33 IoT boards already have the WiFiNINA firmware pre-installed, so you should not need to install the firmware yourself.** +**PLEASE NOTE: New Arduino Nano33 IoT boards most likely already have a recent version of the nina-fw firmware pre-installed, so you should not need to install the firmware yourself.** -In order to use this driver, you must have the WiFiNINA firmware installed on the ESP32 chip. If it is already installed, you can just use it. You do not need to build and flash the firmware again. +In order to use this driver, you must have the nina-fw firmware installed on the ESP32 chip. If it is already installed, you can just use it. You do not need to flash the firmware again. -### Building the WifiNINA firmware - -We have provided a Dockerfile that can build the needed firmware. - -```shell -docker build -t wifinina ./wifinina/ -docker run -v "$(pwd)/build:/src/build" wifinina -``` - -This will put the firmware files into the `build` directory. Now you can flash them to the ESP32 chip. - -### Installing esptool to flash WifiNINA firmware +### Installing esptool to flash nina-fw firmware In order to flash the firmware, you need to use Python to install the `esptool` package. @@ -35,24 +24,27 @@ pip install esptool Once you have installed `esptool` you can follow the correct procedure for flashing your board. -### Installing on Arduino Nano33 IoT +### Updating the Arduino Nano33 IoT -The Arduino Nano33 IoT board has the WiFiNINA firmware flashed onto the onboard NINA-W102 chip out of the box. +In the `updater` directory we have a precompiled binary of the "passthrough" code you will need to flash first, in order to update the ESP32 co-processor on your board. -Flashing the firmware is only necessary on the Arduino Nano33 IoT in order to upgrade or if other firmware was installed previously. - -If you do want to install the firmware on the Arduino Nano33 IoT board's built-in NINA-W102 chip, you will need to first build the firmware as described above. - -To flash this firmware on the Arduino Nano33 IoT you will need to follow the following procedure using the Arduino IDE software: - -- Install _Arduino SAMD Boards_ from the Boards Manager. -- Install _WiFiNINA_ from the Library Manager. -- Using the normal Arduino software, load the `SerialNINAPassthrough` sketch on to the board (in File -> Examples -> WiFiNINA-> Tools). - -Now you can flash the WifiNINA firmware using the `esptool` script: +This is what needs to be done. There is also a bash script that performs the same steps also located in the `updater` directory. ```shell -python esptool.py --chip esp32 --port /dev/ttyACM0 --baud 115200 --before no_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 build/bootloader.bin 0xf000 build/phy_init_data.bin 0x30000 build/nina-fw.bin 0x8000 build/partitions.bin +mkdir -p ../build + +# reset board into bootloader mode using 1200 baud +stty -F /dev/ttyACM0 ispeed 1200 ospeed 1200 + +# flash the passthru binary to the SAMD21 using bossac +# code from https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/Tools/SerialNINAPassthrough/SerialNINAPassthrough.ino +bossac -d -i -e -w -v -R --port=/dev/ttyACM0 --offset=0x2000 ./SerialNINAPassthrough.ino.nano_33_iot.bin + +# download the nina-fw binary +wget -P ../build/ https://github.com/arduino/nina-fw/releases/download/1.4.5/NINA_W102-v1.4.5.bin + +# flash the nina-fw binary to the ESP32 using esptool +esptool --port /dev/ttyACM0 --before default_reset --baud 115200 write_flash 0 ../build/NINA_W102-v1.4.5.bin ``` -You only need to do this one time, and then the correct WiFiNINA firmware will be on the NINA chip, and you can just flash the Arduino Nano33 IoT board using TinyGo. We should be able to remove some of these steps in a future release of this software. +You only need to do this one time, and then the correct nina-fw firmware will be on the NINA ESP32 chip, and you can just flash the Arduino Nano33 IoT board using TinyGo. diff --git a/wifinina/updater/SerialNINAPassthrough.ino.nano_33_iot.bin b/wifinina/updater/SerialNINAPassthrough.ino.nano_33_iot.bin new file mode 100755 index 0000000000000000000000000000000000000000..ce93ac98f120b91efb3c1ebf522869d94ac01653 GIT binary patch literal 11468 zcmcI~eS8zwvFMy#$(AhHmMuP3vN76SnyQ zZHr7xB5=|daMK2y_6Js)5}^5!kTled@|xSYaY}Dr32mQ*lNNB&5};3gP130OlE6m$ z=B#Xo^tSiExBeZU**SCO%$YN1&dgas7+ek!fJ_$nFCI!W^-#F$hJI81Z>){~(7spz zn1_YZ%$%%mq^B@_{tzY9fuu>}6;lgI{xL&%rwfvXal)5i4dau2T;(jd zzCpm1j#jt20Fqj!>b3^upwAkkZ)xn;=si6|`_zq7%m0sEAuZ!%#LwV&Wg(b2FT;M^nwFNsntNN1u_7S&+(KAvk+6MIYf4V zG%y3R8Yq5-XSPrUHf*_^F`i7)H8p|HfO7>a_)J(^DQp9ujn*^32ORijAk5MCQt;6^ z(RonWGYJ3|?W9BjH^dG$(>a$Sof<9l7q&j-GsGdeH_aq}kj^Bmt3Z6z_i5~P?l0UC zpK;V2+~fNoX7+<%xCn~DW0U`$Fr4c5O^jYauHd4!Sc7&(>y2irH%Q89s3geqjt1$Hkv@QAWWAwM`!u-yBlrWMM7uOL3`v&O&a z%NuQXT$|UTJP+S2$!)n$QYFYA;WEQt06XNs<%A38V7rL>;(fSy=bZp*)KF%NX{j@s z5j9_$)>6OHj6rY7L0{_pHIdvBf%iF>|504U`6pPUZ>IZ$4cHapvCEL$igrPHBAyl~ z6Oz%}Tkh~n${ni)BquPUU6N#zxUbVLWrY3?w{n(^Fm`VsV3z`cfet$ugtwF#zKIwq zZw|~*XN4+!Z0xSk*M?wWdW@7mF0Tu18G`xaV~wrrrr|y1SID~XR0~u7#6t!3e^e@v z%hJ}jHrdLv@O)9-MDEaf-IQo4;_UGEK7lx`~B_M%j}i4_Orvfx^IZ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v4@NYK$67%Xb{-C6o8$gWO z>`-Z*O>GNf-YQ$nI#-HpYNkM zr?e}L954SZVTU#a^XS+S-_`RDWj%Kozqz;+Gq;{|$a{Pj<2GdtQaa=|`9k8bk2!A@ z-SV3W%4ZK+bGDV2H_032*U`>e(Uw_JjsCXu`;uvK4pZMm%wfUzv8vRhSh+az$Dyb;qq@4R~Zou1T{OVZom+SVequslyhfy~Oc` z#m%0#$iLy{$?V0T@-1I}+%D6;4QUtT3YHpi&STOkXCl_-yL9`N#AewFA0({cS575Z z@t37fNQZsz#CRv|VZzbI;{R(>?%PpzK-qIzjrciJ#PMffI~&(E8*}4#nUSXTI?XRO z5)b}jBfh?jS_X|l47$D{&Ia-O4}Phk_OcFX>F<@&(UGR~E2dYTMC-Z{Cb%DGV_~tN z*8vUi{u8f1DIW9je~QmTya@~5lps9@6vjNA-tsv-F%l!i;5W7#@VP+n!Cv^F)lBoj zn>+l=;;9@{{3)!Dg8y@{P&~!uOv;HM6l0mfPsva5_`OWW6T#ahp=f=kR!X>iYag`oe!fU-F;mDP@+&KU+s?Xa5XO?em89GJqkg zaca+>;i(>|1!C-qB}?)7c{%dS=)}P=v*DkE@z#?Md5&x(gfPRam z-`)&G8g*XlC(^&N97r5glA9_zX1q0%##_4+{fGbP<|L_0XIKmeN06*&CWt1(7@Ba^n CI6jsD literal 0 HcmV?d00001 diff --git a/wifinina/updater/update_ninafw.sh b/wifinina/updater/update_ninafw.sh new file mode 100755 index 0000000..b1ed4ea --- /dev/null +++ b/wifinina/updater/update_ninafw.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +mkdir -p ../build + +# flash the passthru binary to the SAMD21 using bossac +# code from https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/Tools/SerialNINAPassthrough/SerialNINAPassthrough.ino +stty -F /dev/ttyACM0 ispeed 1200 ospeed 1200 +bossac -d -i -e -w -v -R --port=/dev/ttyACM0 --offset=0x2000 ./SerialNINAPassthrough.ino.nano_33_iot.bin + +# download the nina-fw binary +wget -P ../build/ https://github.com/arduino/nina-fw/releases/download/1.4.5/NINA_W102-v1.4.5.bin + +# flash the nina-fw binary to the ESP32 using esptool +esptool --port /dev/ttyACM0 --before default_reset --baud 115200 write_flash 0 ../build/NINA_W102-v1.4.5.bin +