Trouble upgrading AirLift firmware...

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
acadie4me
 
Posts: 4
Joined: Sat Mar 11, 2023 6:09 pm

Trouble upgrading AirLift firmware...

Post by acadie4me »

I recently purchased an AirLift breakout board that arrived with firmware 1.2.2. I eventually succeeded in upgrading to firmware 1.7.4 by using a Metro M4 that I removed from another project.

The troubles I had all stemmed from the web page describing how to upgrade the firmware on the ESP32, using a Metro M4:

https://learn.adafruit.com/upgrading-es ... firmware-2

On that page, scroll down to the section labeled: Upgrading an External AirLift Breakout
The instructions say:
"First, make the following connections between the board and the AirLift Breakout
Board Pin 12 to ESP32_ResetN
Board Pin 10 to ESP32 GPIO0
Board TX to RXI
Board RX to TX0
Next, download the Arduino sketch below."

Unfortunately, the Arduino sketch required some corrections:
1) The sketch sometimes uses PIN_NEOPIXEL and sometimes uses NEOPIXEL_PIN as a label intended for one PIN. I had to make this consistent in order to get the sketch to compile correctly.

2) The sketch does not use the same connections as the instructions above, but that was easily rectified. More problematic was the setting of GPIO0 to -1, thus disabling it. Script fails completely with GPIO0 set to -1. This must be set to the actual Metro M4 pin you used to connect to GPIO0 on the ESP32.

I also suspect the #define's for SPIWIFI and SPIWIFI_SS and SPIWIFI_ACK are not needed or used. The web page actually goes to the trouble of repeating the entire erroneous block of #defines. Why not have the #define's correspond to the instructions given for making the physical connections? You could still warn users to change the pin numbers to whatever they are using....

User avatar
mwomack
 
Posts: 24
Joined: Sat Sep 26, 2015 3:12 pm

Re: Trouble upgrading AirLift firmware...

Post by mwomack »

I am attempting to upgrade the firmware on my AirLift breakout board, and I took the suggestions from the above post to modify the code. I am trying to use a Teensy 4.0 to upload the firmware, but I am running into errors. The web ESPTool is able to connect to the Teensy, but it gets errors, here is a sample of two attempts:

Code: Select all

Connecting...
Connected successfully.
Try hard reset.
[Object.debug:191] Finished read loop
Error: Couldn't sync to ESP. Try resetting.

Connecting...
Connected successfully.
Try hard reset.
[Object.debug:191] Finished read loop
Error: Invalid head of packet (0x1D)
The output from the AirLift over serial looks like this:

Code: Select all

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x3 (D� UU��
The 'cleaned' up code I am using is:

Code: Select all

unsigned long baud = 115200;

#define SerialESP32   Serial1
#define ESP32_RESETN   8   // Reset pin
#define ESP32_GPIO0    7

void setup() {
  Serial.begin(baud);
  while (!Serial);

  delay(100);
  SerialESP32.begin(baud);

  pinMode(ESP32_GPIO0, OUTPUT);
  pinMode(ESP32_RESETN, OUTPUT);
  
  // manually put the ESP32 in upload mode
  digitalWrite(ESP32_GPIO0, LOW);

  digitalWrite(ESP32_RESETN, LOW);
  delay(100);
  digitalWrite(ESP32_RESETN, HIGH);
  delay(100);
}

void loop() {
  while (Serial.available()) {
    SerialESP32.write(Serial.read());
  }

  while (SerialESP32.available()) {
    Serial.write(SerialESP32.read());
  }
}
And yes, I do have RX->TXO and TX->RXI
Maybe I'm not allowed to use a Teensy 4.0 for the upgrade?
Any suggestions?

-Mark

User avatar
mwomack
 
Posts: 24
Joined: Sat Sep 26, 2015 3:12 pm

Re: Trouble upgrading AirLift firmware...

Post by mwomack »

I also tried to use an Arduino Uno (the only other microcontroller I have) using SoftwareSerial to connect to the AirLift. The ESPTool can't open the serial port.

So, I guess I am stuck at and impasse.

-Mark

User avatar
acadie4me
 
Posts: 4
Joined: Sat Mar 11, 2023 6:09 pm

Re: Trouble upgrading AirLift firmware...

Post by acadie4me »

Reply to "mwomack":

I had symptoms identical to yours, and I compared our Arduino scripts, and noticed this additional line in mine:

pinMode(SPIWIFI_SS, OUTPUT);

I added that line just above the other pinMode lines, so that:

pinMode(SPIWIFI_SS, OUTPUT);
pinMode(ESP32_GPIO0, OUTPUT);
pinMode(ESP32_RESETN, OUTPUT);

You should also verify that you have the correct #define where all the other #defines reside. In
my code it looks like this:

#define SerialESP32 Serial1
#define SPIWIFI SPI
#define SPIWIFI_SS 10 // Chip select pin
#define SPIWIFI_ACK -1 // a.k.a BUSY or READY pin (not used)
#define ESP32_RESETN 5 // Reset pin
#define ESP32_GPIO0 7 // Had to change this to an actual pin. Originally was set to -1

All the unnecessary verbiage before this block, is an attempt to automatically assign SPIWIFI_SS, based on the board in use. You can just ignore all that, since you are using a USB-to-serial program on a microcontroller, and you need to make the pin assignments on your own. So long as you #define SPIWIFI_SS after all that verbiage, you should be fine.

Please let me know if this solves your issue...

I have never gotten an assist on this from Adafruit. The web page and their Arduino code needs some changes!

User avatar
mwomack
 
Posts: 24
Joined: Sat Sep 26, 2015 3:12 pm

Re: Trouble upgrading AirLift firmware...

Post by mwomack »

acadie4me,

Thank you for that help. I went ahead and connected all of the SPI pins as well as the CS pin, added that pinMode call, and it finally worked!

Here is my working code, which I think should work for just about any microcontroller as long as you set the pin definitions to the pins used and use the default SPI pins:

Code: Select all

unsigned long baud = 115200;

#define SerialESP32   Serial1
#define SPIWIFI       SPI
#define SPIWIFI_SS    10 // Chip select pin
#define SPIWIFI_ACK    6 // a.k.a BUSY or READY pin (not used)
#define ESP32_RESETN   8   // Reset pin
#define ESP32_GPIO0    7

void setup() {
  Serial.begin(baud);
  while (!Serial);

  delay(100);
  SerialESP32.begin(baud);

  pinMode(SPIWIFI_SS, OUTPUT);
  pinMode(ESP32_GPIO0, OUTPUT);
  pinMode(ESP32_RESETN, OUTPUT);
  
  // manually put the ESP32 in upload mode
  digitalWrite(ESP32_GPIO0, LOW);

  digitalWrite(ESP32_RESETN, LOW);
  delay(100);
  digitalWrite(ESP32_RESETN, HIGH);
  delay(100);
}

void loop() {
  while (Serial.available()) {
    SerialESP32.write(Serial.read());
  }

  while (SerialESP32.available()) {
    Serial.write(SerialESP32.read());
  }
}
It doesn't have the fancy neopixel color changes, but there is enough feedback from the ESPTool that you know it is doing something and you know when it is done.

Just for reference, the pin connections for my Teensy 4.0/Airlift were:

Code: Select all

Teensy  Airlift
     6->BUSY
     7->GP0
     8->RST
    10->CS
    11->MOSI
    12->MISO
    13->SCK
All other connections were 3.3v and GND. As you said, I don't know if all of those connections are needed, but I figured they might be. And now it works.

Thanks again!

(If any Adafruit reps are reading this, I +1 acadie4me's assessment that the information page on upgrading is in sore need of revision. At least the non-Metro/Adafruit controller section.)

User avatar
mwomack
 
Posts: 24
Joined: Sat Sep 26, 2015 3:12 pm

Re: Trouble upgrading AirLift firmware...

Post by mwomack »

I forgot the other two important connections:

Code: Select all

Teensy  AirLift
     0->TXO
     1->RXI

User avatar
topherhunter
 
Posts: 19
Joined: Sun Sep 23, 2018 3:50 pm

Re: Trouble upgrading AirLift firmware...

Post by topherhunter »

Hey all, just thought I'd note that this worked for me as well. Grand Central M4 with the Airlift Shield.

Despite what the Adafruit guide says, I ended up soldering all jumpers and set GPIO0 to pin 6. I used the Arduino IDE + web ESPTool method.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”