ESP32-S3 QT PY stuck in Bootloader mode

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sirgeoph
 
Posts: 3
Joined: Sat Nov 05, 2022 4:20 pm

ESP32-S3 QT PY stuck in Bootloader mode

Post by sirgeoph »

Hi! I have 3 ESP32-S3s and all is fine out of the box. I was testing some example sketches on one board and everything worked great. Decided to poke around the FunctionalInterrupt example sketch in the Arduino IDE. After loading it onto the board, it's now stuck in boot loader mode. The QTPYS3BOOT "disk" shows up and the board's Neopixel lights up red briefly and then stays green on boot.

I have reinstalled the UF2 firmware by dragging it to the QTPYS3BOOT, and using esp-tool.py I have also performed the factory reset described here: https://learn.adafruit.com/adafruit-qt- ... tory-reset but the problem persists. I chalked it up to the board being damaged and loaded the same FunctionalInterrupt example sketch onto a brand new, never used ESP32-S3 and the exact same problem is occurring. Nothing connected to the GPIO pads Tried 2 different USB-C cables.

There's gotta be a way to fix this, right? I didn't just immediately brick 2 boards I hope!

Here's the example code I loaded onto the board:

Code: Select all

#include <Arduino.h>
#include <FunctionalInterrupt.h>

#define BUTTON1 16
#define BUTTON2 17

class Button
{
public:
	Button(uint8_t reqPin) : PIN(reqPin){
		pinMode(PIN, INPUT_PULLUP);
		attachInterrupt(PIN, std::bind(&Button::isr,this), FALLING);
	};
	~Button() {
		detachInterrupt(PIN);
	}

	void ARDUINO_ISR_ATTR isr() {
		numberKeyPresses += 1;
		pressed = true;
	}

	void checkPressed() {
		if (pressed) {
			Serial.printf("Button on pin %u has been pressed %u times\n", PIN, numberKeyPresses);
			pressed = false;
		}
	}

private:
	const uint8_t PIN;
    volatile uint32_t numberKeyPresses;
    volatile bool pressed;
};

Button button1(BUTTON1);
Button button2(BUTTON2);


void setup() {
    Serial.begin(115200);
}

void loop() {
	button1.checkPressed();
	button2.checkPressed();
}

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: ESP32-S3 QT PY stuck in Bootloader mode

Post by adafruit2 »

what if you remove it from power. wait one minute. hold down BOOT while plugging into USB and then load the factory reset code

User avatar
sirgeoph
 
Posts: 3
Joined: Sat Nov 05, 2022 4:20 pm

Re: ESP32-S3 QT PY stuck in Bootloader mode

Post by sirgeoph »

adafruit2 wrote: Sat Nov 05, 2022 11:29 pm what if you remove it from power. wait one minute. hold down BOOT while plugging into USB and then load the factory reset code
Just tried twice with both boards, but no luck. Even put the UF2 file onto QTPYS3BOOT before the factory reset BIN one time just to see and still nothing.

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: ESP32-S3 QT PY stuck in Bootloader mode

Post by adafruit2 »

are you doing a full chip erase with the webtool/esptool? theres no memory other than that so it doesnt make a ton of sense it would retain anything. especially with a full power-cycle after the memory is erased. we're going to try it too

User avatar
hathach
 
Posts: 1271
Joined: Tue Apr 23, 2013 1:02 am

Re: ESP32-S3 QT PY stuck in Bootloader mode

Post by hathach »

First of all, the boards are all good, I have just tested. The issue is with your sketch. It somehow corrupt memory and cause hardfault (reset) on the MCU. I think you should not put attachInterrupt() within constructor, which is executed on declaration. You should :
- move attachInterrupt() to begin() of the button class
- call button1.begin() in the setup() like other convention (such as Serial)
- same to destructor, you should have an end() function instead.

Note: depending on platform, your code may work with avr/samd but seem not work with esp32. This is the "beauty" of embedded. following modification seems to run ok.

Code: Select all

#include <Arduino.h>
#include <FunctionalInterrupt.h>

#define BUTTON1 16
#define BUTTON2 17

class Button
{
public:
  Button(uint8_t reqPin) : PIN(reqPin){
    pinMode(PIN, INPUT_PULLUP);
  };
  ~Button() {
    detachInterrupt(PIN);
  }

  void ARDUINO_ISR_ATTR isr() {
    numberKeyPresses += 1;
    pressed = true;
  }

  void checkPressed() {
    if (pressed) {
      Serial.printf("Button on pin %u has been pressed %u times\n", PIN, numberKeyPresses);
      pressed = false;
    }
  }

  void begin() {
    attachInterrupt(PIN, std::bind(&Button::isr,this), FALLING);
  }

private:
  const uint8_t PIN;
    volatile uint32_t numberKeyPresses;
    volatile bool pressed;
};

Button button1(BUTTON1);
Button button2(BUTTON2);

void setup() {
    Serial.begin(115200);
    button1.begin();
    button2.begin();
}

void loop() {
  button1.checkPressed();
  button2.checkPressed();
  Serial.println("do nothing");
  delay(1000);
}

User avatar
sirgeoph
 
Posts: 3
Joined: Sat Nov 05, 2022 4:20 pm

Re: ESP32-S3 QT PY stuck in Bootloader mode

Post by sirgeoph »

Thank y'all for the help! I left everything alone for a couple days because well life (boards were disconnected) and everything is back to normal (with CircuitPython instead). Maybe I was just too impatient! Thanks again!

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

Return to “Arduino”