Page 1 of 1

BT_INIT: Malloc failed

Posted: Thu Jun 08, 2023 11:13 am
by dengbq
硬件 :esp32-s3 krovo v3
idf V4.4.4+adf master

用到语音识别和blufi,启动时blufi时,把BT_INIT: Malloc failed
打印内容:

I (0) cpu_start: App cpu up.
I (905) spiram: SPI SRAM memory test OK
I (914) cpu_start: Pro cpu start user code
I (914) cpu_start: cpu freq: 240000000
I (914) cpu_start: Application information:
I (917) cpu_start: Project name: qinglanEsp32
I (923) cpu_start: App version: 0.01
I (927) cpu_start: Compile time: Jun 8 2023 18:06:21
I (934) cpu_start: ELF file SHA256: a30a15399968c333...
I (939) cpu_start: ESP-IDF: v4.4.4-dirty
I (945) heap_init: Initializing. RAM available for dynamic allocation:
I (952) heap_init: At 3FCB3ED0 len 00035840 (214 KiB): D/IRAM
I (958) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (965) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (971) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (978) spiram: Adding pool of 8192K of external SPI memory to heap allocator
I (986) spi_flash: detected chip: gd
I (990) spi_flash: flash io: qio
I (994) sleep: Configure to isolate all GPIO pins in sleep state
I (1000) sleep: Enable automatic switching of GPIO sleep configuration
I (1008) coexist: coexist rom version e7ae62f
I (1013) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1028) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations

I (1042) ESP32: Start ESP32 main function.
I (1273) ESP32: Initializing SPIFFS
...
I (1427) pp: pp rom version: e7ae62f
I (1428) net80211: net80211 rom version: e7ae62f
I (1440) wifi:wifi driver task: 3fcb777c, prio:23, stack:6656, core=0
I (1440) system_api: Base MAC address is not set
I (1451) system_api: read default base MAC address from EFUSE
I (1459) wifi:wifi firmware version: 6567a16
I (1460) wifi:wifi certification version: v7.0
I (1460) wifi:config NVS flash: enabled
I (1471) wifi:config nano formating: disabled
I (1471) wifi:Init data frame dynamic rx buffer num: 32
I (1472) wifi:Init management frame dynamic rx buffer num: 32
I (1483) wifi:Init management short buffer num: 32
I (1484) wifi:Init static tx buffer num: 16
I (1485) wifi:Init tx cache buffer num: 32
I (1495) wifi:Init static tx FG buffer num: 2
I (1496) wifi:Init static rx buffer size: 1600
I (1497) wifi:Init static rx buffer num: 16
I (1507) wifi:Init dynamic rx buffer num: 32
I (1508) wifi_init: rx ba win: 16
I (1509) wifi_init: tcpip mbox: 32
I (1520) wifi_init: udp mbox: 6
I (1520) wifi_init: tcp mbox: 6
I (1521) wifi_init: tcp tx win: 5744
I (1531) wifi_init: tcp rx win: 5744
I (1532) wifi_init: tcp mss: 1440
I (1542) wifi_init: WiFi/LWIP prefer SPIRAM
I (1543) wifi_init: WiFi IRAM OP enabled
I (1544) wifi_init: WiFi RX IRAM OP enabled
I (1555) phy_init: phy_version 540,a5d905b,Oct 20 2022,19:36:11
I (1591) wifi:mode : sta (f4:12:fa:e3:5b:00)
I (1591) wifi:enable tsf
I (1592) ESP32: MAC:0xf4, 0x12, 0xfa, 0xe3, 0x5b, 0x0
I (1592) ESP32: WIFI_EVENT_STA_START
E (1593) ESP32: WIFI UUID: B502207DA117
I (1605) ESP32: WIFI PS type :1
I (1606) ESP32: SHA-256 for the partition table: : 4676d23eafddd0f29774c8e9bff6a36fa20eb41482c2a813692b3fa7459e4750
I (1615) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (1632) wifi:state: init -> auth (b0)
I (1620) ESP32: SHA-256 for bootloader: : bd5367aaefade7a8d2feb0e11e7322676797e6b85e2b2e5760c396e6ee604ff5
I (1634) wifi:state: auth -> assoc (0)
I (1645) ESP32: Running partion:factory
I (1651) wifi:state: assoc -> run (10)
I (1749) ESP32: SHA-256 for current firmware: : c1a33f36069ab468200dae0fdf500109e3f817dbedf517ef28bf4bca6d354795
I (1758) DRV8311: ES8311 in Slave mode
I (1771) gpio: GPIO[48]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (1780) ES7210: ES7210 in Slave mode
I (1790) ES7210: Enable ES7210_INPUT_MIC1
I (1794) ES7210: Enable ES7210_INPUT_MIC2
I (1798) ES7210: Enable ES7210_INPUT_MIC3
W (1802) ES7210: Enable TDM mode. ES7210_SDP_INTERFACE2_REG12: 2
I (1808) ES7210: config fmt 60
I (1815) ESP32_S3_KORVO_2: I2S0, MCLK output by GPIO0
I (1817) ESP32: Recorder has been created
I (1818) MODEL_LOADER:
Initializing models from SPIFFS, partition label: model

I (2017) MODEL_LOADER: Partition size: total: 2824001, used: 2084806

I (2174) AFE_SR: afe interface for speech recognition

I (2175) AFE_SR: AFE version: SR_V220727

E (2175) SR_SYS: Data cache should be 64KB
I (2186) AFE_SR: Initial auido front-end, total channel: 3, mic num: 2, ref num: 1

I (2187) AFE_SR: aec_init: 1, se_init: 1, vad_init: 1

I (2198) AFE_SR: wakenet_init: 1

model_name: wn9_nihaoxiaozhi model_data: /srmodel/wn9_nihaoxiaozhi/wn9_data
, tigger:v3, mode:2, p:0, (Nov 3 2022 11:49:16)hi_3_0.585_0.595
I (2914) AFE_SR: wake num: 3, mode: 0, (Nov 3 2022 11:49:26)

I (2916) MN: model_name: mn4_cn model_data: /srmodel/mn4_cn/mn4_cn_data
I (4790) MN: SINGLE_RECOGNITION: V4.5 CN; core: 0; (Nov 3 2022 11:49:18)

esp_mn_commands_update_from_sdkconfig
I (4792) MN_COMMAND: ---------------------SPEECH COMMANDS---------------------
I (4803) MN_COMMAND: Command ID0, phrase ID0: da kai kong tiao
I (4814) MN_COMMAND: ---------------------------------------------------------

I (4938) ESP32: [ 1.5 ] Connect to wifi ......
I (5008) ESP32: wifi_init_sta finished,ssid:qinglan2,password:[q29050102]
I (11652) wifi:state: run -> init (cc00)
I (11654) wifi:new:<1,0>, old:<1,1>, ap:<255,255>, sta:<1,1>, prof:1
I (11663) ESP32: WIFI DISCONNECTED:0.
E (13010) ESP32: UNEXPECTED EVENT:0,Timeout.
I (13011) ESP32: Try connect WIFI again.
E (13013) ESP32: [ 1.5 ] Connect to wifi failed.
I (13024) ESP32: 0 startBluefi
I (13025) BT_INIT: BT controller compile version [02bfb7f]
I (13027) BT_INIT: Bluetooth MAC: f4:12:fa:e3:5b:02

I (13038) ESP32: 1 startBluefi
I (13039) ESP32: 2 startBluefi
I (13068) ESP32: BD ADDR: f4:12:fa:e3:5b:02
I (13070) ESP32: bluefi_event_callback:0
I (13071) ESP32: BLUFI init finish
E (13073) BT_INIT: Malloc failed
E (13084) BT_HCI: CC evt: op=0x2008, status=0x7
I (13075) ESP32: BLUFI VERSION 0103
...

附sdkconfig:
sdkconfig.rar
(12.38 KiB) Downloaded 540 times

Re: BT_INIT: Malloc failed

Posted: Fri Jun 09, 2023 4:27 am
by dengbq
屏幕截图 2023-06-09 101212.png
屏幕截图 2023-06-09 101212.png (20.87 KiB) Viewed 5019 times
蓝牙这一块有问题,设置从优化从psram分配内存,动态分配内存,但根本不生效。
查看代码:
static void *malloc_internal_wrapper(size_t size)
{
void *p = heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA);
if(p == NULL) {
ESP_LOGE(BT_LOG_TAG, "Malloc failed");
}
return p;
}

写死了是用heap_caps_malloc来分配内存,代码有bug啊。