Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UART Echo Example not working as expected in ESP32C3 Qemu (QEMU-150) #79

Closed
lcgamboa opened this issue Jun 30, 2023 · 7 comments
Closed
Assignees
Labels
Resolution: NA Status: Done Issue is done internally

Comments

@lcgamboa
Copy link

The idf UART Echo Example not working as expected in ESP32C3 Qemu.
In the figure below on the left is the output on a real C3 chip and on the right the output of Qemu's ESP32C3 for keys typed in sequence ( 1, 2 , 3 ...).

uarterror

The example works correctly with Qemu for ESP32.

@github-actions github-actions bot changed the title UART Echo Example not working as expected in ESP32C3 Qemu UART Echo Example not working as expected in ESP32C3 Qemu (QEMU-150) Jun 30, 2023
@o-marshmallow
Copy link
Collaborator

Hi @lcgamboa ,

Thanks for reporting this issue. As far as I know, this example requires an external USB-to-UART adapter as it uses another UART controller than the default one, with given pins from Kconfig.

I cannot reproduce what you are getting, even on the real chip. What is your configuration for this example?

@lcgamboa
Copy link
Author

lcgamboa commented Jul 3, 2023

I'm sorry I forgot to let you know that I modified the code to use the default pins for ease of use with many different processors. I modified the lines 29 and 30 of file uart_echo_example_main.c from :

#define ECHO_TEST_TXD (CONFIG_EXAMPLE_UART_TXD)
#define ECHO_TEST_RXD (CONFIG_EXAMPLE_UART_RXD)

to:

#define ECHO_TEST_TXD (UART_PIN_NO_CHANGE)
#define ECHO_TEST_RXD (UART_PIN_NO_CHANGE)

@o-marshmallow
Copy link
Collaborator

Hi @lcgamboa ,

Thanks for the details, I also needed to use the UART port number 0 in the menuconfig to reproduce the issue.
I will investigate this issue.

@lcgamboa
Copy link
Author

lcgamboa commented Aug 5, 2023

Thanks for the support, now the example works correctly.

@lcgamboa
Copy link
Author

lcgamboa commented Aug 6, 2023

I did some more tests and it seems that there is some difference when the sent string is greater than 128 bytes. For real hardware the string limit is 1024 bytes, for Qemu esp32-c3 the limit is a multiple of 128. In the figure below a string of 2048 bytes is sent, for real hardware (top terminal) it is split into two parts of 1024 (in the most times). For Qemu esp32-c3 (bottom terminal) it is always split into several parts with sizes x*128 randomly. Same with ESP32 for hardware and on Qemu esp32. Apparently this is not a problem and is probably due to a limitation in the Qemu implementation.

echo

@o-marshmallow
Copy link
Collaborator

Hi @lcgamboa ,

The reason behind this is that the ESP32-C3 UART controller underneath uses the ESP32 UART implementation, which explains why it has the same behavior. This choice was made to quickly get something up and running while developping other controllers.
If you think this is a critical bug and it needs to be fixed as soon as possible, feel free to open a new issue

@lcgamboa
Copy link
Author

lcgamboa commented Aug 9, 2023

Hi @o-marshmallow ,

I believe it is not critical, this limitation is because the buffers always have a fixed size of 128 in the Qemu implementation.

Another problem that occurs is that when the uart receive threshold is set to a value lower than 128, the interruption only happens when the buffer reaches 128 and throttle_rx=true occurs. It's not critical either, but it can disturb an application that needs to process exactly the configured threshold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants