espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.54k stars 7.26k forks source link

BLE Init Malloc failed (IDFGH-13885) #14729

Open emesamwong opened 22 hours ago

emesamwong commented 22 hours ago

Answers checklist.

General issue report

I am developing a matter device with LCD & touch panel (lvgl component V7.11.0). When starting the Matter Provisioning (BLE & WiFi), it contains error as below: Screenshot from 2024-10-15 17-31-48 the LCD buff size is 240 240 2 / 6 Here is the image size info: Screenshot from 2024-10-15 17-32-43

Since I am aware that the static IRAM is 100% used, I tried to decrease the LCD buffer size, there was no error but the Matter Commissioning was not working, and I could not scan the device. the LCD buff size is 240 240 2 / 10 Screenshot from 2024-10-15 17-41-23 Here is the image size info: Screenshot from 2024-10-15 17-39-24

When the LCD buff size is 240 240 2 / 15, scan the device successfully but still pairing failed Screenshot from 2024-10-15 18-01-46Screenshot from 2024-10-15 18-36-11

Here is the image size info: Screenshot from 2024-10-15 18-10-55

Chip-tool Log show: CHIP Error 0x00000003: Incorrect state ChipTool Log.txt

The LCD buffer is using DRAM. According to my testing, seems the BLE/WiFi/Matter-related resource crashes with LCD which contains a huge buffer.

  1. How to check the BLE/WiFi/Matter-related resource sizes like how many sizes of IRAM/DRAM for BLE/WiFi/Matter-releated.
  2. How to fix the "BLE_INIT: Malloc failed" error and pair the Devive to Matter nwk via chip-tool?
  3. Would it be another issue that led to the pairing failure?

Please me know if more information is required. Thank you

Environment: esp-matter: SHA: 2f692ac10a connectedhomeip: SHA: 8e3d98c0 esp-idf: SHA: 482a8fb (Tag: v5.1.2) ESP32-S3-WROOM-1 N16R8 Linux VS code

bryghtlabs-richard commented 13 hours ago

Can you try moving things out to PSRAM to free up D/IRAM?

emesamwong commented 8 hours ago

@bryghtlabs-richard I tried to enable the PSRAM as below: Screenshot from 2024-10-16 08-51-31 However, the project build failed as below: Screenshot from 2024-10-16 09-01-36

Once I disabled the "Allow .bss segment placed in external memory", the project build was successful but the BLE pairing issue was not fixed. As I know, the buffer is set to PSRAM when the option is enabled. Is that correct?

Is any configuration required for the PSRAM?