QEMU: UART RX/TX

Cupcake
Posts: 4
Joined: Tue Dec 01, 2020 10:05 am

QEMU: UART RX/TX

Postby Cupcake » Tue Dec 01, 2020 10:36 am

HI,

We are watching to use QEMU to run our ESP32 software "without the hardware". It will be mainly used for debugging.

We try the Ebiroll implementation of QEMU but we can't get it working using the instructions from the README. So currently we are using the espressif implementation of ESP32 on QEMU:

https://github.com/espressif/qemu

If I'm not wrong, this is the implementation used on the CHIP project.

Our software run on this QEMU implementation but we are not able to emulate the UART's as expected.

This is how the UART's are used on our board:
  • UART[0]: Log output/Programming (ESP32 > USB Serial Adapter)
  • UART[1]: Communication with a Zigbee module. (ESP32 <> Zigbee module)
But in QEMU only the UART[0] is implemented as chardev, so by default we can only control this UART using QEMU standard options. I have implemented the other UART's like this: https://github.com/espressif/qemu/issues/13

PROBLEM:

I can receive the data transmit by the emulated ESP32 software (for each uarts), but when I transmit the responses, the esp32 software don't receive anything uart_read_bytes() always return 0.

I have used all of these methods to read/write with the UART's:

Code: Select all

qemu/xtensa-softmmu/qemu-system-xtensa -nographic -s -S -machine esp32 -drive file=final.bin,if=mtd,format=raw -nic user,model=open_eth -serial /dev/ttyS4 -serial /dev/ttyS5
qemu/xtensa-softmmu/qemu-system-xtensa -nographic -s -S -machine esp32 -drive file=final.bin,if=mtd,format=raw -nic user,model=open_eth -serial udp::4555@:4556 -serial udp::4557@:4558
qemu/xtensa-softmmu/qemu-system-xtensa -nographic -s -S -machine esp32 -drive file=final.bin,if=mtd,format=raw -nic user,model=open_eth -serial tcp::8880,server,nowait -serial tcp::8881,server,nowait
qemu/xtensa-softmmu/qemu-system-xtensa -nographic -s -S -machine esp32 -drive file=final.bin,if=mtd,format=raw -nic user,model=open_eth -serial file:/tmp/uart0.txt -serial file:/tmp/uart1.txt
Did you have any ideas ?

Something not implemented somewhere ?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: QEMU: UART RX/TX

Postby ESP_igrr » Tue Dec 01, 2020 11:22 pm

Hi Cupcake,

I think the issue you are seeing is due to the fact that UART_RXFIFO_TOUT interrupt is not implemented in QEMU. Without it, the software doesn't get notified when some amount of data gets received in UART FIFO, and the amount is less than the RX threshold.

Who is online

Users browsing this forum: axellin, Bing [Bot] and 111 guests