Skip to content

Commit 351700e

Browse files
committed
wifinina: add information about Adafruit boards with ESP32 wifi coprocessors, and modify examples to remove code that was both not being used, and also prevented many Adafruit boards from being able to be targeted by the examples
Signed-off-by: deadprogram <[email protected]>
1 parent cbcb62a commit 351700e

File tree

7 files changed

+16
-39
lines changed

7 files changed

+16
-39
lines changed

examples/wifinina/mqttclient/main.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ const server = "tcp://test.mosquitto.org:1883"
3535
var (
3636

3737
// these are the default pins for the Arduino Nano33 IoT.
38-
uart = machine.UART2
39-
tx = machine.NINA_TX
40-
rx = machine.NINA_RX
41-
spi = machine.NINA_SPI
38+
spi = machine.NINA_SPI
4239

4340
// this is the ESP chip that has the WIFININA firmware flashed on it
4441
adaptor *wifinina.Device
@@ -48,7 +45,6 @@ var (
4845
func main() {
4946
time.Sleep(3000 * time.Millisecond)
5047

51-
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
5248
rand.Seed(time.Now().UnixNano())
5349

5450
// Configure SPI for 8Mhz, Mode 0, MSB First
@@ -94,7 +90,7 @@ func main() {
9490
println(err.Error())
9591
}
9692
}
97-
time.Sleep(1 * time.Millisecond)
93+
time.Sleep(100 * time.Millisecond)
9894
}
9995

10096
// Right now this code is never reached. Need a way to trigger it...

examples/wifinina/mqttsub/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,8 @@ const server = "tcp://test.mosquitto.org:1883"
3232

3333
// change these to connect to a different UART or pins for the ESP8266/ESP32
3434
var (
35-
3635
// these are the default pins for the Arduino Nano33 IoT.
37-
uart = machine.UART2
38-
tx = machine.NINA_TX
39-
rx = machine.NINA_RX
40-
spi = machine.NINA_SPI
36+
spi = machine.NINA_SPI
4137

4238
// this is the ESP chip that has the WIFININA firmware flashed on it
4339
adaptor *wifinina.Device
@@ -55,7 +51,6 @@ func subHandler(client mqtt.Client, msg mqtt.Message) {
5551
func main() {
5652
time.Sleep(3000 * time.Millisecond)
5753

58-
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
5954
rand.Seed(time.Now().UnixNano())
6055

6156
// Configure SPI for 8Mhz, Mode 0, MSB First

examples/wifinina/ntpclient/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,14 @@ const NTP_PACKET_SIZE = 48
2828
var (
2929

3030
// these are the default pins for the Arduino Nano33 IoT.
31-
uart = machine.UART2
32-
tx = machine.NINA_TX
33-
rx = machine.NINA_RX
34-
spi = machine.NINA_SPI
31+
spi = machine.NINA_SPI
3532

3633
// this is the ESP chip that has the WIFININA firmware flashed on it
3734
adaptor *wifinina.Device
3835
b = make([]byte, NTP_PACKET_SIZE)
3936
)
4037

4138
func setup() {
42-
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
43-
4439
// Configure SPI for 8Mhz, Mode 0, MSB First
4540
spi.Configure(machine.SPIConfig{
4641
Frequency: 8 * 1e6,

examples/wifinina/tcpclient/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ const serverIP = ""
2929
var (
3030

3131
// these are the default pins for the Arduino Nano33 IoT.
32-
uart = machine.UART2
33-
tx = machine.NINA_TX
34-
rx = machine.NINA_RX
35-
spi = machine.NINA_SPI
32+
spi = machine.NINA_SPI
3633

3734
// this is the ESP chip that has the WIFININA firmware flashed on it
3835
adaptor *wifinina.Device
@@ -42,8 +39,6 @@ var buf = &bytes.Buffer{}
4239

4340
func main() {
4441

45-
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
46-
4742
// Configure SPI for 8Mhz, Mode 0, MSB First
4843
spi.Configure(machine.SPIConfig{
4944
Frequency: 8 * 1e6,

examples/wifinina/tlsclient/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ const server = "tinygo.org"
3030
var (
3131

3232
// these are the default pins for the Arduino Nano33 IoT.
33-
uart = machine.UART2
34-
tx = machine.NINA_TX
35-
rx = machine.NINA_RX
36-
spi = machine.NINA_SPI
33+
spi = machine.NINA_SPI
3734

3835
// this is the ESP chip that has the WIFININA firmware flashed on it
3936
adaptor *wifinina.Device
@@ -45,8 +42,6 @@ var lastRequestTime time.Time
4542
var conn net.Conn
4643

4744
func setup() {
48-
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
49-
5045
// Configure SPI for 8Mhz, Mode 0, MSB First
5146
spi.Configure(machine.SPIConfig{
5247
Frequency: 8 * 1e6,

examples/wifinina/webclient/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ const server = "tinygo.org"
2727
var (
2828

2929
// these are the default pins for the Arduino Nano33 IoT.
30-
uart = machine.UART2
31-
tx = machine.NINA_TX
32-
rx = machine.NINA_RX
33-
spi = machine.NINA_SPI
30+
spi = machine.NINA_SPI
3431

3532
// this is the ESP chip that has the WIFININA firmware flashed on it
3633
adaptor *wifinina.Device
@@ -42,8 +39,6 @@ var lastRequestTime time.Time
4239
var conn net.Conn
4340

4441
func setup() {
45-
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
46-
4742
// Configure SPI for 8Mhz, Mode 0, MSB First
4843
spi.Configure(machine.SPIConfig{
4944
Frequency: 8 * 1e6,

wifinina/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ For information on how to use this driver, please take a look at the examples lo
1010

1111
## nina-fw Firmware
1212

13-
**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.**
13+
**PLEASE NOTE: New Adafruit Boards with WiFi and Arduino Nano33 IoT boards most likely already have a recent version of the nina-fw firmware pre-installed. You should not need to install the firmware yourself.**
1414

15-
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.
15+
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. The following instructions are only for those who want or need to update the firmware on your board.
1616

1717
### Installing esptool to flash nina-fw firmware
1818

@@ -24,7 +24,7 @@ pip install esptool
2424

2525
Once you have installed `esptool` you can follow the correct procedure for flashing your board.
2626

27-
### Updating the Arduino Nano33 IoT
27+
### Updating nina-fw on the Arduino Nano33 IoT
2828

2929
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.
3030

@@ -48,3 +48,9 @@ esptool --port /dev/ttyACM0 --before default_reset --baud 115200 write_flash 0 .
4848
```
4949

5050
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.
51+
52+
## Updating Adafruit ESP32 WiFi Boards
53+
54+
Adafruit provides very good instructions for updating their boards that provide a ESP32 WiFi-BLE co-processor. For more information, please see:
55+
56+
https://learn.adafruit.com/upgrading-esp32-firmware

0 commit comments

Comments
 (0)