Maximum iso data length of NRF5340 audio increased

Hello,

I am using bis gateway on nrf5340 audio dk to transmit data.

In addition to audio encoded data, I also wanted to send some additional data, so I put these data after the audio encoded data and sent them together, and then I encountered the -EMSGSIZE error.

It seems that the maximum iso data length is 120, if the data length exceeds this size, it will not be transmitted.

Can this maximum length be increased?

Parents
  • Hi,

    Do you use nrf5340_audio application? Can you show your changes?

    Do you use I2S or USB?

    Can you provide a full error log?

    Best regards,
    Dejan

  • Yes, I use nrf5340_audio application, and I use USB in.

    Here are my changes, I increased the data length when sending it.

    [audio_system.c]

    static void encoder_thread(void *arg1, void *arg2, void *arg3)
    {
        ...
        if (sw_codec_cfg.encoder.enabled) {
    			/* Send encoded data over IPM */
    			//streamctrl_encoded_data_send(encoded_data, encoded_data_size);
    			streamctrl_encoded_data_send(my_data, 520);
    		}
    	STACK_USAGE_PRINT("encoder_thread", &encoder_thread_data);
    	}
    }

    And I added the max data related log to iso_chan_max_data_len function in iso.c.

    [iso.c]

    static uint16_t iso_chan_max_data_len(const struct bt_iso_chan *chan,
    				      uint32_t ts)
    {
    	...
    	/* Update the max_data_len to take the max_controller_data_len into account */
    	max_data_len = MIN(max_data_len, max_controller_data_len);
    	BT_INFO("Max data len:%d",max_data_len);
    	BT_INFO("Max Controller data len:%d",max_controller_data_len);
    
    	return max_data_len;
    }

    This is the config I added in prj.conf.

    CONFIG_BT_ISO_TX_MTU=2048
    CONFIG_BT_ISO_RX_MTU=2048

    Then this is my error log.

    GW [00:00:00.130,798] <inf> bis_gateway: Broadcast source 0x2000bc78 started
    GW [00:00:00.131,134] <inf> bis_gateway: Broadcast source 0x2000bc9c started
    GW [00:00:11.588,470] <inf> bt_iso: Max data len:120
    GW [00:00:11.588,470] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:11.588,470] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:11.588,470] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:11.588,500] <wrn> streamctrl: Problem with sending LE audio data, ret: -122

  • Hi,

    Which NCS version do you use?

    Can you show full log?

    Best regards,
    Dejan

  • The NCS version I use is v2.2.0.

    Here is the full log.

    SEGGER J-Link V7.88j - Real time terminal output
    SEGGER J-Link V9.7, SN=20722384
    Process: JLink.exe
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    
    
    GW [00:00:00.001,922] <dbg> bt_hci_core: bt_hci_driver_register: Registered RPMsg
    GW [00:00:00.002,807] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.2.0                            
             Cmake run : Tue Jun 11 09:11:00 2024
    GW [00:00:00.002,807] <inf> fw_info: ------- DEBUG BUILD -------
    GW [00:00:00.002,838] <inf> fw_info: Compiled for GATEWAY device
    GW [00:00:00.002,838] <inf> ble: cw_uicr_get_32:ffffffff
    GW [00:00:00.002,838] <inf> ble: cw_uicr_get_16:ffff
    GW [00:00:00.002,929] <dbg> bt_hci_core: hci_tx_thread: Started
    GW [00:00:00.002,929] <dbg> bt_conn: bt_conn_prepare_events: 
    GW [00:00:00.002,960] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 2 events
    GW [00:00:00.003,112] <dbg> bt_hci_driver: bt_rpmsg_open: 
    --- 836 messages dropped ---
    GW [00:00:05.020,019] <dbg> bt_hci_driver: bt_rpmsg_rx: RX buf payload:
                                               a4 34 05 00 01 10 00 00  00                      |.4...... .       
    GW [00:00:06.019,592] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x1001 param_len 0
    GW [00:00:06.019,592] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x2001f0c8
    GW [00:00:06.019,622] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x2001f0c8 opcode 0x1001 len 3
    GW [00:00:06.019,653] <dbg> bt_hci_core: process_events: count 4
    GW [00:00:06.019,653] <dbg> bt_hci_core: process_events: ev->state 4
    GW [00:00:06.019,683] <dbg> bt_hci_core: send_cmd: calling net_buf_get
    GW [00:00:06.019,683] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
    GW [00:00:06.019,683] <dbg> bt_hci_core: send_cmd: Sending command 0x1001 (buf 0x2001f0c8) to driver
    GW [00:00:06.019,714] <dbg> bt_hci_core: bt_send: buf 0x2001f0c8 len 3 type 0
    GW [00:00:06.019,714] <dbg> bt_hci_driver: bt_rpmsg_send: buf 0x2001f0c8 type 0 len 3
    GW [00:00:06.019,744] <dbg> bt_hci_driver: bt_rpmsg_send: Final HCI buffer:
                                               01 01 10 00                                      |....             
    GW [00:00:06.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:06.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:06.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:06.019,805] <dbg> bt_conn: bt_conn_prepare_events: 
    GW [00:00:06.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002450 to poll list
    GW [00:00:06.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002518 to poll list
    GW [00:00:06.019,836] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 4 events
    GW [00:00:06.019,897] <dbg> bt_hci_driver: bt_rpmsg_rx: RPMsg data:
                                               04 0e 0c 01 01 10 00 0b  ee 0c 0b e8 07 ee 0c    |........ ....... 
    GW [00:00:06.019,897] <dbg> bt_hci_driver: bt_rpmsg_evt_recv: len 12
    GW [00:00:06.019,897] <dbg> bt_hci_driver: bt_rpmsg_rx: Calling bt_recv(0x2001f0c8)
    GW [00:00:06.019,927] <dbg> bt_hci_core: bt_recv: buf 0x2001f0c8 len 14
    GW [00:00:06.019,927] <dbg> bt_hci_core: hci_cmd_complete: opcode 0x1001
    GW [00:00:06.019,927] <dbg> bt_hci_core: hci_cmd_done: opcode 0x1001 status 0x00 buf 0x2001f0c8
    GW [00:00:06.019,958] <dbg> bt_hci_core: bt_hci_cmd_send_sync: rsp 0x2001f0c8 opcode 0x1001 len 9
    GW [00:00:06.020,019] <dbg> bt_hci_driver: bt_rpmsg_rx: RX buf payload:
                                               01 31 00 00 00 0b 00 20  8e                      |.1.....  .       
    GW [00:00:07.019,592] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x1001 param_len 0
    GW [00:00:07.019,622] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x2001f0c8
    GW [00:00:07.019,622] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x2001f0c8 opcode 0x1001 len 3
    GW [00:00:07.019,653] <dbg> bt_hci_core: process_events: count 4
    GW [00:00:07.019,653] <dbg> bt_hci_core: process_events: ev->state 4
    GW [00:00:07.019,683] <dbg> bt_hci_core: send_cmd: calling net_buf_get
    GW [00:00:07.019,683] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
    GW [00:00:07.019,683] <dbg> bt_hci_core: send_cmd: Sending command 0x1001 (buf 0x2001f0c8) to driver
    GW [00:00:07.019,683] <dbg> bt_hci_core: bt_send: buf 0x2001f0c8 len 3 type 0
    GW [00:00:07.019,714] <dbg> bt_hci_driver: bt_rpmsg_send: buf 0x2001f0c8 type 0 len 3
    GW [00:00:07.019,714] <dbg> bt_hci_driver: bt_rpmsg_send: Final HCI buffer:
                                               01 01 10 00                                      |....             
    GW [00:00:07.019,744] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:07.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:07.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:07.019,775] <dbg> bt_conn: bt_conn_prepare_events: 
    GW [00:00:07.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002450 to poll list
    GW [00:00:07.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002518 to poll list
    GW [00:00:07.019,805] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 4 events
    GW [00:00:07.019,866] <dbg> bt_hci_driver: bt_rpmsg_rx: RPMsg data:
                                               04 0e 0c 01 01 10 00 0b  ee 0c 0b e8 07 ee 0c    |........ ....... 
    GW [00:00:07.019,866] <dbg> bt_hci_driver: bt_rpmsg_evt_recv: len 12
    GW [00:00:07.019,897] <dbg> bt_hci_driver: bt_rpmsg_rx: Calling bt_recv(0x2001f0c8)
    GW [00:00:07.019,897] <dbg> bt_hci_core: bt_recv: buf 0x2001f0c8 len 14
    GW [00:00:07.019,897] <dbg> bt_hci_core: hci_cmd_complete: opcode 0x1001
    GW [00:00:07.019,897] <dbg> bt_hci_core: hci_cmd_done: opcode 0x1001 status 0x00 buf 0x2001f0c8
    GW [00:00:07.019,927] <dbg> bt_hci_core: bt_hci_cmd_send_sync: rsp 0x2001f0c8 opcode 0x1001 len 9
    GW [00:00:07.019,958] <dbg> bt_hci_driver: bt_rpmsg_rx: RX buf payload:
                                               8e 02 03 00 0c 00 00 00  06                      |........ .       
    GW [00:00:07.926,574] <inf> bt_iso: Max data len:120
    GW [00:00:07.926,574] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.926,605] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.926,605] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:07.926,605] <wrn> streamctrl: Problem with sending LE audio data, ret: -122
    GW [00:00:07.936,584] <inf> bt_iso: Max data len:120
    GW [00:00:07.936,584] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.936,584] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.936,584] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:07.946,563] <inf> bt_iso: Max data len:120
    GW [00:00:07.946,563] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.946,594] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.946,594] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:07.956,573] <inf> bt_iso: Max data len:120
    GW [00:00:07.956,573] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.956,604] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.956,604] <wrn> bis_gateway: Failed to send audio data: -122

Reply
  • The NCS version I use is v2.2.0.

    Here is the full log.

    SEGGER J-Link V7.88j - Real time terminal output
    SEGGER J-Link V9.7, SN=20722384
    Process: JLink.exe
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    
    
    GW [00:00:00.001,922] <dbg> bt_hci_core: bt_hci_driver_register: Registered RPMsg
    GW [00:00:00.002,807] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.2.0                            
             Cmake run : Tue Jun 11 09:11:00 2024
    GW [00:00:00.002,807] <inf> fw_info: ------- DEBUG BUILD -------
    GW [00:00:00.002,838] <inf> fw_info: Compiled for GATEWAY device
    GW [00:00:00.002,838] <inf> ble: cw_uicr_get_32:ffffffff
    GW [00:00:00.002,838] <inf> ble: cw_uicr_get_16:ffff
    GW [00:00:00.002,929] <dbg> bt_hci_core: hci_tx_thread: Started
    GW [00:00:00.002,929] <dbg> bt_conn: bt_conn_prepare_events: 
    GW [00:00:00.002,960] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 2 events
    GW [00:00:00.003,112] <dbg> bt_hci_driver: bt_rpmsg_open: 
    --- 836 messages dropped ---
    GW [00:00:05.020,019] <dbg> bt_hci_driver: bt_rpmsg_rx: RX buf payload:
                                               a4 34 05 00 01 10 00 00  00                      |.4...... .       
    GW [00:00:06.019,592] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x1001 param_len 0
    GW [00:00:06.019,592] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x2001f0c8
    GW [00:00:06.019,622] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x2001f0c8 opcode 0x1001 len 3
    GW [00:00:06.019,653] <dbg> bt_hci_core: process_events: count 4
    GW [00:00:06.019,653] <dbg> bt_hci_core: process_events: ev->state 4
    GW [00:00:06.019,683] <dbg> bt_hci_core: send_cmd: calling net_buf_get
    GW [00:00:06.019,683] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
    GW [00:00:06.019,683] <dbg> bt_hci_core: send_cmd: Sending command 0x1001 (buf 0x2001f0c8) to driver
    GW [00:00:06.019,714] <dbg> bt_hci_core: bt_send: buf 0x2001f0c8 len 3 type 0
    GW [00:00:06.019,714] <dbg> bt_hci_driver: bt_rpmsg_send: buf 0x2001f0c8 type 0 len 3
    GW [00:00:06.019,744] <dbg> bt_hci_driver: bt_rpmsg_send: Final HCI buffer:
                                               01 01 10 00                                      |....             
    GW [00:00:06.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:06.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:06.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:06.019,805] <dbg> bt_conn: bt_conn_prepare_events: 
    GW [00:00:06.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002450 to poll list
    GW [00:00:06.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002518 to poll list
    GW [00:00:06.019,836] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 4 events
    GW [00:00:06.019,897] <dbg> bt_hci_driver: bt_rpmsg_rx: RPMsg data:
                                               04 0e 0c 01 01 10 00 0b  ee 0c 0b e8 07 ee 0c    |........ ....... 
    GW [00:00:06.019,897] <dbg> bt_hci_driver: bt_rpmsg_evt_recv: len 12
    GW [00:00:06.019,897] <dbg> bt_hci_driver: bt_rpmsg_rx: Calling bt_recv(0x2001f0c8)
    GW [00:00:06.019,927] <dbg> bt_hci_core: bt_recv: buf 0x2001f0c8 len 14
    GW [00:00:06.019,927] <dbg> bt_hci_core: hci_cmd_complete: opcode 0x1001
    GW [00:00:06.019,927] <dbg> bt_hci_core: hci_cmd_done: opcode 0x1001 status 0x00 buf 0x2001f0c8
    GW [00:00:06.019,958] <dbg> bt_hci_core: bt_hci_cmd_send_sync: rsp 0x2001f0c8 opcode 0x1001 len 9
    GW [00:00:06.020,019] <dbg> bt_hci_driver: bt_rpmsg_rx: RX buf payload:
                                               01 31 00 00 00 0b 00 20  8e                      |.1.....  .       
    GW [00:00:07.019,592] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x1001 param_len 0
    GW [00:00:07.019,622] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x2001f0c8
    GW [00:00:07.019,622] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x2001f0c8 opcode 0x1001 len 3
    GW [00:00:07.019,653] <dbg> bt_hci_core: process_events: count 4
    GW [00:00:07.019,653] <dbg> bt_hci_core: process_events: ev->state 4
    GW [00:00:07.019,683] <dbg> bt_hci_core: send_cmd: calling net_buf_get
    GW [00:00:07.019,683] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
    GW [00:00:07.019,683] <dbg> bt_hci_core: send_cmd: Sending command 0x1001 (buf 0x2001f0c8) to driver
    GW [00:00:07.019,683] <dbg> bt_hci_core: bt_send: buf 0x2001f0c8 len 3 type 0
    GW [00:00:07.019,714] <dbg> bt_hci_driver: bt_rpmsg_send: buf 0x2001f0c8 type 0 len 3
    GW [00:00:07.019,714] <dbg> bt_hci_driver: bt_rpmsg_send: Final HCI buffer:
                                               01 01 10 00                                      |....             
    GW [00:00:07.019,744] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:07.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:07.019,775] <dbg> bt_hci_core: process_events: ev->state 0
    GW [00:00:07.019,775] <dbg> bt_conn: bt_conn_prepare_events: 
    GW [00:00:07.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002450 to poll list
    GW [00:00:07.019,805] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20002518 to poll list
    GW [00:00:07.019,805] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 4 events
    GW [00:00:07.019,866] <dbg> bt_hci_driver: bt_rpmsg_rx: RPMsg data:
                                               04 0e 0c 01 01 10 00 0b  ee 0c 0b e8 07 ee 0c    |........ ....... 
    GW [00:00:07.019,866] <dbg> bt_hci_driver: bt_rpmsg_evt_recv: len 12
    GW [00:00:07.019,897] <dbg> bt_hci_driver: bt_rpmsg_rx: Calling bt_recv(0x2001f0c8)
    GW [00:00:07.019,897] <dbg> bt_hci_core: bt_recv: buf 0x2001f0c8 len 14
    GW [00:00:07.019,897] <dbg> bt_hci_core: hci_cmd_complete: opcode 0x1001
    GW [00:00:07.019,897] <dbg> bt_hci_core: hci_cmd_done: opcode 0x1001 status 0x00 buf 0x2001f0c8
    GW [00:00:07.019,927] <dbg> bt_hci_core: bt_hci_cmd_send_sync: rsp 0x2001f0c8 opcode 0x1001 len 9
    GW [00:00:07.019,958] <dbg> bt_hci_driver: bt_rpmsg_rx: RX buf payload:
                                               8e 02 03 00 0c 00 00 00  06                      |........ .       
    GW [00:00:07.926,574] <inf> bt_iso: Max data len:120
    GW [00:00:07.926,574] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.926,605] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.926,605] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:07.926,605] <wrn> streamctrl: Problem with sending LE audio data, ret: -122
    GW [00:00:07.936,584] <inf> bt_iso: Max data len:120
    GW [00:00:07.936,584] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.936,584] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.936,584] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:07.946,563] <inf> bt_iso: Max data len:120
    GW [00:00:07.946,563] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.946,594] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.946,594] <wrn> bis_gateway: Failed to send audio data: -122
    GW [00:00:07.956,573] <inf> bt_iso: Max data len:120
    GW [00:00:07.956,573] <inf> bt_iso: Max Controller data len:1536
    GW [00:00:07.956,604] <inf> bt_iso: Cannot send 520 octets, maximum 120
    GW [00:00:07.956,604] <wrn> bis_gateway: Failed to send audio data: -122

Children
No Data
Related