samples/bluetooth/unicast_audio_server doesn't configure heap memory for IPC #72708
Labels
area: Bluetooth Audio
area: Bluetooth
bug
The issue is a bug, or the PR is fixing a bug
platform: nRF
Nordic nRFx
priority: low
Low impact/importance bug
Describe the bug
I built the samples/bluetooth/unicast_audio_server for the nrf5340_audio_dk_nrf5340_cpuapp core/board. The sysbuild for that sample in turn builds samples/bluetooth/hci_ipc for nrf5340_audio_dk_nrf5340_cpunet core/board.
The application core and network core on the nrf5340 talk to each other using IPC RPMSG.
After flashing both images I saw that the network core allocates memory for the RPMSG virtqueue correctly (the memory allocation is done by this call to virtqueue_allocate: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/ipc/ipc_service/lib/ipc_static_vrings.c#L117) but the application core fails this call to virtqueue_allocate.
After a little digging I found that virtqueue_allocate is backed by modules/hal/libmetal and it expects CONFIG_HEAP_MEM_POOL_SIZE > 0. I checked the .config file, the network core has CONFIG_HEAP_MEM_POOL_SIZE=8192 but the application core has CONFIG_HEAP_MEM_POOL_SIZE unconfigured (though it has CONFIG_HEAP_MEM_POOL_ADD_SIZE_BOARD=4096).
After I added CONFIG_HEAP_MEM_POOL_SIZE=8192 to samples/bluetooth/unicast_audio_server/prj.conf, the application core can initialize IPC RPMSG correctly.
It seems either samples/bluetooth/unicast_audio_server needs that configuration, or libmetal should be smarter in memory allocation?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
samples/bluetooth/unicast_audio_server on nrf5340_audio_dk_nrf5340_cpuapp should successfully initialize IPC.
Impact
It slowed me down significantly in getting started with the NRF5340 Audio DK.
Logs and console output
Below are UART logs from the application core, including some of my custom printf logs:
static vrings init
metal_io_init
libmetal_setup
vq_setup, vring size 308
err -12
*** Booting Zephyr OS build v3.6.0-12-g7b42d8f8f9d7 ***
[00:00:00.258,239] bt_hci_driver: IPC service instance initialization failed:2
[00:00:00.258,239] bt_hci_core: HCI driver open failed (-12)
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: