相关文章推荐

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

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.
  • IDF version.

    v5.2-dev-1805-g9a1cc59338

    Operating System used.

    Linux

    How did you build your project?

    VS Code IDE

    If you are using Windows, please specify command line type.

    Development Kit.

    ESP32-S3-WROOM1

    Power Supply used.

    What is the expected behavior?

    I followed the programming guide to set up a UART communication.
    I expect the function uart_install_driver function not to fail.

    What is the actual behavior?

    After calling the function uart_install_driver there is some internal error (the last function in the call stack is find_desc_for_source in intr_alloc.c.

    Steps to reproduce.

    The following code caused the issue:

    uart_config_t uart_config = {
        .baud_rate = 115200,
        .data_bits = UART_DATA_8_BITS,
        .parity = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS,
        .rx_flow_ctrl_thresh = 122,
    ESP_ERROR_CHECK(uart_param_config(uart_num,&uart_config));
    ESP_ERROR_CHECK(uart_set_pin(uart_num,
        GPIO_NUM_39, //tx
        GPIO_NUM_36, //rx
        GPIO_NUM_38, //rts
        GPIO_NUM_35  //cts
    const int uart_buffer_size = (1024 * 2);
    // Install UART driver using an event queue here
    ESP_ERROR_CHECK(uart_driver_install(uart_num, uart_buffer_size, 0, 10, q, ESP_INTR_FLAG_LEVEL1));
    

    Replacing ESP_INTR_FLAG_LEVEL1 by 0 also doesnt help. Replacing the 0 for TX buffer size by uart_buffer_size doesnt change anything either. This happened on 2 different ESP32-S3-WROOM1 boards (custom board, DevKitC-1)

    Debug Logs.

    Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
    Core  0 register dump:
    PC      : 0x420033d0  PS      : 0x00060033  A0      : 0x8200353d  A1      : 0x3fc98a40
    0x420033d0: find_desc_for_source at /home/benni/esp/esp-idf/components/esp_hw_support/intr_alloc.c:169
    A2      : 0x0000001d  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000
    A6      : 0x3fc98770  A7      : 0x00000003  A8      : 0x00000008  A9      : 0x8200874e
    A10     : 0x00000004  A11     : 0x3fc9b4d8  A12     : 0x3fc98994  A13     : 0x00000010
    A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x00000019  EXCCAUSE: 0x0000001c
    EXCVADDR: 0x8200874e  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xfffffffe
    0x400556d5: strlen in ROM
    0x400556e5: strlen in ROM
    Backtrace: 0x420033cd:0x3fc98a40 0x4200353a:0x3fc98a60 0x42003748:0x3fc98ab0 0x42003999:0x3fc98b00 0x4200bd48:0x3fc98b30 0x4200882a:0x3fc98b80 0x420088ed:0x3fc98bc0 0x4201a02b:0x3fc993f0 0x4037ce0d:0x3fc99420
    0x420033cd: find_desc_for_source at /home/benni/esp/esp-idf/components/esp_hw_support/intr_alloc.c:168
    0x4200353a: get_available_int at /home/benni/esp/esp-idf/components/esp_hw_support/intr_alloc.c:326
    0x42003748: esp_intr_alloc_intrstatus at /home/benni/esp/esp-idf/components/esp_hw_support/intr_alloc.c:540
    0x42003999: esp_intr_alloc at /home/benni/esp/esp-idf/components/esp_hw_support/intr_alloc.c:659
    0x4200bd48: uart_driver_install at /home/benni/esp/esp-idf/components/driver/uart/uart.c:1684
    

    More Information.

    No response

    Unhandled exception after uart_driver_install Unhandled exception after uart_driver_install (IDFGH-10741) Jul 26, 2023

    In this sample, they are called in the following order.
    https://github.com/espressif/esp-idf/tree/master/examples/peripherals/uart/uart_async_rxtxtasks

        uart_driver_install(UART_NUM_1, RX_BUF_SIZE * 2, 0, 0, NULL, 0);
        uart_param_config(UART_NUM_1, &uart_config);
        uart_set_pin(UART_NUM_1, TXD_PIN, RXD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
    

    In this sample, they are called in the following order. https://github.com/espressif/esp-idf/tree/master/examples/peripherals/uart/uart_async_rxtxtasks

        uart_driver_install(UART_NUM_1, RX_BUF_SIZE * 2, 0, 0, NULL, 0);
        uart_param_config(UART_NUM_1, &uart_config);
        uart_set_pin(UART_NUM_1, TXD_PIN, RXD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
    

    I'm quite confused about the correct calling order of uart driver install/config/set_pin, see #5746

    Since around V5, source_clk has been added. Is it related?

        const uart_config_t uart_config = {
            .baud_rate = 115200,
            .data_bits = UART_DATA_8_BITS,
            .parity = UART_PARITY_DISABLE,
            .stop_bits = UART_STOP_BITS_1,
            .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
            .source_clk = UART_SCLK_DEFAULT, ----> 
    
     
    推荐文章