ESP32-S2-DevKit-Lipo-USB USB to Serial

Started by findmyname, April 02, 2021, 10:35:30 PM

Previous topic - Next topic

findmyname

Hello,

I have hard time to discover ESP32-S2-DevKit-Lipo-USB rev.2 board on linux when connected via USB.
I tested it on Fedora 33 and Ubuntu Server.
I have noticed that the board uses CH340T USB-Serial convertor.

Therefore I tried:
- Driver ch341 which is part of linux kernel.
- Adjusted driver ch34x.
- Used multiple USB cables.
- Tested on two boards.

Unfortunately the board doesn't show up on linux but the led is blinking.
Doesn't show up == I expect that the board should be visible under /dev/ttyUSB*.
Is there anything special I need to do ?

Thx
BR

findmyname

Hmm maybe I need USB OTG cable. I bought one so let's test it on Monday.

LubOlimex

#2
ESP32-S2-DevKit-LiPo-UBS doesn't use CH340. The USB-serial converter is part of the ESP32-S2 chip.

If you have trouble:

1. Make sure you are entering bootloader mode, this requires pressing and holding button BUT1, then resetting the board, then releasing button BUT1.

2. Try another USB port and another USB cable.
Technical support and documentation manager at Olimex

findmyname

#3
> 1. Make sure you are entering bootloader mode, this requires pressing and holding button BUT1, then resetting the board, then releasing button BUT1.

Oh that's worked. Hmm is there any document for this magic ? :D I was following Get Started tutorial for esp-s2 but there is no mention about that.

UPDATE: I found it in esp32-s2 documentation but there isn't mention that it should be done before connecting it to PC:
Download button. Holding down Boot and then pressing Reset initiates Firmware Download mode for downloading firmware through the serial port.

I tried to flash the first project with $ idf.py -p /dev/ttyACM0 flash but it failed.

Wrote 146832 bytes (81303 compressed) at 0x00010000 in 1.2 seconds (effective 951.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
ERROR: ESP32-S2 chip was placed into download mode using GPIO0.
esptool.py can not exit the download mode over USB. To run the app, reset the chip manually.
To suppress this error, set --after option to 'no_reset'.
CMake Error at run_serial_tool.cmake:50 (message):
  /home/findmyname/.espressif/python_env/idf4.4_py3.9_env/bin/python
  /home/findmyname/Documents/core/esp/esp-idf-framework/esp-idf/components/esptool_py/esptool/esptool.py
  --chip esp32s2 failed

Following is stated as note in tutorial:
In general, you should have no problems with the official esp-idf development boards. However, esptool.py is not able to reset your hardware automatically in the following cases:

    Your hardware does not have the DTR and RTS lines connected to GPIO0 and CHIP_PU

    The DTR and RTS lines are configured differently

    There are no such serial control lines at all

Depending on the kind of hardware you have, it may also be possible to manually put your ESP32-S2 board into Firmware Download mode (reset).

    For development boards produced by Espressif, this information can be found in the respective getting started guides or user guides. For example, to manually reset an esp-idf development board, hold down the Boot button (GPIO0) and press the EN button (CHIP_PU).

    For other types of hardware, try pulling GPIO0 down.
If I understand it correctly GPIO0 should be connected to boot button which is OK for Olimex board but I'm not sure what is EN button. Do they think reset button? Do you know what is correct procedure to flash it ?

As workaround I was able to flash it manually with esptool.py but I don't know how to boot it afterwards :D
I tried idf.py -p /dev/ttyACM0 monitor but there doesn't seems to run any application == no output.
I also pressed reset button but board disconnected from PC.

 Sorry for such beginner questions :D I'm don't have any experiences with ESP HW. I bought Olimex boards because I really like power efficiency & price ratio.

$ esptool.py --chip esp32s2 -p /dev/ttyACM0 -b 460800 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 build/partition_table/partition-table.bin 0x1000 build/bootloader/bootloader.bin 0x10000 build/hello-world.bin

Thanks for your time

LubOlimex

The first thing is good. It means all is fine. Read carefully what it says:

"ERROR: ESP32-S2 chip was placed into download mode using GPIO0.
esptool.py can not exit the download mode over USB. To run the app, reset the chip manually."

It means "Everything went fine, but because the board is in bootloader mode we can't reset it automatically, so you have to reset it via the button to execute your software".
Technical support and documentation manager at Olimex

findmyname

Yeah it seems to be fine. It just say that it cannot reset the board but when i pressed reset button the board disconnect from PC. So what is the correct procedure ?

I found also this in esptool documentation

Note that some serial terminal programs (not esptool.py) will assert both RTS and DTR when opening the serial port, pulling them low together and holding the ESP32 in reset. If RTS is wired directly to EN then RTS/CTS "hardware flow control" needs to be disabled in the serial program to avoid this.

Development boards (including all Espressif boards) usually use additional circuitry to avoid this problem - if both RTS and DTR are both asserted together, this doesn't reset the chip. Consult Espressif development board schematics for the specific details.

If I understand schematic correctly RESET button seems to be connected to EN directly right ?

LubOlimex

Technical support and documentation manager at Olimex

LubOlimex

There are two modes - one is for programming, the other is for executing your code.

To program the board enter programming mode (via holding the button and reset), after done with programming exit with only reset.

Technical support and documentation manager at Olimex

findmyname

#8
Thanks for link, I missed that.

In tutorial 3.4 there is: Reset the board without BUT1 being pressed .... if I got it correctly i should press reset button only. This means that I cannot see app logs in idf monitor when connected via USB as it disconnects. Is that correct ? is there any way how to see application logs when connected via USB?

I'm asking because per ESP tutorial this should be possible.

Thx

LubOlimex

Which ESP tutorial exactly? Post the link here. I assume it is a tutorial of a board with external USB-serial adapter.
Technical support and documentation manager at Olimex

findmyname

I'm talking about this one for esp-s2 as referenced above. To be more specific please take a look on step 10.

Thx
BR

LubOlimex

#11
This guide assumes auto-reset is possible, and auto-reset is currently only possible when using external serial-USB converter. Auto-reset on "native" ESP32-S2 (e.g. without external serial-USB converter) is reported as non-working here:

https://github.com/espressif/arduino-esp32/issues/4528

At the moment, if you wish a board with auto-reset, consider ESP32-S2-DevKit-Lipo (notice that it has no "-USB" suffix in the end). ESP32-S2-DevKit-Lipo has external USB-serial convertor, it uses CH340T.

At the end of step 9 you can see troubleshooting info mentioning the reset possibilities:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html#encountered-issues-while-flashing
Technical support and documentation manager at Olimex

findmyname

Quote from: LubOlimex on April 06, 2021, 11:34:54 AMThis guide assumes auto-reset is possible, and auto-reset is currently only possible when using external serial-USB converter. Auto-reset on "native" ESP32-S2 (e.g. without external serial-USB converter) is reported as non-working here:

https://github.com/espressif/arduino-esp32/issues/4528

Well it isn't really clear whether they are discussing the very same issue but there is one comment at the end:
Is there any update related to this issue, the idf version is working properly with a simple "USB Console" configuration in menuconfig. However, on Ardunio side there is a problem even which crashes the configuration made by esp-idf.

I looked up this DOC. I tried it and it works :)

Quote from: undefinedAt the end of step 9 you can see troubleshooting info mentioning the reset possibilities:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html#encountered-issues-while-flashing
I saw it but there isn't mention that it doesn't work on esp-s2.

Thx for link

LubOlimex

Nice thank you! I wasn't aware that auto-rest is working fine in ESP-IDF while the problem only affects ESP32-S2 for Arduino IDE!

Glad you got it working!
Technical support and documentation manager at Olimex

wlami

Hi folks,

I've been trying hard to get serial output when not in bootloader mode so that I can "debug" my projects. The "default behavior" for me was that the board doesn't show up at all over USB when not in bootloader mode. I found out that this is related to the usage of the internal USB controller in contrast to using an additional one. To make it "visible" one has to change the output channel to USB CDC.

I've been successful with esp-idf but not with arduino. To monitor your board with esp-idf you have to do the following steps:

  • Upgrade to esp-idf version 4.3 or later (4.2 which was installed for me in VS Code idf plugin doesn't have the required configs)
  • in the project do idf.py set-target exp32s2
  • idf.py menuconfig => Component config => ESP System Settings => Channel for console output => Choose "USB CDC"
  • idf.py -p <your serial interface> flash
  • manually reset

Now you have a serial interface when your code is running, not only in bootloader mode.

  • idf.py -p <your serial interface> monitor

From my (very limited) understanding those config changes in idf.py menuconfig aren't easy to move to Arduino IDE. But maybe you have ideas on how to get those settings over.

Best,
Wladi