Hi Martin
My testprogram:
You can find a description of the hardware here
viewtopic.php?t=3644
ESP32 UART-USB Brige How to use
-
stefan.erni
- Valued Contributor
- Posts: 1208
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
-
stefan.erni
- Valued Contributor
- Posts: 1208
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
Re: ESP32 UART-USB Brige How to use
Hi Martin
One a question:
There is still one entry missing :
But in FC11 there are so many sdkconfig.defaults.esp32s3.
Which one is the right one?
One a question:
There is still one entry missing :
in the file:CONFIG_USB_DEVICE_ENABLED=y
CONFIG_TINYUSB_ENABLED=y
CONFIG_TINYUSB_DEVICE_ENABLED=y
CONFIG_TINYUSB_CDC_ENABLED=y
sdkconfig.defaults.esp32s3
But in FC11 there are so many sdkconfig.defaults.esp32s3.
Which one is the right one?
-
stefan.erni
- Valued Contributor
- Posts: 1208
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
Re: ESP32 UART-USB Brige How to use
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:
C-Code for USB:
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"
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: 1896
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 894 times
Re: ESP32 UART-USB Brige How to use
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
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: 1208
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
Re: ESP32 UART-USB Brige How to use
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: C-Code: On computer (regardless of the baud rate)
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: C-Code: On computer (regardless of the baud rate)
-
stefan.erni
- Valued Contributor
- Posts: 1208
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
Re: ESP32 UART-USB Brige How to use
Hi Martin
Your suggestion works perfectly!
I had to make a few adjustments. Sending is done using the function in the additional code. How can I send an array from my program? I'm not sure exactly where I need to add FCV_.
Your suggestion works perfectly!
I had to make a few adjustments. Sending is done using the function in the additional code. How can I send an array from my program? I'm not sure exactly where I need to add FCV_.
-
mnfisher
- Valued Contributor
- Posts: 1896
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 894 times
Re: ESP32 UART-USB Brige How to use
Hi Stefan,
Something like this?
However - I have some serious issues recompiling this (- a nested #include somewhere!) - I removed the UART component thinking it was this (and I had a seemingly unending circular list of errors!) - but I still get "
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66"
A couple of hundred times
However - if you can get it to compile - it should work.... I added a 'Print' macro to allow output to be made a little more 'flowcode'
Will have to fiddle a bit and find out what's gone wrong with my setup
Martin
Something like this?
However - I have some serious issues recompiling this (- a nested #include somewhere!) - I removed the UART component thinking it was this (and I had a seemingly unending circular list of errors!) - but I still get "
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66,
from C:\Users\Martin\Downloads\tinyusb.h:66"
A couple of hundred times
However - if you can get it to compile - it should work.... I added a 'Print' macro to allow output to be made a little more 'flowcode'
Will have to fiddle a bit and find out what's gone wrong with my setup
Martin
-
stefan.erni
- Valued Contributor
- Posts: 1208
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
Re: ESP32 UART-USB Brige How to use
Hi Martin
Your program is working fine
Maybe You need ESP-IDF 5.3.1
and in the menuconfig batch file
this line ....
Your program is working fine
Maybe You need ESP-IDF 5.3.1
and in the menuconfig batch file
this line ....
Code: Select all
python "C:\Users\Kfs-Forschung\Desktop\esp-idf-2\tools\idf.py" add-dependency esp_tinyusb
-
stefan.erni
- Valued Contributor
- Posts: 1208
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 222 times
- Been thanked: 240 times
Re: ESP32 UART-USB Brige How to use
Hi Martin
I expanded your example to include an array for sending data, and it works.
I can also receive the binary data array very easily using the Flowcode APP Developer.
Demo:
I expanded your example to include an array for sending data, and it works.
I can also receive the binary data array very easily using the Flowcode APP Developer.
Demo: