ESP32 UART-USB Brige How to use

For general Flowcode discussion that does not belong in the other sections.
stefan.erni
Valued Contributor
Posts: 1127
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 215 times
Been thanked: 235 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

Very good, that's something.

Unfortunately, no success yet.
I always get a message saying that the baud rate of Com5 is not supported.
And then com5 is blocked.
Can you tell me which S3 board you have and post your program?

mnfisher
Valued Contributor
Posts: 1723
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 147 times
Been thanked: 803 times

Re: ESP32 UART-USB Brige How to use

Post by mnfisher »

I used https://www.amazon.co.uk/diymore-ESP32- ... r=8-5&th=1

(there must be a better way to get a link out of amazon?)

I find I can 'lock' the board - when I need to press and hold 'boot' and then press and release reset to get Windows to recognise it.

I just do a loop with :

Code: Select all

 printf("Hello World\r\n"); 
delay(1s)

If I add a Flowcode UART - channel 1 will open (BUT writing to it doesn't send anything- and the pins can't be selected) - channel 2 seems to lock the board (I tried 19 and 20 (message as above)

When it works - I get the usual esp32 'preamble' - output first then 'Hello.... repeated. Pressing 'reset' closes the COM port - but I can reopen to get

ESP-ROM:esp32s3-20210327
Hello world
Hello world
....

I also toggle a pin (and have a logic analyser attached) - for when I was first looking for 'life' :-)

COM port setting - if I use PuTTY - I use 115200 baud - if I use idf.py -pCOM5 -b 921600 flash monitor - it probably uses 115200 for the monitor (upload is at 921600)?

Occasionally I need to hit the reset button when starting monitoring to get past the 'waiting for download' message.

Currently using 5.4.1 - although I might revert to 5.5 and see if there any differences?

Martin
Attachments
Flowcode1.fcfx
(7.62 KiB) Downloaded 85 times

stefan.erni
Valued Contributor
Posts: 1127
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 215 times
Been thanked: 235 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin


I found more infos, But I can't find the TinyUSB setting in sdconfig.
Actually, this should already be available in sdconfig.
Option 2: With TinyUSB (full USB functionality)
If you need data transfer like a real USB bridge, you must enable the TinyUSB stack.
To do this:

Add the component:
idf.py add-dependency esp_tinyusb~2.0.0

Afterwards, the following options will appear in menuconfig:
Component config → TinyUSB Stack
[*] Enable TinyUSB
[*] Enable CDC class

This sets:
CONFIG_TINYUSB_ENABLED=y
CONFIG_TINYUSB_CDC_ENABLED=y
CONFIG_USB_DEVICE_ENABLED=y

Initialize in the code:
C#include “tinyusb.h”tinyusb_driver_install(&tusb_cfg);Show more lines

This allows you to use your own USB CDC endpoints and send data as you would with a virtual COM port. [docs.espressif.com], [github.com]

stefan.erni
Valued Contributor
Posts: 1127
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 215 times
Been thanked: 235 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

I downloaded the Flowcode_Compiler_ESP_5.3a.msi and and installed.
FC11 works right away.

However, the section for USB does not appear in the menu.
2025-11-19_11-13-04.PNG
2025-11-19_11-13-04.PNG (55.12 KiB) Viewed 284 times

mnfisher
Valued Contributor
Posts: 1723
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 147 times
Been thanked: 803 times

Re: ESP32 UART-USB Brige How to use

Post by mnfisher »

Hi Stefan,

i've only had time for a brief play (using 5.5) - I managed to compile a demo successfully - but the program threw errors (TinyUSB task cannot have size 0 or similar)

But will experiment some more....

Martin

stefan.erni
Valued Contributor
Posts: 1127
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 215 times
Been thanked: 235 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

that's quite something

I had to enter commands via the console, then I could start the menu and TinyUSB appeared in the menu for the first time.
(I have no idea how to do that in FC11.)

This TinyUSB is for ESP32-S3 and not for all Classic ESP32
All ESP32 chips can send UART data, but:
Classic ESP32 only via external USB-UART chip.
ESP32-S3 additionally directly via USB-CDC (TinyUSB)

Probably a TinyUSB task needs to be created or used?

But then it should simply be possible to send data to the PC via uart0 to pin

Select the UART component and set it to UART0.
TX = GPIO43, RX = GPIO44 (default for ESP32-S3).
Flowcode sends data via UART0 → the chip's USB-CDC forwards it to the PC.

for the console:

Code: Select all

idf.py create-project c:\\usb_cdc_demo
cd c:\\usb_cdc_demo
idf.py add-dependency esp_tinyusb~2.0.0
idf.py menuconfig

Perhaps this can be done via defaults?

Code: Select all

sdkconfig.defaults

CONFIG_TINYUSB_ENABLED=y
CONFIG_USB_DEVICE_ENABLED=y
CONFIG_TINYUSB_CDC_ENABLED=y
CONFIG_TINYUSB_CDC_CHANNEL_COUNT=1
CONFIG_TINYUSB_TASK_STACK_SIZE=4096
CONFIG_TINYUSB_TASK_PRIORITY=5


2025-11-20_09-46-22.PNG
2025-11-20_09-46-22.PNG (64.76 KiB) Viewed 246 times
2025-11-20_09-47-13.PNG
2025-11-20_09-47-13.PNG (38.11 KiB) Viewed 246 times
2025-11-20_09-48-12.PNG
2025-11-20_09-48-12.PNG (28.8 KiB) Viewed 246 times

stefan.erni
Valued Contributor
Posts: 1127
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 215 times
Been thanked: 235 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

Do you have any idea how I can set TINYUSB_ENABLED=y and the other settings
in the menu so that it works with Flowcode?

mnfisher
Valued Contributor
Posts: 1723
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 147 times
Been thanked: 803 times

Re: ESP32 UART-USB Brige How to use

Post by mnfisher »

Hi Stefan,

Not had much chance to play this week - I'll try and have another bash over the weekend....

Martin

mnfisher
Valued Contributor
Posts: 1723
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 147 times
Been thanked: 803 times

Re: ESP32 UART-USB Brige How to use

Post by mnfisher »

I managed to get the esp32-s3 running with tinyusb!

This is a not very useful demo that opens the USB port - and on my PC this connects as a different port number (COM18 instead of COM5) - and then outputs a string in a loop. Hopefully you can build on this though.

Setup:
I created a Flowchart (I called it tinyusb_test) - and attempt to compile it. Once the directory structure is created - open a command prompt and cd to the program folder (in my case this is d:\projects\flowcode\tinyusb_test - but this will vary depending on filename and whether you use the default batch files)
idf.py add-dependency esp_tinyusb~1.0.0 - to add the tiny usb component.
create main/includes and add the attached .h and .c files - and the directory to main/CMakeLists.txt

Code: Select all

idf_component_register(SRCS "esp-project.c"
                    INCLUDE_DIRS "" "includes")
C:\Espressif\frameworks\esp-idf-v5.5\export (adjust to the framework location you are using)
idf.py fullclean
idf.py build - or rebuild from FC
idf.menuconfig - should now be able to edit the tinyusb component properties to enable CDC etc
idf.py -p COM5 -b 921600 flash to flash the program (I use this as it is quicker than compiling from FC - which takes about 20s to set up the environment and I am impatient :-) )

Use device manager com ports (or other) - to check the com port.
Connect with PuTTY at 115200.

Note that to reflash the esp32 - you'll need to reset it...

Martin
Attachments
tinyusb_test.fcfx
(7.32 KiB) Downloaded 1 time
supplementary.zip
(1.19 KiB) Downloaded 1 time

Post Reply