How to play PCM data in nRF5340 Audio-DK ?

Hi Nordic,

Could you please help me  to play the pcm static data in nRF5340 Audio DK.

Thanks & Regards,

PSR.

Parents
  • HI PSR,

    Apologies for the lack of response so far.

    Does your use-case require LE Audio, or do you want to get and play the PCM data on the same device?

    For the LE Audio case, you can refer to the audio_system and audio_datapath files in nrf5340_audio/src/audio.

    You can still refer to parts of the Audio application for the local case and use the unicast server or the broadcast sink. The CIS bidirectional walkie-talkie demo both records and plays audio: it records audio and transmits it to the peer device and it receives audio and plays it.

    Best regards,

    Maria

  • Hi Maria, 

    Both Boards are communicated getting beep sound,

    Now, i  integrated dmic Sample in unicast audio client, PCM audio buffer of dmic is given to lc3 encode function is 

     but other side(audio DK), I'm not getting Audio Stream.

    Thanks,

    PSR.

  • Hi PSR,

    PSR said:

    audio buffer of dmic is given to lc3 encode function is 

    In the sceenshot it looks like the end parenthesis is missing, but it is difficult to say for sure from a screen shot.

    Can you include the code snippet for this? (Insert -> Code)

    PSR said:
     but other side(audio DK), I'm not getting Audio Stream.

    Please share the device logs (Insert -> Code).

    Best regards,

    Maria

  • Hi Maria,


    lc3_ret = lc3_encode(lc3_encoder, LC3_PCM_FORMAT_S16, audio_buff, 1, octets_per_frame, net_buffer + offset); is the function.


    I want to change the AudioBuff PCM data every time. Is there a way to change the PCM data every 10 milliseconds?

  • Hi Maria,

     Could please review the logs.

    <inf> main: bt_mgmt_evt_handler: Connected
    <inf> bt_mgmt: connected_cb: ACL connection Connected: FD:9C:D5:71:5E:A6 (random)
     <inf> main: bt_mgmt_evt_handler: Connected
    <inf> main: bt_mgmt_evt_handler: Security changed
    <inf> main: bt_mgmt_evt_handler: Security changed
    <dbg> bt_ascs: ascs_ase_read: conn 0x20003e30 attr 0x938c0 buf 0x20021f42 len 64 offset 0
     <dbg> bt_ascs: ascs_ase_read_status_idle: conn 0x20003e30 id 0x01
     <dbg> bt_ascs: ascs_ase_cfg_changed: attr 0x938d4 value 0x0001
     <dbg> bt_ascs: ascs_cp_cfg_changed: attr 0x93898 value 0x0001
    <dbg> bt_ascs: ascs_ase_read: conn 0x20003e30 attr 0x938c0 buf 0x20021f42 len 64 offset 0
    <dbg> bt_ascs: ascs_ase_read_status_idle: conn 0x20003e30 id 0x01
    <dbg> bt_ascs: ascs_ase_cfg_changed: attr 0x938d4 value 0x0001
    <dbg> bt_ascs: ascs_cp_cfg_changed: attr 0x93898 value 0x0001
    <dbg> bt_ascs: ascs_ase_read: conn 0x20003e30 attr 0x938fc buf 0x20021f42 len 64 offset 0
    <dbg> bt_ascs: ascs_ase_read_status_idle: conn 0x20003e30 id 0x02
    <dbg> bt_ascs: ascs_ase_cfg_changed: attr 0x93910 value 0x0001
    <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 27 op Config Codec (0x01)
    <dbg> bt_ascs: ascs_config: num_ases 1
    <dbg> bt_ascs: ascs_config: ase 0x01 cc_len 16
    <dbg> bt_ascs: ascs_ep_init: ep 0x20004a74 id 0x01
    <dbg> bt_ascs: ase_new: conn 0x20003e30 new ase 0x20004a70 id 0x01
     <dbg> bt_ascs: ase_config: ase 0x20004a70 latency 0x02 phy 0x02 codec 0x06 cid 0x0000 vid 0x0000 codec config len 0x10
     <dbg> bt_ascs: ascs_ep_set_codec: ep 0x20004a74 dir sink codec id 0x06 cid 0x0000 vid 0x0000 len 16
    <inf> unicast_server: print_codec: LC3 codec config for sink:
     --- 10 messages dropped ---
    <inf> main: le_audio_msg_sub_thread: LE audio config received
    <inf> main: le_audio_msg_sub_thread: Sampling rate: 16000 Hz
     --- 10 messages dropped ---
     <dbg> bt_ascs: ascs_ase_read: conn 0x20003e30 attr 0x938fc buf 0x20021f42 len 64 offset 0
    <dbg> bt_ascs: ascs_ase_read_status_idle: conn 0x20003e30 id 0x02
    <dbg> bt_ascs: ascs_ase_cfg_changed: attr 0x93910 value 0x0001
    <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 27 op Config Codec (0x01)
    <dbg> bt_ascs: ascs_config: num_ases 1
    <dbg> bt_ascs: ascs_config: ase 0x01 cc_len 16
    <dbg> bt_ascs: ascs_ep_init: ep 0x20004a74 id 0x01
    <dbg> bt_ascs: ase_new: conn 0x20003e30 new ase 0x20004a70 id 0x01
    <dbg> bt_ascs: ase_config: ase 0x20004a70 latency 0x02 phy 0x02 codec 0x06 cid 0x0000 vid 0x0000 codec config len 0x10
    <dbg> bt_ascs: ascs_ep_set_codec: ep 0x20004a74 dir sink codec id 0x06 cid 0x0000 vid 0x0000 len 16
    <inf> unicast_server: print_codec: LC3 codec config for sink:
    <inf> main: le_audio_msg_sub_thread: LE audio config received
     <inf> main: le_audio_msg_sub_thread: Sampling rate: 16000 Hz
    <inf> main: le_audio_msg_sub_thread: Bitrate (compressed): 32000 bps
    --- 21 messages dropped ---
    <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 34 op Config QoS (0x02)
     --- 7 messages dropped ---
    <dbg> bt_ascs: ase_stream_qos: stream 0x20010258 ep 0x20004a74 qos 0x2001cc30
    <dbg> bt_ascs: ascs_cp_rsp_add: id 0x01 code Success (0x00) reason None (0x00)
     <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004b6c id 0x02 state qos-configured
    <dbg> bt_ascs: ascs_ep_get_status_qos: dir source codec id 0x06 interval 10000 framing 0x00 phy 0x02 rtn 2 latency 10 pd 40000
     <dbg> bt_ascs: state_transition_work_handler: ase 0x20004b68 id 0x02 codec-configured -> qos-configured
    <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004a74 id 0x01 state qos-configured
    <dbg> bt_ascs: ascs_ep_get_status_qos: dir sink codec id 0x06 interval 10000 framing 0x00 phy 0x02 rtn 2 latency 10 pd 40000
    <dbg> bt_ascs: state_transition_work_handler: ase 0x20004a70 id 0x01 codec-configured -> qos-configured
     <inf> main: le_audio_msg_sub_thread: Received event = 2, current state = 1
     --- 28 messages dropped ---
    <inf> main: le_audio_msg_sub_thread: Bitrate (compressed): 32000 bps
     <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 34 op Config QoS (0x02)
     <dbg> bt_ascs: ase_stream_qos: stream 0x20010258 ep 0x20004a74 qos 0x2001cc30
    <dbg> bt_ascs: ascs_cp_rsp_add: id 0x01 code Success (0x00) reason None (0x00)
    <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004b6c id 0x02 state qos-configured
     <dbg> bt_ascs: ascs_ep_get_status_qos: dir source codec id 0x06 interval 10000 framing 0x00 phy 0x02 rtn 2 latency 10 pd 40000
     <dbg> bt_ascs: state_transition_work_handler: ase 0x20004b68 id 0x02 codec-configured -> qos-configured
     <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004a74 id 0x01 state qos-configured
    <dbg> bt_ascs: ascs_ep_get_status_qos: dir sink codec id 0x06 interval 10000 framing 0x00 phy 0x02 rtn 2 latency 10 pd 40000
     <dbg> bt_ascs: state_transition_work_handler: ase 0x20004a70 id 0x01 codec-configured -> qos-configured
    <inf> main: le_audio_msg_sub_thread: Received event = 2, current state = 1
    <inf> main: le_audio_msg_sub_thread: Presentation delay 40000 us is set by initiator
    <inf> main: le_audio_msg_sub_thread: Received event = 2, current state = 1
    <inf> main: le_audio_msg_sub_thread: Presentation delay 40000 us is set by initiator
    <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 8 op Enable (0x03)
    <dbg> bt_ascs: ascs_enable: num_ases 1
    <dbg> bt_ascs: ase_enable: ase 0x20004a70 meta->len 4
    <dbg> bt_ascs: ascs_parse_metadata: type 0x02 len 2
    <dbg> bt_ascs: ascs_cp_rsp_add: id 0x01 code Success (0x00) reason None (0x00)
    <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004a74 id 0x01 state enabling
     <dbg> bt_ascs: ascs_ep_get_status_enable: dir sink cig 0x00 cis 0x00
    <dbg> bt_ascs: state_transition_work_handler: ase 0x20004a70 id 0x01 qos-configured -> enabling
     <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 8 op Enable (0x03)
    <dbg> bt_ascs: ascs_enable: num_ases 1
     <inf> main: le_audio_msg_sub_thread: Presentation delay 40000 us is set by initiator
    <inf> main: le_audio_msg_sub_thread: Received event = 2, current state = 1
    <inf> main: le_audio_mHL [00:00:08.563,171] <dbg> bt_ascs: ase_enable: ase 0x20004b68 meta->len 4
    <dbg> bt_ascs: ascs_parse_metadata: type 0x02 len 2
    sg_sub_thread: Presentation delay 40000 us is set by initiator
    <dbg> bt_ascs: ascs_cp_write: conHL [00:00:08.563,232] <dbg> bt_ascs: ascs_cp_rsp_add: id 0x02 code Success (0x00) reason None (0x00)
     n 0x20003e30 attr 0x93884 buf 0x20020b44 len 8 op Enable (0x03)
     <dbg> bt_ascs: ascs_enable: num_ases 1
     <dbg> bt_ascs: ase_enable: ase 0x20004a70 meta->len 4
    <dbg> bt_ascs: ascs_parse_metadata: type 0x02 len 2
     <dbg> bt_ascs: ascs_cp_rsp_add: id 0x01 code Success (0x00) reason None (0x00)
    <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004a74 id 0x01 state enabling
     <dbg> bt_ascs: ascs_ep_get_status_enable: dir sink cig 0x00 cis 0x00
    <dbg> bt_ascs: state_transition_work_handler: ase 0x20004a70 id 0x01 qos-configured -> enabling
     <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 8 op Enable (0x03)
    <dbg> bt_ascs: ascs_enable: num_ases 1
    <dbg> bt_ascs: ase_enable: ase 0x20004b68 meta->len 4
    <dbg> bt_ascs: ascs_parse_metadata: type 0x02 len 2
    <dbg> bt_ascs: ascs_cp_rsp_add: id 0x02 code Success (0x00) reason None (0x00)
    <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004b6c id 0x02 state enabling
     --- 6 messages dropped ---
     <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004a74 id 0x01 state streaming
    <dbg> bt_ascs: ascs_ep_get_status_enable: dir sink cig 0x00 cis 0x00
     <dbg> bt_ascs: state_transition_work_handler: ase 0x20004a70 id 0x01 enabling -> streaming
     <inf> unicast_server: stream_started_cb: Stream 0x20010258 started
    <inf> main: le_audio_msg_sub_thread: Received event = 3, current state = 1
     <inf> main: le_audio_msg_sub_thread: LE audio evt streaming
    <inf> audio_system: audio_headset_configure: audio_headset_configure
    <wrn> le_audio_rx: le_audio_rx_data_handler: Not in streaming state, throwing data: 1
    <wrn> le_audio_rx: le_audio_rx_data_handler: Not in streaming state, throwing data: 1
    <wrn> audio_datapath: audio_datapath_i2s_blk_complete: I2S RX overrun. Single msg
    <wrn> audio_datapath: audio_datapath_i2s_blk_complete: Data received, total under-runs: 10
    <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 3 op Receiver Start Ready (0x04)
     <dbg> bt_ascs: ascs_start: num_ases 1
     --- 6 messages dropped ---

     <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004b6c id 0x02 state enabling
    <dbg> bt_ascs: ascs_start: ase 0x02
    <dbg> bt_ascs: ase_start: ase 0x20004b68
     <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004a74 id 0x01 state streaming
    <dbg> bt_ascs: ascs_ep_get_status_enable: dir sink cig 0x00 cis 0x00
    <dbg> bt_ascs: ascs_cp_rsp_add: id 0x02 code Success (0x00) reason None (0x00)
    <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004b6c id 0x02 state streaming
    <dbg> bt_ascs: state_transition_work_handler: ase 0x20004a70 id 0x01 enabling -> streaming
    <dbg> bt_ascs: ascs_ep_get_status_enable: dir source cig 0x00 cis 0x00
    unicast_server: stream_started_cb: Stream 0x20010258 started
     <inf> main: le_audio_msg_sub_thread: Received event = 3, current state = 1
    <inf> main: le_audio_msg_sub_thread: LE audio evt streamHL [00:00:09.013,519] <dbg> bt_ascs: state_transition_work_handler: ase 0x20004b68 id 0x02 enabling -> streaming
     <inf> audio_system: audio_headset_configure: audio_headset_configure
     <inf> unicast_server: stream_started_cb: Stream 0x2001027c started
    <inf> main: le_audio_msg_sub_thread: Received event = 3, current state = 0
     <wrn> le_audio_rx: le_audio_rx_data_handler: Not in streaming state, throwing data: 1
    <inf> main: le_audio_msg_sub_thread: LE audio evt streaming
     <wrn> le_audio_rx: le_audio_rx_data_handler: Not in streaming state, throwing data: 1
     <wrn> audio_datapath: audHL [00:00:09.013,763] <inf> audio_system: audio_system_encoder_start: Encoder started
     io_datapath_i2s_blk_complete: I2S RX overrun. Single msg
     <wrn> audio_datapath: audio_datapath_i2s_blk_complete: I2S RX continuing stream
    <wrn> audio_datapath: audio_datapath_i2s_blk_complete: Data received, total under-runs: 10
    <wrn> audio_datapath: audio_datapath_i2s_blk_complete: Data received, total under-runs: 12
    <dbg> bt_ascs: ascs_cp_write: conn 0x20003e30 attr 0x93884 buf 0x20020b44 len 3 op Receiver Start Ready (0x04)<dbg> bt_ascs: ascs_start: num_ases 1
    <inf> audio_datapath: drift_comp_state_set: Drft comp state: CALIB
    <inf> audio_datapath: drift_comp_state_set: Drft comp state: OFFSET
    <inf> audio_datapath: drift_comp_state_set: Drft comp state: LOCKED
    <dbg> bt_ascs: ascs_start: ase 0x02
    <dbg> bt_ascs: ase_start: ase 0x20004b68
    <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: WAIT
     <dbg> bt_ascs: ascs_cp_rsp_add: id 0x02 code Success (0x00) reason None (0x00)
     <dbg> bt_ascs: ascs_ep_get_status: ep 0x20004b6c id 0x02 state streamingHL [00:00:09.944,824] <inf> audio_datapath: pres_comp_state_set: Pres comp state: INIT

    <dbg> bt_ascs: ascs_ep_get_status_enable: dir sHL [00:00:09.954,803] <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
    ource cig 0x00 cis 0x00
    <dbg> bt_ascs: state_transition_work_handler: ase 0x20004b68 id 0x02 enabling -> streaming <inf> unicast_server: stream_started_cb: Stream 0x2001027c started
    <inf> main: le_audio_msg_sub_thread: Received event = 3, current state = 0
    <inf> main: le_audio_msg_sub_thread: LE audio evt streaming
     <inf> audio_system: audio_system_encoder_start: Encoder started
    <wrn> audio_datapath: audio_datapath_i2s_blk_complete: I2S RX continuing stream
     <wrn> audio_datapath: audio_datapath_i2s_blk_complete: Data received, total under-runs: 12
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: CALIB
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: OFFSET
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: LOCKED
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: WAIT
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: INIT
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
    <inf> audio_datapath: pres_comp_state_set: Pres comp state: LOCKED
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: LOCKED

    Thanks,

    PSR.

  • Hi PSR,

    PSR said:
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: CALIB
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: OFFSET
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: LOCKED
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: WAIT
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: INIT
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
    <inf> audio_datapath: pres_comp_state_set: Pres comp state: LOCKED

    This part of the log indicates that the headset is able to sync to a stream. When you say that you are not able to get the stream, what are you observing, specifically?

    Best regards,

    Maria

Reply
  • Hi PSR,

    PSR said:
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: CALIB
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: OFFSET
     <inf> audio_datapath: drift_comp_state_set: Drft comp state: LOCKED
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: WAIT
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: INIT
     <inf> audio_datapath: pres_comp_state_set: Pres comp state: MEAS
    <inf> audio_datapath: pres_comp_state_set: Pres comp state: LOCKED

    This part of the log indicates that the headset is able to sync to a stream. When you say that you are not able to get the stream, what are you observing, specifically?

    Best regards,

    Maria

Children
No Data
Related