Code: Select all
uart_flush_input(ECHO_UART_PORT_NUM);
while (1) {
memset (data,'\0',BUF_SIZE);
len=0;
// Read data from the UART
len= uart_read_bytes(ECHO_UART_PORT_NUM, data, (BUF_SIZE - 1), 20 / portTICK_PERIOD_MS);
if (len >= 1){
[i]
memset (data1,'\0',2048);
len1=0;
// Write data back to the UART
sprintf (data1," input from ESP1 %d %s",ctr++, data);
uart_write_bytes(ECHO_UART_PORT_NUM, (const char *)data1, strlen(data1));
ESP_LOGI(TAG, "%s",data1);
[/i]
}
}
assert failed: spinlock_acquire spinlock.h:135 (result == core_id || result == SPINLOCK_FREE)
0x40081aea: panic_abort at /home/balaji/esp/esp-idf/components/esp_system/panic.c:409
0x40085ec1: esp_system_abort at /home/balaji/esp/esp-idf/components/esp_system/esp_system.c:135
0x4008af01: __assert_func at /home/balaji/esp/esp-idf/components/newlib/assert.c:85
0x40088a8f: spinlock_acquire at /home/balaji/esp/esp-idf/components/esp_hw_support/include/spinlock.h:135
0x40086c09: vPortEnterCritical at /home/balaji/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:600
0x400d6d04: uart_tx_all at /home/balaji/esp/esp-idf/components/driver/uart.c:1185map
0x400d759d: uart_write_bytes at /home/balaji/esp/esp-idf/components/driver/uart.c:1221 (discriminator 2)
0x400d5b5a: echo_task at /home/balaji/esp/workspace/UART_PROJECT/ESP-1/main/ESP-1.c:86
0x400888cd: vPortTaskWrapper at /home/balaji/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:141
0x400810e8: call_start_cpu1 at /home/balaji/esp/esp-idf/components/esp_system/port/cpu_start.c:152
Could anyone throw some light on what could be wrong?
I had tried the uart echo example diligently and thought I understood it. I expect the echo to just add the additional string as copied into data1 in my example to be displayed on screen without crashes.