mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-06 16:03:41 +00:00
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 <ron@hybridgroup.com>
This commit is contained in:
@@ -35,10 +35,7 @@ const server = "tcp://test.mosquitto.org:1883"
|
||||
var (
|
||||
|
||||
// these are the default pins for the Arduino Nano33 IoT.
|
||||
uart = machine.UART2
|
||||
tx = machine.NINA_TX
|
||||
rx = machine.NINA_RX
|
||||
spi = machine.NINA_SPI
|
||||
spi = machine.NINA_SPI
|
||||
|
||||
// this is the ESP chip that has the WIFININA firmware flashed on it
|
||||
adaptor *wifinina.Device
|
||||
@@ -48,7 +45,6 @@ var (
|
||||
func main() {
|
||||
time.Sleep(3000 * time.Millisecond)
|
||||
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
// Configure SPI for 8Mhz, Mode 0, MSB First
|
||||
@@ -94,7 +90,7 @@ func main() {
|
||||
println(err.Error())
|
||||
}
|
||||
}
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
// Right now this code is never reached. Need a way to trigger it...
|
||||
|
||||
@@ -32,12 +32,8 @@ const server = "tcp://test.mosquitto.org:1883"
|
||||
|
||||
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
||||
var (
|
||||
|
||||
// these are the default pins for the Arduino Nano33 IoT.
|
||||
uart = machine.UART2
|
||||
tx = machine.NINA_TX
|
||||
rx = machine.NINA_RX
|
||||
spi = machine.NINA_SPI
|
||||
spi = machine.NINA_SPI
|
||||
|
||||
// this is the ESP chip that has the WIFININA firmware flashed on it
|
||||
adaptor *wifinina.Device
|
||||
@@ -55,7 +51,6 @@ func subHandler(client mqtt.Client, msg mqtt.Message) {
|
||||
func main() {
|
||||
time.Sleep(3000 * time.Millisecond)
|
||||
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
// Configure SPI for 8Mhz, Mode 0, MSB First
|
||||
|
||||
@@ -28,10 +28,7 @@ const NTP_PACKET_SIZE = 48
|
||||
var (
|
||||
|
||||
// these are the default pins for the Arduino Nano33 IoT.
|
||||
uart = machine.UART2
|
||||
tx = machine.NINA_TX
|
||||
rx = machine.NINA_RX
|
||||
spi = machine.NINA_SPI
|
||||
spi = machine.NINA_SPI
|
||||
|
||||
// this is the ESP chip that has the WIFININA firmware flashed on it
|
||||
adaptor *wifinina.Device
|
||||
@@ -39,8 +36,6 @@ var (
|
||||
)
|
||||
|
||||
func setup() {
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
|
||||
// Configure SPI for 8Mhz, Mode 0, MSB First
|
||||
spi.Configure(machine.SPIConfig{
|
||||
Frequency: 8 * 1e6,
|
||||
|
||||
@@ -29,10 +29,7 @@ const serverIP = ""
|
||||
var (
|
||||
|
||||
// these are the default pins for the Arduino Nano33 IoT.
|
||||
uart = machine.UART2
|
||||
tx = machine.NINA_TX
|
||||
rx = machine.NINA_RX
|
||||
spi = machine.NINA_SPI
|
||||
spi = machine.NINA_SPI
|
||||
|
||||
// this is the ESP chip that has the WIFININA firmware flashed on it
|
||||
adaptor *wifinina.Device
|
||||
@@ -42,8 +39,6 @@ var buf = &bytes.Buffer{}
|
||||
|
||||
func main() {
|
||||
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
|
||||
// Configure SPI for 8Mhz, Mode 0, MSB First
|
||||
spi.Configure(machine.SPIConfig{
|
||||
Frequency: 8 * 1e6,
|
||||
|
||||
@@ -30,10 +30,7 @@ const server = "tinygo.org"
|
||||
var (
|
||||
|
||||
// these are the default pins for the Arduino Nano33 IoT.
|
||||
uart = machine.UART2
|
||||
tx = machine.NINA_TX
|
||||
rx = machine.NINA_RX
|
||||
spi = machine.NINA_SPI
|
||||
spi = machine.NINA_SPI
|
||||
|
||||
// this is the ESP chip that has the WIFININA firmware flashed on it
|
||||
adaptor *wifinina.Device
|
||||
@@ -45,8 +42,6 @@ var lastRequestTime time.Time
|
||||
var conn net.Conn
|
||||
|
||||
func setup() {
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
|
||||
// Configure SPI for 8Mhz, Mode 0, MSB First
|
||||
spi.Configure(machine.SPIConfig{
|
||||
Frequency: 8 * 1e6,
|
||||
|
||||
@@ -27,10 +27,7 @@ const server = "tinygo.org"
|
||||
var (
|
||||
|
||||
// these are the default pins for the Arduino Nano33 IoT.
|
||||
uart = machine.UART2
|
||||
tx = machine.NINA_TX
|
||||
rx = machine.NINA_RX
|
||||
spi = machine.NINA_SPI
|
||||
spi = machine.NINA_SPI
|
||||
|
||||
// this is the ESP chip that has the WIFININA firmware flashed on it
|
||||
adaptor *wifinina.Device
|
||||
@@ -42,8 +39,6 @@ var lastRequestTime time.Time
|
||||
var conn net.Conn
|
||||
|
||||
func setup() {
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
|
||||
// Configure SPI for 8Mhz, Mode 0, MSB First
|
||||
spi.Configure(machine.SPIConfig{
|
||||
Frequency: 8 * 1e6,
|
||||
|
||||
+9
-3
@@ -10,9 +10,9 @@ For information on how to use this driver, please take a look at the examples lo
|
||||
|
||||
## nina-fw Firmware
|
||||
|
||||
**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.**
|
||||
**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.**
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
### Installing esptool to flash nina-fw firmware
|
||||
|
||||
@@ -24,7 +24,7 @@ pip install esptool
|
||||
|
||||
Once you have installed `esptool` you can follow the correct procedure for flashing your board.
|
||||
|
||||
### Updating the Arduino Nano33 IoT
|
||||
### Updating nina-fw on the Arduino Nano33 IoT
|
||||
|
||||
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.
|
||||
|
||||
@@ -48,3 +48,9 @@ esptool --port /dev/ttyACM0 --before default_reset --baud 115200 write_flash 0 .
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
## Updating Adafruit ESP32 WiFi Boards
|
||||
|
||||
Adafruit provides very good instructions for updating their boards that provide a ESP32 WiFi-BLE co-processor. For more information, please see:
|
||||
|
||||
https://learn.adafruit.com/upgrading-esp32-firmware
|
||||
|
||||
Reference in New Issue
Block a user