When Huangshan Pai enables Bluetooth audio, a memory error occurs when connecting to the Xiao Zhi server.

While working on the Huangshan branch, I found that during Bluetooth audio playback, connecting to the Xiaozhi server via WebClient causes a system crash due to malloc failure. When I checked memory usage via the msh script’s ‘free’ command, I found that total memory was around 300 KB. With Bluetooth audio playback enabled, the memory status showed: total memory: 310652, used memory: 178084, maximum allocated memory: 272984. If connecting to the Xiaozhi server at this point, the system crashes immediately due to insufficient memory.

transparent

image

You can upload a dump and log file.


This means enabling the Bluetooth sink in the Huangshanpai program. The code modifications for bt_sink in the SDK are shown above. When playing audio via Bluetooth, connecting to the Xiao Zhi server triggers a system crash, and the log shows a malloc failure. On my side, due to uncertainty about whether the PAN disconnection and reconnection are handled correctly, I used a 5-second timer to periodically send Xiao Zhi’s webclient event to check PAN connectivity, and this issue was discovered during that process.

Please send a serial port log.

image This kind?

Yes, you can upload this file.

sifli.txt (27.9 KB) The procedure is to first enable Bluetooth audio, then enable PAN.

Will Xiao Zhi crash if not connected?

The device won’t crash if not connected to Xiao Zhi. It seems that the memory allocated by the audio_open function is in the internal SRAM. The issue could be resolved by switching malloc to allocate memory from external PSRAM instead. I haven’t examined your SDK’s network component in detail, but it likely also uses malloc to directly allocate internal SRAM. My suggestion is to add a configuration switch in menuconfig to allow choosing between internal and external RAM.

image Please follow this procedure to generate a crash dump, so I can check how the memory is configured.

lpsys_aon_reg.bin (264 字节)

log.txt (3.0 KB)

image
You need to compress and upload the entire folder after dumping, along with the compiled files such as main.axf, main.bin, and main.map.

sifli_202511208.7z (159.3 KB), is this it?

image

You also need these files from the build folder after compilation.

sifli_20251209.7z (5.8 MB) The board was remade by us, and the underlying board-level files have been modified.

image

image

Looks like there might be a memory leak somewhere. Can you please check it?

Alright, I’ll check it. Thank you.