UART Send more than 255 bytes = Guru Meditation Error

Mickael
Posts: 10
Joined: Mon Jul 22, 2019 9:25 am

UART Send more than 255 bytes = Guru Meditation Error

Postby Mickael » Wed Jun 03, 2020 2:49 pm

Hello,

I want to transmit more than 255 bytes using UART but when my TX_Buffer is more than 255, I have this error :

Code: Select all

Guru Meditation Error: Core  0 panic'ed (LoadStoreError). Exception was unhandled.
Core 0 register dump:
PC      : 0x400d5b00  PS      : 0x00060031  A0      : 0x40082678  A1      : 0x3ffb0640  
A2      : 0x3ffbdaf0  A3      : 0x00000100  A4      : 0x3ff6e000  A5      : 0x00000800  
A6      : 0x00000002  A7      : 0x00000002  A8      : 0x6002e000  A9      : 0x40000000  
A10     : 0x00000060  A11     : 0x3ffbe2f0  A12     : 0x40000001  A13     : 0x3ffbf778  
A14     : 0x00000001  A15     : 0x00060123  SAR     : 0x0000001b  EXCCAUSE: 0x00000003  
EXCVADDR: 0x40000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  
Core 0 was running in ISR context:
EPC1    : 0x400d5b00  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x00000000

ELF file SHA256: 7052ebfa7d775cacacb3b0192312fefff95b10d0f4c086249794ce568db43645

Backtrace: 0x400d5afd:0x3ffb0640 0x40082675:0x3ffb0690 0x4000bfed:0x3ffb6830 |<-CORRUPTED
here a part of my code :

Code: Select all

#define RX_CIRCULAR_BUFF_LENGTH 2048
# define TAB_SIZE 255

tU8Bits tui8_WifiRx_UartTx_Buffer[RX_CIRCULAR_BUFF_LENGTH] = {0};

void create_tab(tU32Bits ui32_lenght, tU8Bits* tui8_buffer)
{
  tU32Bits ui32_index = 0;
  //tU8Bits min = 0 , max = 255;
  for(ui32_index = 0 ; ui32_index <= ui32_lenght; ui32_index++)
  {
    tui8_buffer[ui32_index] = 'B';//(rand() % (max - min + 1)) + min;
  }
  tui8_buffer[0] = 'X';
}

static void uart_init(void)
{
  uart_config_t uart_config =
  {
    .baud_rate = 3000000,
    .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 = 255,
  };

  //Set UART parameters
  uart_param_config(UART_NUM_2, &uart_config);
  //Set UART pins TODO : set the right TX RX RTS CTS pins
  uart_set_pin(UART_NUM_2, 17, 16, 21, 22); // 25,35 uart_set_pin(UART_NUM_2, 27, 26, 13, 15);
  //Install UART driver, and get the queue.
  uart_driver_install(UART_NUM_2, 4096, 8192, 20, &uart2_queue, 0);

  xTaskCreate(uart2_task, "u2Task", 4096, NULL, 5, NULL);
}

void app_main()
{
  ESP_ERROR_CHECK( nvs_flash_init() );
  uart_init();
  create_tab(TAB_SIZE, tui8_WifiRx_UartTx_Buffer);
  while(1){
	  uart_write_bytes(UART_NUM_2, (const char *)tui8_WifiRx_UartTx_Buffer, TAB_SIZE);
	  TMR_MSleep(5000);
  }
}
So my question is : is it possible to send buffer more than 255 bytes ? If yes how please ? :)

Thanks

sonshitsu
Posts: 1
Joined: Fri Sep 16, 2022 7:22 pm

Re: UART Send more than 255 bytes = Guru Meditation Error

Postby sonshitsu » Fri Sep 16, 2022 7:22 pm

Mickael wrote:
Wed Jun 03, 2020 2:49 pm
Hello,

I want to transmit more than 255 bytes using UART but when my TX_Buffer is more than 255, I have this error :

Code: Select all

Guru Meditation Error: Core  0 panic'ed (LoadStoreError). Exception was unhandled.
Core 0 register dump:
PC      : 0x400d5b00  PS      : 0x00060031  A0      : 0x40082678  A1      : 0x3ffb0640  
A2      : 0x3ffbdaf0  A3      : 0x00000100  A4      : 0x3ff6e000  A5      : 0x00000800  
A6      : 0x00000002  A7      : 0x00000002  A8      : 0x6002e000  A9      : 0x40000000  
A10     : 0x00000060  A11     : 0x3ffbe2f0  A12     : 0x40000001  A13     : 0x3ffbf778  
A14     : 0x00000001  A15     : 0x00060123  SAR     : 0x0000001b  EXCCAUSE: 0x00000003  
EXCVADDR: 0x40000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  
Core 0 was running in ISR context:
EPC1    : 0x400d5b00  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x00000000

ELF file SHA256: 7052ebfa7d775cacacb3b0192312fefff95b10d0f4c086249794ce568db43645

Backtrace: 0x400d5afd:0x3ffb0640 0x40082675:0x3ffb0690 0x4000bfed:0x3ffb6830 |<-CORRUPTED
here a part of my code :

Code: Select all

#define RX_CIRCULAR_BUFF_LENGTH 2048
# define TAB_SIZE 255

tU8Bits tui8_WifiRx_UartTx_Buffer[RX_CIRCULAR_BUFF_LENGTH] = {0};

void create_tab(tU32Bits ui32_lenght, tU8Bits* tui8_buffer)
{
  tU32Bits ui32_index = 0;
  //tU8Bits min = 0 , max = 255;
  for(ui32_index = 0 ; ui32_index <= ui32_lenght; ui32_index++)
  {
    tui8_buffer[ui32_index] = 'B';//(rand() % (max - min + 1)) + min;
  }
  tui8_buffer[0] = 'X';
}

static void uart_init(void)
{
  uart_config_t uart_config =
  {
    .baud_rate = 3000000,
    .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 = 255,
  };

  //Set UART parameters
  uart_param_config(UART_NUM_2, &uart_config);
  //Set UART pins TODO : set the right TX RX RTS CTS pins
  uart_set_pin(UART_NUM_2, 17, 16, 21, 22); // 25,35 uart_set_pin(UART_NUM_2, 27, 26, 13, 15);
  //Install UART driver, and get the queue.
  uart_driver_install(UART_NUM_2, 4096, 8192, 20, &uart2_queue, 0);

  xTaskCreate(uart2_task, "u2Task", 4096, NULL, 5, NULL);
}

void app_main()
{
  ESP_ERROR_CHECK( nvs_flash_init() );
  uart_init();
  create_tab(TAB_SIZE, tui8_WifiRx_UartTx_Buffer);
  while(1){
	  uart_write_bytes(UART_NUM_2, (const char *)tui8_WifiRx_UartTx_Buffer, TAB_SIZE);
	  TMR_MSleep(5000);
  }
}
So my question is : is it possible to send buffer more than 255 bytes ? If yes how please ? :)

Thanks
Thank you.

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

Re: UART Send more than 255 bytes = Guru Meditation Error

Postby ESP_Sprite » Sun Sep 18, 2022 1:40 am

That should be possible. Can you decode that backtrace?

Who is online

Users browsing this forum: ghmyers, Google [Bot] and 116 guests