Seems to program but won't run code

nnangeroni
Posts: 8
Joined: Mon Jan 02, 2023 11:34 pm

Seems to program but won't run code

Postby nnangeroni » Mon Mar 25, 2024 7:49 pm

Using Arduino 1.8.16, I'm trying to program this ESP32S3-Mini-1:
Screenshot 2024-03-25 131959.png
Screenshot 2024-03-25 131959.png (40.73 KiB) Viewed 2449 times
My tools setup is:
Screenshot 2024-03-25 131746.png
Screenshot 2024-03-25 131746.png (73.95 KiB) Viewed 2449 times
***NOTE: I've also tried this with Flash mode set to QIO 80MHz & QIO 120 MHz
I've simplified my setup code to simply:

Code: Select all

void setup(void) {
  pinMode(IO_BUZZER, OUTPUT);
  digitalWrite(IO_BUZZER, LOW);
  Serial.begin(115200);
  delay(5000);
  Serial.println("Waking up");
  while (1) {
    beep();
    delay(1000);
  }
}
My output during compile and programming starts out strange (I don't understand the "Forcing reset"), then seems to program OK:
Sketch uses 1203753 bytes (61%) of program storage space. Maximum is 1966080 bytes.
Global variables use 67344 bytes (20%) of dynamic memory, leaving 260336 bytes for local variables. Maximum is 327680 bytes.
Forcing reset using 1200bps open/close on port COM7
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
PORTS {COM1, COM3, COM7, } / {COM1, COM3, COM7, } => {}
Uploading using selected port: COM7
C:\Users\nancy\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\4.5.1/esptool.exe --chip esp32s3 --port COM7 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 80m --flash_size 8MB 0x0 C:\Users\nancy\AppData\Local\Temp\arduino_build_846577/RRC300.ino.bootloader.bin 0x8000 C:\Users\nancy\AppData\Local\Temp\arduino_build_846577/RRC300.ino.partitions.bin 0xe000 C:\Users\nancy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14/tools/partitions/boot_app0.bin 0x10000 C:\Users\nancy\AppData\Local\Temp\arduino_build_846577/RRC300.ino.bin
esptool.py v4.5.1
Serial port COM7
Connecting...
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: c0:4e:30:11:ce:20
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00135fff...
Compressed 14064 bytes to 9792...
Writing at 0x00000000... (100 %)
Wrote 14064 bytes (9792 compressed) at 0x00000000 in 0.2 seconds (effective 474.0 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 535.7 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 738.6 kbit/s)...
Hash of data verified.
Compressed 1204112 bytes to 774527...
Writing at 0x00010000... (2 %)
Pin 1 is strapped low for programming, and the board seems to program OK, then I remove the strap and reboot. But I am unable to achieve serial or audio output. I've tried many (perhaps all) combinations of tool settings to no avail.

Any ideas as to what I might be doing wrong or might try would be greatly appreciated.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: Seems to program but won't run code

Postby lbernstone » Mon Mar 25, 2024 9:05 pm

If you are not intending to make a USB device out of the esp32, then you want hardware CDC. You also will want the ID pin on your USB port tied to ground with 5K1 (this sets USB-OTG). Try this:
Screenshot from 2024-03-25 11-01-00.png
Screenshot from 2024-03-25 11-01-00.png (74.07 KiB) Viewed 2429 times

nnangeroni
Posts: 8
Joined: Mon Jan 02, 2023 11:34 pm

Re: Seems to program but won't run code

Postby nnangeroni » Tue Mar 26, 2024 12:49 am

lbernstone, many thanks for your suggestions.

I tried using your tool settings: the board programmed and I began seeing the expected serial output!

I then increased the Flash Size to 8MB and the partition scheme to "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" (I believe I'm using ESP32-S3-Mini-1-N8, though it's hard to confirm from the markings). Now it seemed to program but failed to run. I then returned the Tools settings to your suggested settings and could not get serial output again, even after rebooting my computer.

I then added the 5.1K resistor from the USB ID pin to ground. It made no difference, I am back to (apparently) able to program the board but unable to get it running.

My chip is ESP32-S3 (revision v0.2); could this early revision be the problem?

NOW I am able to program it WITH D0 floating. The output now looks like:
Sketch uses 1145481 bytes (87%) of program storage space. Maximum is 1310720 bytes.
Global variables use 55240 bytes (16%) of dynamic memory, leaving 272440 bytes for local variables. Maximum is 327680 bytes.
C:\Users\nancy\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\4.5.1/esptool.exe --chip esp32s3 --port COM7 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 C:\Users\nancy\AppData\Local\Temp\arduino_build_187857/RRC300.ino.bootloader.bin 0x8000 C:\Users\nancy\AppData\Local\Temp\arduino_build_187857/RRC300.ino.partitions.bin 0xe000 C:\Users\nancy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14/tools/partitions/boot_app0.bin 0x10000 C:\Users\nancy\AppData\Local\Temp\arduino_build_187857/RRC300.ino.bin
esptool.py v4.5.1
Serial port COM7
Connecting...
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: c0:4e:30:11:ce:20
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00127fff...
Compressed 15104 bytes to 10401...
Writing at 0x00000000... (100 %)
Wrote 15104 bytes (10401 compressed) at 0x00000000 in 0.2 seconds (effective 496.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 547.9 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 738.3 kbit/s)...
Hash of data verified.
Compressed 1145840 bytes to 741007...
Writing at 0x00010000... (2 %)
...
I get serial output until I reboot, then nothing.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Seems to program but won't run code

Postby ESP_Sprite » Tue Mar 26, 2024 2:25 am

Just to check, C7/C8 are not populated on your board, right? (They shouldn't be, a capacitor there will interfere with USB)

nnangeroni
Posts: 8
Joined: Mon Jan 02, 2023 11:34 pm

Re: Seems to program but won't run code

Postby nnangeroni » Tue Mar 26, 2024 4:18 pm

Thanks for asking, ESP_Sprite. Yes, C7 & C8 are not populated.

Who is online

Users browsing this forum: No registered users and 150 guests