Core 0 panic'ed (Interrupt wdt timeout on CPU0) when i have tx ring buffer

Melika
Posts: 4
Joined: Sun Feb 18, 2024 9:32 am

Core 0 panic'ed (Interrupt wdt timeout on CPU0) when i have tx ring buffer

Postby Melika » Sun Feb 18, 2024 9:47 am

Hi every one.i have problem with uart_driver_install in espidf.when i use uart driver install like uart_driver_install(Serial0,1024,0, 10, &uart0_queue, 0) my rx interrupt works correct but if i want to use write something on serial with uart_write_bytes() i get "Core 0 panic'ed (Interrupt wdt timeout on CPU0)" error. i know that if i use driver install like uart_driver_install(Serial0,1024,1024, 10, &uart0_queue, 0) ,uses tx ring buffer and write faster on serial , but when i use like this i cant write anything on serial.
how can i solve this?
my espidf version is 4.4.6
my code:
  1. uint8_t *ArrayTransmit_SR1;
  2. uint8_t *ArrayReceive_SR1;
  3. #define BUFF_SIZE_TRANSMIT (70000)
  4. #define BUFF_SIZE_TRANSMIT_MAX (69000)
  5. #define BUF_SIZE_RECEIVE (4096)
  6. #define Serial0 UART_NUM_0
  7. static void core0Handling(void *pvParameter)
  8. {
  9.     ArrayTransmit_SR1 = (uint8_t *) malloc(BUFF_SIZE_TRANSMIT);
  10.     ArrayReceive_SR1 = (uint8_t *) malloc(BUF_SIZE_RECEIVE);
  11.     int lenReceive_SR2,lenTransmit_SR2,lenReceive_SR1,lenTransmit_SR1;
  12.     while(1)
  13.     {
  14.          lenReceive_SR1 = recv(sock_SR1,(&ArrayReceive_SR1[0]), BUF_SIZE_RECEIVE , 0);    //receive data
  15.          if(lenReceive_SR1>0)    
  16.          {
  17.             // printf("%d\n",lenReceive_SR1);
  18.             uart_write_bytes(Serial0, (&ArrayReceive_SR1[0]) ,lenReceive_SR1);
  19.            
  20.          }
  21.   if(ReceiveCheck_SR1>5)
  22.          {
  23.             adrcopy_SR1=adr_SR1;
  24.             ReceiveCheck_SR1=0;
  25.             if(!shift_SR1)
  26.             {
  27.                    lenTransmit_SR1=send(sock_SR1, ((&ArrayTransmit_SR1[lastadr_SR1])), adrcopy_SR1-lastadr_SR1, 0);
  28.             }
  29.             else    //shift in buffer
  30.             {     lenTransmit_SR1=send(sock_SR1, (&ArrayTransmit_SR1[lastadr_SR1]), BUFF_SIZE_TRANSMIT_MAX - lastadr_SR1, 0);
  31.                 if(adrcopy_SR1)
  32.                 {
  33.                     lenTransmit_SR1=send(sock_SR1,(&ArrayTransmit_SR1[0]), adrcopy_SR1, 0);
  34.                 }
  35.                 shift_SR1=false;
  36.             }
  37.              lastadr_SR1=adrcopy_SR1;
  38.         }
  39. }
  40. void app_main(void)
  41. {
  42.     esp_err_t ret = nvs_flash_init();
  43.     if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
  44.     {
  45.       ESP_ERROR_CHECK(nvs_flash_erase());
  46.       ret = nvs_flash_init();
  47.     }
  48.  uart_param_config(Serial0, &uart_config);
  49.     uart_set_pin(Serial0, ECHO_TEST_TXD0, ECHO_TEST_RXD0, ECHO_TEST_RTS0, ECHO_TEST_CTS0);
  50.     uart_driver_install(Serial0,1024,1024, 10, &uart0_queue, 0);
  51.     uart_isr_free(Serial0);
  52.     uart_isr_register(Serial0,uart_intr_handle_SR2, NULL, ESP_INTR_FLAG_IRAM, &handle_console);
  53.     uart_enable_rx_intr(Serial0);
  54.  uart_param_config(Serial0, &uart_config);
  55.     uart_set_pin(Serial0, ECHO_TEST_TXD0, ECHO_TEST_RXD0, ECHO_TEST_RTS0, ECHO_TEST_CTS0);
  56.     uart_driver_install(Serial0,1024,1024, 10, &uart0_queue, 0);
  57.     uart_isr_free(Serial0);
  58.     uart_isr_register(Serial0,uart_intr_handle_SR2, NULL, ESP_INTR_FLAG_IRAM, &handle_console);
  59.     uart_enable_rx_intr(Serial0);
  60. TaskHandle_t HandleCore0;
  61.     xTaskCreatePinnedToCore(&core0Handling, "core0_task", 1024*5, 1024*5, tskIDLE_PRIORITY, &HandleCore0,1);
  62. }
  63.  
my error
  1. Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0).
  2.  
  3. Core  0 register dump:
  4. PC      : 0x40085bbd  PS      : 0x00050034  A0      : 0x40085330  A1      : 0x3ffb1090
  5. 0x40085bbd: uart_intr_handle at C:/Users/user/Desktop/uart_async_rxtxtasks/main/uart_async_rxtxtasks_main.c:97
  6.  
  7. 0x40085330: _xt_lowint1 at C:/Users/user/esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1114
  8.  
  9. A2      : 0xe000c000  A3      : 0x3ffbf860  A4      : 0x80084fa0  A5      : 0x4008d1b6
  10. 0x4008d1b6: _frxt_int_enter at C:/Users/user/esp/esp-idf/components/freertos/port/xtensa/portasm.S:119
  11.  
  12. A6      : 0x00000000  A7      : 0x3ffb1090  A8      : 0x80085c0e  A9      : 0x3ffb1040
  13. A10     : 0x00000000  A11     : 0x00000002  A12     : 0x80084fa0  A13     : 0x3ffbf7e0  
  14. A14     : 0x00000000  A15     : 0x3ffb1040  SAR     : 0x00000014  EXCCAUSE: 0x00000005
  15. EXCVADDR: 0x00000000  LBEG    : 0x400896c4  LEND    : 0x400896e0  LCOUNT  : 0xffffffff
  16. 0x400896c4: memcpy at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memcpy.S:175
  17.  
  18. 0x400896e0: memcpy at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memcpy.S:197
  19.  
  20. Core  0 was running in ISR context:
  21. EPC1    : 0x400d1f13  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x40085bbd
  22. 0x400d1f13: panic_print_char_uart at C:/Users/user/esp/esp-idf/components/esp_system/panic.c:80
  23.  
  24. 0x40085bbd: uart_intr_handle at C:/Users/user/Desktop/uart_async_rxtxtasks/main/uart_async_rxtxtasks_main.c:97
  25.  
  26.  
  27.  
  28. Backtrace: 0x40085bba:0x3ffb1090 0x4008532d:0x3ffb10d0 0x4000bfed:0x3ffbf870 0x400911b9:0x3ffbf880 0x400db951:0x3ffbf8a0 0x400dc8e5:0x3ffbf900
  29. 0x400dcb22:0x3ffbf980 0x400d8f22:0x3ffbf9c0
  30. 0x40085bba: uart_intr_handle at C:/Users/user/Desktop/uart_async_rxtxtasks/main/uart_async_rxtxtasks_main.c:97
  31.  
  32. 0x4008532d: _xt_lowint1 at C:/Users/user/esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1114
  33.  
  34. 0x400911b9: vPortClearInterruptMaskFromISR at C:/Users/user/esp/esp-idf/components/freertos/port/xtensa/include/freertos/portmacro.h:571
  35. (inlined by) vPortExitCritical at C:/Users/user/esp/esp-idf/components/freertos/port/xtensa/port.c:332
  36.  
  37. 0x400db951: uart_enable_tx_intr at C:/Users/user/esp/esp-idf/components/driver/uart.c:632
  38.  
  39. 0x400dc8e5: uart_tx_all at C:/Users/user/esp/esp-idf/components/driver/uart.c:1271
  40.  
  41. 0x400dcb22: uart_write_bytes at C:/Users/user/esp/esp-idf/components/driver/uart.c:1319

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: Core 0 panic'ed (Interrupt wdt timeout on CPU0) when i have tx ring buffer

Postby ESP_Sprite » Mon Feb 19, 2024 3:05 am

Generally, you can't both use the UART driver and use your own ISR. The driver needs the ISR to function to work.

Melika
Posts: 4
Joined: Sun Feb 18, 2024 9:32 am

Re: Core 0 panic'ed (Interrupt wdt timeout on CPU0) when i have tx ring buffer

Postby Melika » Mon Feb 19, 2024 12:06 pm

ESP_Sprite wrote:
Mon Feb 19, 2024 3:05 am
Generally, you can't both use the UART driver and use your own ISR. The driver needs the ISR to function to work.
Hi.thanks for answer.if i enable just tx interrupt,i get error .do you know how can i have tx interrupt ?

Who is online

Users browsing this forum: No registered users and 83 guests