mkfrey / u8g2-hal-esp-idf

U8g2 compatibility component for esp-idf on ESP32
Apache License 2.0
55 stars 26 forks source link

ESP32 resetting frequently with u8g2 HAL #17

Open slyfoxneil opened 4 months ago

slyfoxneil commented 4 months ago

hello,

I am using esp-idf 5.2.1 . I was able to compile cleanly the u8g2 hal and u8g2 driver, There were no errors reported upon compilation.

However I am experiencing frequent resets, about 5 mins or more. I am using the u8g2 with ESPNOW. I hope someone can point me out where to look at for possible fix

Thanks in advance Neil Ablang #####################################################

Here is the log when the esp32 resets: ######################################################## I (476291) espnow_controller: Receive 445th unicast data from: 94:e6:86:06:b6:8c, len: 20 I (476291) espnow_controller: elapse: 475 seconds data -> 1 1 1 1 1 5 255 6 182 187 Distance --> 1718 mm I (477301) espnow_controller: Receive 446th unicast data from: 94:e6:86:06:b6:8c, len: 20 I (477301) espnow_controller: elapse: 476 seconds data -> 1 1 1 1 1 5 255 6 182 187 Distance --> 1718 mm I (478311) espnow_controller: Receive 447th unicast data from: 94:e6:86:06:b6:8c, len: 20 I (478311) espnow_controller: elapse: 477 seconds data -> 1 1 1 1 1 5 255 6 182 187 Distance --> 1718 mm I (479321) espnow_controller: Receive 448th unicast data from: 94:e6:86:06:b6:8c, len: 20 I (479321) espnow_controller: elapse: 478 seconds data -> 1 1 1 1 1 5 255 6 39 44 Distance --> 1575 mm I (480341) espnow_controller: Receive 449th unicast data from: 94:e6:86:06:b6:8c, len: 20 I (480341) espnow_controller: elapse: 479 seconds I (481041) espnow_controller: Turning off - no received data after: 240 seconds data -> 1 1 1 1 1 5 255 6 39 44 Distance --> 1575 mm

E (482141) err: esp_err_t = 263

assert failed: u8g2_esp32_i2c_byte_cb u8g2_esp32_hal.c:181 (0 && "i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, pdMS_TO_TICKS(I2C_TIMEOUT_MS))")

Backtrace: 0x400819be:0x3ffc8910 0x4008b7ed:0x3ffc8930 0x400932fd:0x3ffc8950 0x400dcd66:0x3ffc8a70 0x4016f6d9:0x3ffc8ab0 0x400dc6d3:0x3ffc8ad0 0x4016f54a:0x3ffc8af0 0x400dca52:0x3ffc8b10 0x400dcab1:0x3ffc8b30 0x4016f335:0x3ffc8b50 0x400dc7b6:0x3ffc8b80 0x400dc7d5:0x3ffc8ba0 0x400dc825:0x3ffc8bc0 0x400d8d3a:0x3ffc8be0 0x400d96eb:0x3ffc8c10 0x4008c3b5:0x3ffc8ca0 0x400819be: panic_abort at /home/neil/espressif_dev/v521/esp-idf-v5.2.1/components/esp_system/panic.c:472 0x4008b7ed: esp_system_abort at /home/neil/espressif_dev/v521/esp-idf-v5.2.1/components/esp_system/port/esp_system_chip.c:93 0x400932fd: __assert_func at /home/neil/espressif_dev/v521/esp-idf-v5.2.1/components/newlib/assert.c:81 0x400dcd66: u8g2_esp32_i2c_byte_cb at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2-hal-esp-idf/src/u8g2_esp32_hal.c:181 (discriminator 17) 0x4016f6d9: u8x8_byte_EndTransfer at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8x8_byte.c:61 0x400dc6d3: u8x8_cad_ssd13xx_fast_i2c at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8x8_cad.c:545 0x4016f54a: u8x8_cad_SendCmd at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8x8_cad.c:90 0x400dca52: u8x8_d_ssd1306_128x32_generic at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8x8_d_ssd1306_128x32.c:152 0x400dcab1: u8x8_d_ssd1306_128x32_univision at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8x8_d_ssd1306_128x32.c:211 0x4016f335: u8x8_DrawTile at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8x8_display.c:89 0x400dc7b6: u8g2_send_tile_row at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8g2_buffer.c:64 0x400dc7d5: u8g2_send_buffer at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8g2_buffer.c:87 0x400dc825: u8g2_SendBuffer at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/components/u8g2/csrc/u8g2_buffer.c:96 0x400d8d3a: OLED_Display at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/main/water_tank_controller.c:978 0x400d96eb: controller_espnow_task at /home/neil/eclipse-workspace_esp_idf_V52/WaterTankController/main/water_tank_controller.c:1404 0x4008c3b5: vPortTaskWrapper at /home/neil/espressif_dev/v521/esp-idf-v5.2.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

ELF file SHA256: 8683de2d7

Rebooting... ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:7172 load:0x40078000,len:15540 load:0x40080400,len:4 0x40080400: _init at ??:?

here is my usage function:

void OLED_Display(const char pump_status, const char level_str, const char *tank_info, int slider) {

//u8g2_ClearBuffer(&u8g2);
//u8g2_ClearDisplay(&u8g2);

//u8g2_SendBuffer(&u8g2);
//u8g2_UpdateDisplayArea(&u8g2, 0, 26/8,  WIDTHPXL/8  , 5/8);
u8g2_SendBuffer(&u8g2);

u8g2_SetDrawColor(&u8g2, 0);
u8g2_DrawBox(&u8g2, 0, 26, 128, 5);
u8g2_UpdateDisplayArea(&u8g2, 0, 26/8,  WIDTHPXL/8  , 5/8);
u8g2_SetDrawColor(&u8g2, 1);
u8g2_DrawFrame(&u8g2, 0, 26, WIDTHPXL, 5);
u8g2_DrawBox(&u8g2, 0, 26, slider, 5);
u8g2_UpdateDisplayArea(&u8g2, 0, 26/8,  WIDTHPXL/8  , 5/8);

u8g2_SetFont(&u8g2, u8g2_font_5x7_tr);
int w_tinfo = u8g2_GetStrWidth(&u8g2, tank_info);
u8g2_DrawStr(&u8g2, 98, 24, tank_info);
int h_tinfo = u8g2_GetAscent(&u8g2)- u8g2_GetDescent(&u8g2);
u8g2_UpdateDisplayArea(&u8g2,  (24-h_tinfo)/8, 98/8,  w_tinfo/8  , h_tinfo/8);
//u8g2_SendBuffer(&u8g2);
/*********************/
u8g2_SetFont(&u8g2, u8g2_font_ncenB08_tr);
int str_w1 = u8g2_GetStrWidth(&u8g2, pump_status);
int str_h1 = u8g2_GetAscent(&u8g2)- u8g2_GetDescent(&u8g2);
int str_w2 = u8g2_GetStrWidth(&u8g2, level_str);
int str_h2 = u8g2_GetAscent(&u8g2)- u8g2_GetDescent(&u8g2);

//printf("w1 %i, h1 %i\n",str_w1,str_h1);
//printf("w2 %i, h2 %i\n",str_w2,str_h2);

//u8g2_SendBuffer(&u8g2);

u8g2_SetDrawColor(&u8g2, 0);
u8g2_DrawBox(&u8g2, 0, 1, 68, str_h1);
u8g2_UpdateDisplayArea(&u8g2, 0, 0,  (str_w1)/8 + 2  , (str_h1+2)/8);
u8g2_SetDrawColor(&u8g2, 1);
str_w1 = u8g2_DrawStr(&u8g2, 2, str_h1-1, pump_status);
u8g2_UpdateDisplayArea(&u8g2, 0, 0,  (str_w1)/8 + 1  , (str_h1+2)/8);

u8g2_SetDrawColor(&u8g2, 0);
u8g2_DrawBox(&u8g2, 0, str_h2+2, 98, str_h2);
u8g2_UpdateDisplayArea(&u8g2, 0, 0,  (str_w2)/8 + 2  , (str_h2+2)/8);
u8g2_SetDrawColor(&u8g2, 1);
str_w2 = u8g2_DrawStr(&u8g2, 2, (str_h2)*2 + 2, level_str);
//u8g2_SendBuffer(&u8g2);
u8g2_UpdateDisplayArea(&u8g2, 0, (str_h2 + 2)/8, (str_w2)/8 + 1 , (str_h2)/8);

}

slyfoxneil commented 4 months ago

Already figured out why