[i.MX8M nano] how to send audio to BT device.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[i.MX8M nano] how to send audio to BT device.

Jump to solution
4,314 Views
bryan_hong
Contributor V

Hello

I use the i.MX 8M nano EVK, and SW 5.1.0.

When I play any wav file on EVK, I try to send that wav audio to BT device.

First, let me know how to connect BT device, for example headset or BT speaker. and then how to send that wav audio to BT device.

Below is what I try to connect BT device.
===
[bluetooth]# show

Controller AA:AA:AA:AA:AA:AA (public)

Name: imx8mnddr4ab2

Alias: imx8mnddr4ab2

Class: 0x00200000

Powered: yes

Discoverable: no

DiscoverableTimeout: 0x000000b4

Pairable: yes

UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)

UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)

UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)

UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)

Modalias: usb:v1D6Bp0246d0532

Discovering: no

[bluetooth]# pair 1C:52:16:15:EC:B4
Attempting to pair with 1C:52:16:15:EC:B4
[CHG] Device 1C:52:16:15:EC:B4 Connected: yes
[CHG] Device 1C:52:16:15:EC:B4 Paired: yes
Pairing successful
[CHG] Device 1C:52:16:15:EC:B4 Connected: no
[bluetooth]# paired-devices
Device 1C:52:16:15:EC:B4 QCY-T1_R
[bluetooth]# connect 1C:52:16:15:EC:B4
Attempting to connect to 1C:52:16:15:EC:B4
Failed to connect: org.bluez.Error.Failed
===

 

thanks
bryan

 

0 Kudos
1 Solution
4,202 Views
bryan_hong
Contributor V

Hello weidong

Good NEWS~

I figure it out the difference connecting for BT Cypress and NXP88W8987. plz refer `Cypress_NXP88W8987.jpg`

AND

The sound good~ with below cmd.

gst-launch-1.0 filesrc location=/home/root/KNOCK_KNOCK.mp3 ! id3demux ! queue ! mpegaudioparse ! beepdec ! pulsesink

thanks
Bryan

View solution in original post

0 Kudos
18 Replies
4,203 Views
bryan_hong
Contributor V

Hello weidong

Good NEWS~

I figure it out the difference connecting for BT Cypress and NXP88W8987. plz refer `Cypress_NXP88W8987.jpg`

AND

The sound good~ with below cmd.

gst-launch-1.0 filesrc location=/home/root/KNOCK_KNOCK.mp3 ! id3demux ! queue ! mpegaudioparse ! beepdec ! pulsesink

thanks
Bryan

0 Kudos
4,303 Views
bryan_hong
Contributor V

My EVK for i.MX 8M nano is 8MNANOD4-CPU CPU board that contains the DDR4 memory and BD71850MWV PMIC. 

 

0 Kudos
4,301 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Bryan,

See the link, please!

https://community.nxp.com/t5/Wireless-Connectivity-Knowledge/The-A2DP-Audio-Configuration-Based-On-8...

 

Have a good day!

Regards,

weidong

0 Kudos
4,295 Views
bryan_hong
Contributor V

@weidong_sun
thanks for your document and comments.

I have success `Test for connection #1 #2` but The sound continuously came out or not . It means sound is on blink.

BT timeout error happned.
[ 7540.392960] Bluetooth: hci0: command 0x1009 tx timeout

What to doubt is, After I execute `hciattach /dev/ttymxc0 any -s 3000000 3000000 flow`, timeout happned. so I have performed connection #1 #2 without that cmd.

thanks
Bryan

 

0 Kudos
4,278 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

If you don't use phy, just MAC to MAC connections, what device do you want to connect to MAC of I.MX8MN?

Switch? or others?

you should configure dts according to your schematic. if it is a switch, it's driver should be added in linux kernel.

 

Have a good day!

Regards,

weidong

0 Kudos
4,273 Views
bryan_hong
Contributor V

Hello weidong

In my opinion, the cause is that the BT speed cannot be set to 3000000.

After I execute `killall hciattach`, If I execute `hcihciattach /dev/ttymxc0 any -s 3000000 3000000 flow` tx timeout message happened as below.

===
root@imx8mnddr4evk:~# killall hciattach

root@imx8mnddr4evk:~# hciattach /dev/ttymxc0 any -s 3000000 3000000 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4evk:~#  [ 2651.066060] Bluetooth: hci0: command 0x1003 tx timeout
[ 2653.082044] Bluetooth: hci0: command 0x1001 tx timeout
[ 2655.098026] Bluetooth: hci0: command 0x1009 tx timeout
root@imx8mnddr4evk:~# 
===


After that, it could not up hci0.
===
root@imx8mnddr4evk:~# hciconfig hci0 up
[ 3125.618982] Bluetooth: hci0: command 0x1003 tx timeout
[ 3127.634943] Bluetooth: hci0: command 0x1001 tx timeout
[ 3129.650897] Bluetooth: hci0: command 0x1009 tx timeout
Can't init device hci0: Connection timed out (110)
root@imx8mnddr4evk:~# 
===

Is there patch for CYW43455 alike 88w8987(https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Porting-MARVELL-WIFI-BT-88w8987-to-i-MX8...)

plz any clue for this issue.

thanks
Bryan

0 Kudos
4,245 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

We have no patch for CYW43455 . Let calculate speed for audio.

Assue sample rate of music : 48K, 2 channel and 16bit.

48000x2x16=1.536M.

so you can try to set speed 1536000, 18000000, 2000000 etc.

above speed is enough for your music.

 

Have a good day!

Regards,

weidong

0 Kudos
4,238 Views
bryan_hong
Contributor V

Hello weidong
Really thanks for your comments.

The biggest problem on my side, If I execute below cmd, 
`hciattach /dev/ttymxc0 any -s 1536000 1536000 flow`

tx timeout message happened. 
[ 219.357281] Bluetooth: hci0: command 0x1009 tx timeout

I hope your comments.

===
root@imx8mnddr4ab2:~# hciattach /dev/ttymxc0 any 115200 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4ab2:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1
DOWN
RX bytes:676 acl:0 sco:0 events:35 errors:0
TX bytes:427 acl:0 sco:0 commands:35 errors:0

root@imx8mnddr4ab2:~# hciconfig hci0 up
root@imx8mnddr4ab2:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:1408 acl:0 sco:0 events:78 errors:0
TX bytes:1206 acl:0 sco:0 commands:78 errors:0

root@imx8mnddr4ab2:~# hcitool -i hci0 cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x00
< HCI Command: ogf 0x3f, ocf 0x0009, plen 4
C0 C6 2D 00
> HCI Event: 0x0e plen 4
01 09 FC 01
root@imx8mnddr4ab2:~# killall hciattach
root@imx8mnddr4ab2:~# [ 1290.569364] Bluetooth: hci0: sending frame failed (-49)

root@imx8mnddr4ab2:~# hciattach /dev/ttymxc0 any -s 3000000 3000000 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4ab2:~# [ 1300.509279] Bluetooth: hci0: command 0x1003 tx timeout
[ 1302.525280] Bluetooth: hci0: command 0x1001 tx timeout

root@imx8mnddr4ab2:~# [ 1304.541286] Bluetooth: hci0: command 0x1009 tx timeout

root@imx8mnddr4ab2:~# hciconfig hci0 up
[ 1313.021282] Bluetooth: hci0: command 0x1003 tx timeout
[ 1315.037277] Bluetooth: hci0: command 0x1001 tx timeout
[ 1317.053278] Bluetooth: hci0: command 0x1009 tx timeout
Can't init device hci0: Connection timed out (110)
root@imx8mnddr4ab2:~#
root@imx8mnddr4ab2:~#
root@imx8mnddr4ab2:~#
root@imx8mnddr4ab2:~#
root@imx8mnddr4ab2:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:24 acl:0 sco:0 commands:6 errors:0
===

thanks
Bryan

0 Kudos
4,232 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi byan,

 you can try these standard baud rate:

230400、460800、921600, 1843200(1.8432M)

and check if timeout.

 

Regards,

weidong

0 Kudos
4,228 Views
bryan_hong
Contributor V

Hello weidong
I execute below cmd  
hciattach /dev/ttymxc0 any -s 230400 230400 flow
hciattach /dev/ttymxc0 any -s 460800 460800 flow
hciattach /dev/ttymxc0 any -s 230400 230400 flow

but it still happened tx timeout message. 
if you have any clue, let me know. plz help me.

===

root@imx8mnddr4evk:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:1408 acl:0 sco:0 events:78 errors:0
TX bytes:1206 acl:0 sco:0 commands:78 errors:0

root@imx8mnddr4evk:~# hcitool -i hci0 cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x00
< HCI Command: ogf 0x3f, ocf 0x0009, plen 4
C0 C6 2D 00
> HCI Event: 0x0e plen 4
01 09 FC 01
root@imx8mnddr4evk:~# killall hciattach

root@imx8mnddr4evk:~# [252506.226703] Bluetooth: hci0: sending frame failed (-49)

root@imx8mnddr4evk:~# hciattach /dev/ttymxc0 any 230400 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4evk:~# [252537.510074] Bluetooth: hci0: command 0x1003 tx timeout
[252539.526033] Bluetooth: hci0: command 0x1001 tx timeout
[252541.542009] Bluetooth: hci0: command 0x1009 tx timeout

root@imx8mnddr4evk:~# killall hciattach
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# hciattach /dev/ttymxc0 any 460800 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4evk:~# [252564.005663] Bluetooth: hci0: command 0x1003 tx timeout

root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# [252566.021627] Bluetooth: hci0: command 0x1001 tx timeout

root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# [252568.037595] Bluetooth: hci0: command 0x1009 tx timeout

root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# killall hciattach
root@imx8mnddr4evk:~# hciattach /dev/ttymxc0 any 921600 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4evk:~# [252590.085253] Bluetooth: hci0: command 0x1003 tx timeout

root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# [252592.101217] Bluetooth: hci0: command 0x1001 tx timeout
[252594.117188] Bluetooth: hci0: command 0x1009 tx timeout

root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# killall hciattach
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# hciattach /dev/ttymxc0 any 1843200 flow
Setting TTY to N_HCI line discipline
Device setup complete
root@imx8mnddr4evk:~# [252606.212997] Bluetooth: hci0: command 0x1003 tx timeout

root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~#
root@imx8mnddr4evk:~# [252608.228968] Bluetooth: hci0: command 0x1001 tx timeout

root@imx8mnddr4evk:~# [252610.244941] Bluetooth: hci0: command 0x1009 tx timeout

root@imx8mnddr4evk:~#
===
thanks
Bryan

0 Kudos
4,225 Views
bryan_hong
Contributor V

Hello weidong

I have antoher evk for `i.Mx8M nano DDR4` and `MCIMX8M-AUD`.
so I have build with below cmd.

EULA=1 MACHINE=imx8mnddr4ab2 DISTRO=fsl-imx-xwayland source ./fsl-setup-af.sh -b build_imx8mnddr4ab2
BTW, I can not found these cmd `/usr/bin/pulseaudio, pactl, pacmd, paplay`

I think package is missing, do you know which package to add and how ?

thanks

Bryan

0 Kudos
4,220 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Byan,

The rootfs image that I used is imx-image-multimedia.

audio tools have been compiled into the rootfs.

 

Regard,

weidong

0 Kudos
4,209 Views
bryan_hong
Contributor V

Hello

You are right. If I use imx-image-multimedia, pulseaudio,pactl,pacmd be embedded to rootfs, but if i use fsl-image-af-littlekernel, that command did not be embedded to rootfs.

Can you give me a clue as to why this is happening and which files to review?

thanks
Bryan

0 Kudos
4,225 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Bryan,

It seems that 11520 setting is no problem, in order to confirm if BT audio is working, unders 115200 baud rate, Can you try to play music with .wav format using A2DP and check if it can be heard by BT headset?

 

Regards,

weidong

0 Kudos
4,210 Views
bryan_hong
Contributor V

Hello weidong

I can play music with .wav format using A2DP but the sound is blink.

If I unplug antenna on EVK, BT disconnected. so Can I guess that the antenna performance is bad?

thanks
Bryan

0 Kudos
4,283 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Bryan,

 

I have no way to reproduce the issue you encounterred.

are you using imx8mn-evk which supports AW-CM358SM module?

 

Have a good day!

regards,

weidong

0 Kudos
4,280 Views
bryan_hong
Contributor V

Hello weidong

My imx8mn-evk is DDR4 version. so Wi-Fi/BT module is Murata Type 1MW(CYW43455)

thanks
Bryan

0 Kudos
4,309 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Can you please tell us the EVK version that you are using? those have differents BT devices.

Regards

 

0 Kudos