ESP32 icon indicating copy to clipboard operation
ESP32 copied to clipboard

ESP32 S2 Mini not work after change UART pin

Open crashaston opened this issue 4 months ago • 10 comments

Hi! I'm flashing board ESP32-S2 Mini. After change uart pins (16/17), ESP32 connecting to wi-fi, but web server not answer. What i do wrong?

crashaston avatar Feb 18 '24 13:02 crashaston

No logs, no details = no one can help you. Try manually typing the IP into the browser

seeul8er avatar Feb 18 '24 16:02 seeul8er

how i can get logs? i tried manually typing the ip, but without results

crashaston avatar Feb 18 '24 17:02 crashaston

What board exactly are you using? Try any other pin configuration for UART. The ESP32 can use almost all pins for UART. Delete/erase the flash first and then re-flash to get back to normal.

seeul8er avatar Feb 19 '24 14:02 seeul8er

Board - ESP32 S2 Mini V1.0.0. I tried assigning different pins to the UART, but without success. I always do a flash erase before programming.

crashaston avatar Feb 19 '24 19:02 crashaston

Same problem for me with ESP32C3, model: Seeed Studio XIAO ESP32C3

If I change baud, click save settings, click reboot, power cycle, then reconnect, website loads again with new baud. BUT if I change one or both UARTs, click save, click reboot, power cycle, reconnect to dronebridge AP, website refuses to load. Tried with ports 0,1,9,10. All don't work. It does work for me with ESP-WROOM-32.

Here is the log from flashing the firmware, as per the instructions:

~/Downloads/DroneBridge_ESP32_v1_4/esp32c3$ esptool.py -p /dev/ttyACM0 erase_flash;esptool.py -p /dev/ttyACM0 -b 115200 --before default_reset --after hard_reset --chip esp32c3 write_flash --flash_mode dio --flash_size 2MB --flash_freq 80m 0x0 bootloader.bin 0x8000 partition-table.bin 0x10000 db_esp32.bin 0x110000 www.bin esptool.py v4.6.2 Serial port /dev/ttyACM0 Connecting.... Detecting chip type... ESP32-C3 Chip is ESP32-C3 (revision v0.4) Features: WiFi, BLE Crystal is 40MHz MAC: ec:da:3b:bb:56:7c Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)... Chip erase completed successfully in 15.5s Hard resetting via RTS pin... esptool.py v4.6.2 Serial port /dev/ttyACM0 Connecting... Chip is ESP32-C3 (revision v0.4) Features: WiFi, BLE Crystal is 40MHz MAC: ec:da:3b:bb:56:7c Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00000000 to 0x00005fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x00010000 to 0x000fefff... Flash will be erased from 0x00110000 to 0x0013ffff... Compressed 20576 bytes to 12634... Wrote 20576 bytes (12634 compressed) at 0x00000000 in 0.3 seconds (effective 487.6 kbit/s)... Hash of data verified. Compressed 3072 bytes to 116... Wrote 3072 bytes (116 compressed) at 0x00008000 in 0.0 seconds (effective 605.5 kbit/s)... Hash of data verified. Compressed 976432 bytes to 565221... Wrote 976432 bytes (565221 compressed) at 0x00010000 in 7.8 seconds (effective 999.8 kbit/s)... Hash of data verified. Compressed 196608 bytes to 39060... Wrote 196608 bytes (39060 compressed) at 0x00110000 in 1.2 seconds (effective 1268.8 kbit/s)... Hash of data verified.

Leaving... Hard resetting via RTS pin...

PeterJBurke avatar Feb 25 '24 07:02 PeterJBurke

@PeterJBurke You will have to wait a few days till my ESP32C3 module arrives. Then I can debug myself.

seeul8er avatar Feb 25 '24 18:02 seeul8er

I can confirm that the ESP32C3 module from XIAO is working. Make sure you enter the GPIO number and not the D-Number as written on the board. The numbers may differ (D4 may not be GPIO4). Also, try lowering the baud rate. Mine does not like bauds higher than 57600. I have not experienced any of your issues.

If you continue having problems please post the log output. You can get the logs by connecting the ESP32 via USB to your PC and then navigate to this website: https://espressif.github.io/esptool-js/ Use 115200 as baud and connect. You may have to reset the ESP32 in order to get the logs. This works only with Edge or Chrome based browsers.

seeul8er avatar Mar 01 '24 14:03 seeul8er

Thank you for checking. Can you please post here which numbers you entered for the TX and RX input in the website configurator?

PeterJBurke avatar Mar 02 '24 02:03 PeterJBurke

I continue to have issues. I bought a new ESP32C3 and have the same issue. So it is not a hardware problem with my ESP32.

I tried 21 as the TX in the website. Again, after save and reboot, the website is not loading. Even though the wifi AP is up and I can connect to it after reboot. I tried rebooting with three methods: 1) power cycle, 2) the reset button on the board 3) the "reboot esp32" button on the webpage. Same results for all three.

Again, after I erase and reflash the firmware, it works again.

The debug output is listed below. However, when I connect with the debug method, the wifi access point is NOT offered up. So, I cannot debug and try to change the settings at the same time.

Debug log output: esptool.js Serial port WebSerial VendorID 0x303a ProductID 0x1001 Connecting.... Detecting chip type... ESP32-C3 Chip is ESP32-C3 (revision 4) Features: Wi-Fi Crystal is 40MHz MAC: ec:da:3b:bb:cf:58 Uploading stub... Running stub... Stub running...

PeterJBurke avatar Mar 02 '24 21:03 PeterJBurke

Here are some additional screenshots from the website with developer tools shown. I don't know why it says "user aborted a request" when I click reboot esp32? Screenshot from 2024-03-02 13-48-56 Screenshot from 2024-03-02 13-48-45 Screenshot from 2024-03-02 13-48-26 Screenshot from 2024-03-02 13-48-09 Screenshot from 2024-03-02 13-34-48 Screenshot from 2024-03-02 13-33-39 pin_map-2

PeterJBurke avatar Mar 02 '24 21:03 PeterJBurke

The error message is because the ESP32 is already rebooting and therefore not sending any acknowledgement. This is my config and it is working. It is already the developer version so please ignore the RTS/CTS stuff. It is not enabled. The relevant wires are red, green, blue and white. You cannot use GPIO21 & GPIO20. You need to set both pins (TX & RX), which can not be 0.

20240303_111616 20240303_111637 DB_Config_XIAOESP32 PX4_Config

seeul8er avatar Mar 03 '24 10:03 seeul8er

Thanks for your attention and help. I tried 6, 7 for the entries on the website (see screenshot). I have nothing soldered to the board, only connecting via usb. Same problem, after reboot, I can connect to the wifi access point but the webpage does not load.

Just to confirm, the website should load even after saving the settings, correct? Screenshot from 2024-03-03 16-48-50

PeterJBurke avatar Mar 04 '24 00:03 PeterJBurke

Yes the website should load. I am a little lost at this point. I still do not think it is an implementation issue, but I am running out of ideas. I sometimes have to actively disconnect and reconnect to the ESP32 AP after reboot, to be able to re-load the webpage. In some cases my PC does not actively re-connect on reboot. That way no IP is assigned. In addition try loading the page via the IP (192.168.2.1) instead of the dronebridge.local URL.

For any further assistance I will need the logs. The logs of the crashing ESP are enough. Just change the pins (let it "crash") and then connect to the PC in order to log as described above. If the online serial monitor tool is not sufficient (which I do not belief) we need an USB to serial adapter (e.g. FTDI) that connects to the bespoken D6 & D7 pins.

Is it just the webpage that does not load? Did you check with wireshark or QGroundcontrol if you are able to receive data?

seeul8er avatar Mar 04 '24 12:03 seeul8er

Just wanted to put some ideas here as I also have previously encountered this locking up on a ESP32-WROOM but now am working with a XIAO ESP32, but I have the ESP32-S3 instead.

On the Seeed Studio XIAO ESP32-S3 I got my setup working using the TX/RX pins but instead of using the D# to select the number, I used the GPIO# (so in this case GPIO43 and GPIO44 -> 43 and 44) and managed to get it connected with packets from UART detected. So in my opinion, I feel that part of the issue lies with the documentation for each ESP board on which pin # is being used.

ESP32-S3 diagram as shown on Amazon: image

My setup: Screenshot 2024-03-04 at 11 19 47 AM

jasoryeh avatar Mar 04 '24 19:03 jasoryeh

Thanks. Perplexed here also! Would you mind checking the binary I am using on the ESP32C3 you have? I have the release 1.4 binary from the github repo, and I used this command to flash it:

clear; cd ~/Downloads/DroneBridge_ESP32_v1_4/esp32c3/; esptool.py -p /dev/ttyACM0 erase_flash;esptool.py -p /dev/ttyACM0 -b 57600 --before default_reset --after hard_reset --chip esp32c3 write_flash --flash_mode dio --flash_size 2MB --flash_freq 80m 0x0 bootloader.bin 0x8000 partition-table.bin 0x10000 db_esp32.bin 0x110000 www.bin

Also I have an FTDI converter, if you provide instructions, I can try hooking into it with that.

LOG: This is what I get after it "crashes" in the log. Note that I can either connect via the log/browser OR connect wifi. The wifi access point is not spun up when connected over usb via the log/browser (until hardware reset or power cycle):

LOG OUTPUT: esptool.js Serial port WebSerial VendorID 0x303a ProductID 0x1001 Connecting.... Detecting chip type... ESP32-C3 Chip is ESP32-C3 (revision 4) Features: Wi-Fi Crystal is 40MHz MAC: ec:da:3b:bb:cf:58 Uploading stub... Running stub... Stub running...

PeterJBurke avatar Mar 05 '24 01:03 PeterJBurke

@4O6FPV almost :) But thank you for also taking a look @PeterJBurke Connect the

  • FTDI RX to D6 (ESP32 TX)
  • FTDI TX to D7 (ESP32 RX)
  • GND to GND
  • Supply ESP32 with power, e.g. via USB or via the FTDI

Beware that the voltage level of the ESP32 is 3.3V - If necessary set your FTDI to 3.3V (some versions can be set to 5V). Then again launch a serial monitor (e.g. the mentioned esptool via webbrowser) on your computer and connect to the FTDI adapter, baud should be 115200. Reset the ESP32 via the onboard button to be able to observe the startup via the serial monitor and post the output here.

I will flash my board with 1.4 as well. @jasoryeh XIAO ESP32 TX & RX labeled pins are for debugging and flashing only. Connect the flight controller to any other pin and configure the GPIO numbers in the web interface. I will write a proper wiki page for that.

seeul8er avatar Mar 05 '24 14:03 seeul8er

As an update, I purchased the Seeed Studio XIAO ESP32S3. That does not have problems. (Of the website not loading after setting pins). It seems to work fine in that regard. (I entered 1,2).

Only the Seeed Studio XIAO ESP32C3 has a problem for me.

PeterJBurke avatar Mar 06 '24 02:03 PeterJBurke

@PeterJBurke I think I was now able to reproduce the bug in v1.4 - It seems that the watchdog is not reset in time and that causes the hangup. This issue is already fixed and will be gone in the next release..
Since I want to officially support the XIAO ESP32C3, I will craft a new release within the next days to fix the support for the C3.

I am very sorry for not properly checking v1.4 previously! I hope that will fix the problem. Thank you very much for your support and patience!

P.S. I setup a new wiki that goes in depth regarding logging, debugging, flashing etc.

seeul8er avatar Mar 06 '24 22:03 seeul8er

New v1.5 release is available. The ESP32C3 issue should be fixed! Thank you for your support :)

seeul8er avatar Mar 08 '24 17:03 seeul8er