ESP32 UART-USB Brige How to use

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

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

My testprogram:
Adafruit_5691_01_fc11_19.fcfx
(66.15 KiB) Downloaded 49 times
You can find a description of the hardware here
viewtopic.php?t=3644

stefan.erni
Valued Contributor
Posts: 1204
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 222 times
Been thanked: 240 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

One a question:
There is still one entry missing :
CONFIG_USB_DEVICE_ENABLED=y
CONFIG_TINYUSB_ENABLED=y
CONFIG_TINYUSB_DEVICE_ENABLED=y
CONFIG_TINYUSB_CDC_ENABLED=y
in the file:
sdkconfig.defaults.esp32s3

But in FC11 there are so many sdkconfig.defaults.esp32s3.
Which one is the right one?

stefan.erni
Valued Contributor
Posts: 1204
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 222 times
Been thanked: 240 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

I've now updated to 5.3.1 and added the USB Tiny dependency.

I also have some C code there can I use it in Flowcode?

include are ok:

Code: Select all

#include "tinyusb.h"
#include "tusb_cdc_acm.h"
#include "esp_log.h"

2026-03-30_11-36-59.PNG
2026-03-30_11-36-59.PNG (39.99 KiB) Viewed 47 times
C-Code for USB:

Code: Select all

void app_main(void)
{
    // TinyUSB Basisconfig
    tinyusb_config_t tusb_cfg = {
        .device_descriptor = NULL,  
        .string_descriptor = NULL,  
        .external_phy = false       // intern USB-PHY des ESP32-S3
    };

    // USB-Device (TinyUSB) start
    tinyusb_driver_install(&tusb_cfg);

    // USB-CDC (virtueller COM-Port) config
    tinyusb_cdcacm_config_t cdc_cfg = {
        .usb_dev = TINYUSB_USBDEV_0,
        .cdc_port = TINYUSB_CDC_ACM_0,
        .rx_unread_size = 64,
    };

    tusb_cdc_acm_init(&cdc_cfg);

    // wait, for USB clean
    vTaskDelay(pdMS_TO_TICKS(300));

    // „Hello world“ send
    const char *msg = "Hello world\r\n";
    tusb_cdc_acm_write(TINYUSB_CDC_ACM_0, (uint8_t *)msg, strlen(msg));
    tusb_cdc_acm_write_flush(TINYUSB_CDC_ACM_0, 0);

    //  (Flowcode need main loop)
    while (1)
    {
        vTaskDelay(pdMS_TO_TICKS(1000));
    }
}




mnfisher
Valued Contributor
Posts: 1887
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 154 times
Been thanked: 889 times

Re: ESP32 UART-USB Brige How to use

Post by mnfisher »

Hi Stefan,

Yes - you can use the C to initialise - rename (app_main) initialise (or some such) and add a function definition to the 'includes' (top) box of supplementary code... ( void initialise(void); ) Remove the loop (and the 'hello world'?) from the end of the function...

Then call initialise(); from a C block.

You can also add a 'Print(char *str);' function - which could call tusb_cdc_acm_write and flush..

Martin

stefan.erni
Valued Contributor
Posts: 1204
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 222 times
Been thanked: 240 times

Re: ESP32 UART-USB Brige How to use

Post by stefan.erni »

Hi Martin

Thank you Martin I'll give that a try.

I've had a bit of success with `print_F` so far.
I still have no idea how to send an array

Very short program:
Post_esp531_1.fcfx
(9.77 KiB) Downloaded 6 times
C-Code:
2026-03-30_13-51-31.PNG
2026-03-30_13-51-31.PNG (15.24 KiB) Viewed 34 times
On computer (regardless of the baud rate)
2026-03-30_13-51-07.PNG
2026-03-30_13-51-07.PNG (112.9 KiB) Viewed 34 times

Post Reply