microsoft / devicescript-esp32

Jacdac wired protocol implementation for ESP32
MIT License
23 stars 5 forks source link

update to esp-idf v5.0.2 and add ESP32-S3 #9

Closed mmoskal closed 1 year ago

urish commented 1 year ago

Have you checked the ESP32 port after this upgrade?

I tried running it in Wokwi, and got the following error during startup:

E (234) uart: uart_param_config(726): Invalid src_clk
ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x400da46f

So I flashed it to a physical device, and it seems to be hitting the same error:

image

Building against this repo esp-idf master seems to work well (at least on Wokwi), though

mmoskal commented 1 year ago

So it fails against esp-idf 5.0.2 but works with esp-idf master? Is it classic "esp32" ?

I did set the clk source here https://github.com/microsoft/devicescript-esp32/commit/d392b589d9071d8fbbf990078838d8eec6319c43

urish commented 1 year ago

Yeah, at least based on my quick test here. Classic esp32

urish commented 1 year ago

Looks like it fails in another place. Stacktrace from Wokwi:

(gdb) bt
#0  uart_get_sclk_freq (sclk=1, out_freq_hz=0x3ffbc280)
    at /home/uri/esp/esp-idf/components/driver/uart.c:204
#1  0x400e3b66 in uart_param_config (uart_num=1, uart_config=0x3ffbc280)
    at /home/uri/esp/esp-idf/components/driver/uart.c:726
#2  0x400da461 in usb_init () at /home/uri/p/devicescript-esp32/main/usb.c:255
#3  0x400d85ab in app_main () at /home/uri/p/devicescript-esp32/main/main.c:158
#4  0x4018de1c in main_task (args=<optimized out>)
    at /home/uri/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/port_common.c:131
#5  0x4008fe8c in vPortTaskWrapper (pxCode=0x4018ddd0 <main_task>, pvParameters=0x0)      
    at /home/uri/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:154
urish commented 1 year ago

So here: https://github.com/microsoft/devicescript-esp32/blob/951967340cb56477cae1e7cb65ab159584897a33/main/usb.c#L250-L254

mmoskal commented 1 year ago

I see, will fix.

It's probably good idea if you could switch to esp32-c3 or s3 on your side (if it is easy), as we test them more.

urish commented 1 year ago

Thanks!

Yeah, I started with C3 - but now tested on the original ESP32 too, as Peli mentioned it in our last call. From my experience, ESP32 is at least order of magnitude more popular than the C3/S3. It'll probably change over time, but for now...