a2dp_sink not works on last esp-idf (01 may 2022)

gravity
Posts: 3
Joined: Sun May 01, 2022 8:16 pm

a2dp_sink not works on last esp-idf (01 may 2022)

Postby gravity » Sun May 01, 2022 8:37 pm

Hi.

I'm try to startup a2dp_sink from esp-idf examples on last esp-idf framework.

First of all, i successfully run example 'i2s_basic' example and output sine-wave to my i2s card. It's approve, what i2s card is really works.

When i start a2dp_sink example on that scheme, it's startup. Next i'm connect it with bluetooth. That's part is ok.
Next i'm try to play music on my smartphone (or notebook with same result) - but there is no any sound and a lot of "BT_APPL: Pkt dropped" messages.

It seem's what example not work on last esp-idf.

Full logs of program runtime:


[Codebox]

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6612
load:0x40078000,len:14780
load:0x40080400,len:3792
0x40080400: _init at ??:?

entry 0x40080694
I (27) boot: ESP-IDF v4.4-dirty 2nd stage bootloader
I (27) boot: compile time 22:40:09
I (27) boot: chip revision: 1
I (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed : 40MHz
I (42) boot.esp32: SPI Mode : DIO
I (46) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (74) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (82) boot: 2 factory factory app 00 00 00010000 00100000
I (89) boot: End of partition table
I (93) boot_comm: chip revision: 1, min. application chip revision: 0
I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=1df10h (122640) map
I (154) esp_image: segment 1: paddr=0002df38 vaddr=3ffbdb60 size=020e0h ( 8416) load
I (157) esp_image: segment 2: paddr=00030020 vaddr=400d0020 size=783fch (492540) map
I (338) esp_image: segment 3: paddr=000a8424 vaddr=3ffbfc40 size=02540h ( 9536) load
I (342) esp_image: segment 4: paddr=000aa96c vaddr=40080000 size=17074h ( 94324) load
I (382) esp_image: segment 5: paddr=000c19e8 vaddr=50000000 size=00010h ( 16) load
I (394) boot: Loaded app from partition at offset 0x10000
I (394) boot: Disabling RNG early entropy source...
I (405) cpu_start: Pro cpu up.
I (406) cpu_start: Starting app cpu, entry point is 0x40081254
0x40081254: call_start_cpu1 at D:/DIY/esp/esp-idf/components/esp_system/port/cpu_start.c:156

I (0) cpu_start: App cpu up.
I (422) cpu_start: Pro cpu start user code
I (422) cpu_start: cpu freq: 240000000
I (422) cpu_start: Application information:
I (426) cpu_start: Project name: a2dp_sink
I (432) cpu_start: App version: 1
I (436) cpu_start: Compile time: May 1 2022 22:39:47
I (442) cpu_start: ELF file SHA256: d7f027987e9d670f...
I (448) cpu_start: ESP-IDF: v4.4-dirty
I (454) heap_init: Initializing. RAM available for dynamic allocation:
I (461) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (467) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (473) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (479) heap_init: At 3FFC9D68 len 00016298 (88 KiB): DRAM
I (485) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (491) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (498) heap_init: At 40097074 len 00008F8C (35 KiB): IRAM
I (505) spi_flash: detected chip: gd
I (508) spi_flash: flash io: dio
I (514) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (565) : tda8425 volume is: 234
E (575) I2S: i2s_set_apll_freq(915): Expected frequency is too small
E (575) I2S: set APLL coefficients failed
E (575) I2S: i2s_calculate_common_clock(1149): sample rate is too large
E (575) I2S: i2s_calculate_clock(1198): Common clock calculate failed
I (585) I2S: DMA Malloc info, datalen=blocksize=240, dma_buf_count=6
I (595) I2S: I2S0, MCLK output by GPIO0
I (595) BTDM_INIT: BT controller compile version [6a07b06]
I (605) system_api: Base MAC address is not set
I (605) system_api: read default base MAC address from EFUSE
I (615) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
W (1095) BT_BTC: A2DP Enable with AVRC
I (1105) BT_AV: A2DP PROF STATE: Init Compl

I (1105) BT_AV: event: 10
I (1115) BT_AV: event: 10
I (1115) BT_AV: event: 10
I (1115) BT_AV: event: 10
E (42085) BT_APPL: bta_av_rc_create ACP handle exist for shdl:0
I (42085) BT_AV: A2DP connection state: Connecting, [90:78:b2:72:58:a2]
I (42115) BT_AV: A2DP audio stream configuration, codec type 0
E (42115) I2S: i2s_set_apll_freq(915): Expected frequency is too small
E (42115) I2S: set APLL coefficients failed
E (42115) I2S: i2s_calculate_common_clock(1149): sample rate is too large
E (42125) I2S: i2s_calculate_clock(1198): Common clock calculate failed
I (42135) BT_AV: Configure audio player 21-15-2-35
I (42135) BT_AV: Audio player configured, sample rate=44100
W (42185) BT_APPL: new conn_srvc id:19, app_id:0
I (42185) BT_AV: A2DP connection state: Connected, [90:78:b2:72:58:a2]
I (42265) RCCT: AVRC conn_state evt: state 1, [90:78:b2:72:58:a2]
I (42265) RCCT: AVRC remote features 249, TG features 1
I (42275) RCCT: remote rn_cap: count 5, bitmask 0xc26
I (42295) RCCT: AVRC metadata rsp: attribute id 0x1,
I (42295) RCCT: AVRC metadata rsp: attribute id 0x2,
I (42295) RCCT: AVRC metadata rsp: attribute id 0x4,
I (42305) RCCT: AVRC metadata rsp: attribute id 0x20,
I (42305) RCTG: AVRC register event notification: 13, param: 0x0
I (45405) BT_AV: ESP_BT_GAP_MODE_CHG_EVT mode:2
I (51975) BT_AV: ESP_BT_GAP_MODE_CHG_EVT mode:0
I (52015) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

W (52015) BT_APPL: new conn_srvc id:19, app_id:1
I (52015) BT_AV: A2DP audio state: Started
I (52025) RCCT: AVRC event notification: 2
I (52025) RCCT: AVRC event notification: 1
I (52035) BT_AV: Playback status changed: 0x1
I (52035) RCCT: AVRC event notification: 5
I (52045) BT_AV: Play position changed: 87-ms
I (52105) RCCT: AVRC metadata rsp: attribute id 0x1, Tornado Of Souls
I (52115) RCCT: AVRC metadata rsp: attribute id 0x2, Megadeth
I (52115) RCCT: AVRC metadata rsp: attribute id 0x4, Rust In Peace
I (52115) RCCT: AVRC metadata rsp: attribute id 0x20,
W (52735) BT_APPL: Pkt dropped

W (52775) BT_APPL: Pkt dropped

W (52775) BT_APPL: Pkt dropped

W (52805) BT_APPL: Pkt dropped

W (52825) BT_APPL: Pkt dropped

W (52845) BT_APPL: Pkt dropped

W (52875) BT_APPL: Pkt dropped

W (52895) BT_APPL: Pkt dropped

W (52915) BT_APPL: Pkt dropped

W (52945) BT_APPL: Pkt dropped

W (52965) BT_APPL: Pkt dropped

W (52985) BT_APPL: Pkt dropped

W (53015) BT_APPL: Pkt dropped

W (53035) BT_APPL: Pkt dropped

W (53055) BT_APPL: Pkt dropped

W (53085) BT_APPL: Pkt dropped

W (53105) BT_APPL: Pkt dropped

W (53145) BT_APPL: Pkt dropped

W (53155) BT_APPL: Pkt dropped

W (53175) BT_APPL: Pkt dropped

W (53195) BT_APPL: Pkt dropped

W (53225) BT_APPL: Pkt dropped

W (53245) BT_APPL: Pkt dropped

W (53265) BT_APPL: Pkt dropped

W (53285) BT_APPL: Pkt dropped

W (53315) BT_APPL: Pkt dropped

W (53335) BT_APPL: Pkt dropped

W (53365) BT_APPL: Pkt dropped

W (53385) BT_APPL: Pkt dropped

W (53405) BT_APPL: Pkt dropped

W (53445) BT_APPL: Pkt dropped

W (53455) BT_APPL: Pkt dropped

W (53475) BT_APPL: Pkt dropped

W (53495) BT_APPL: Pkt dropped

W (53525) BT_APPL: Pkt dropped

W (53545) BT_APPL: Pkt dropped

W (53565) BT_APPL: Pkt dropped

W (53595) BT_APPL: Pkt dropped

W (53615) BT_APPL: Pkt dropped

W (53635) BT_APPL: Pkt dropped

W (53685) BT_APPL: Pkt dropped

W (53685) BT_APPL: Pkt dropped

W (53715) BT_APPL: Pkt dropped

W (53735) BT_APPL: Pkt dropped

W (53755) BT_APPL: Pkt dropped

W (53775) BT_APPL: Pkt dropped

W (53805) BT_APPL: Pkt dropped

W (53825) BT_APPL: Pkt dropped

W (53845) BT_APPL: Pkt dropped

W (53875) BT_APPL: Pkt dropped

W (53895) BT_APPL: Pkt dropped

W (53925) BT_APPL: Pkt dropped

W (53945) BT_APPL: Pkt dropped

W (53965) BT_APPL: Pkt dropped

W (53985) BT_APPL: Pkt dropped

W (54005) BT_APPL: Pkt dropped

W (54035) BT_APPL: Pkt dropped

W (54055) BT_APPL: Pkt dropped

W (54075) BT_APPL: Pkt dropped

W (54105) BT_APPL: Pkt dropped

W (54125) BT_APPL: Pkt dropped

W (54145) BT_APPL: Pkt dropped

W (54195) BT_APPL: Pkt dropped

W (54205) BT_APPL: Pkt dropped

W (54215) BT_APPL: Pkt dropped

W (54245) BT_APPL: Pkt dropped

W (54265) BT_APPL: Pkt dropped

W (54285) BT_APPL: Pkt dropped

W (54315) BT_APPL: Pkt dropped

W (54355) BT_APPL: Pkt dropped

W (54365) BT_APPL: Pkt dropped

W (54385) BT_APPL: Pkt dropped

W (54405) BT_APPL: Pkt dropped

W (54425) BT_APPL: Pkt dropped

W (54455) BT_APPL: Pkt dropped

W (54475) BT_APPL: Pkt dropped

W (54495) BT_APPL: Pkt dropped

W (54525) BT_APPL: Pkt dropped

W (54545) BT_APPL: Pkt dropped

W (54565) BT_APPL: Pkt dropped

W (54595) BT_APPL: Pkt dropped

W (54615) BT_APPL: Pkt dropped

W (54635) BT_APPL: Pkt dropped

W (54665) BT_APPL: Pkt dropped

W (54685) BT_APPL: Pkt dropped

W (54705) BT_APPL: Pkt dropped

W (54725) BT_APPL: Pkt dropped

W (54755) BT_APPL: Pkt dropped

W (54775) BT_APPL: Pkt dropped

W (54795) BT_APPL: Pkt dropped

W (54825) BT_APPL: Pkt dropped

W (54845) BT_APPL: Pkt dropped

W (54865) BT_APPL: Pkt dropped

W (54895) BT_APPL: Pkt dropped

W (54915) BT_APPL: Pkt dropped

W (54935) BT_APPL: Pkt dropped

W (54965) BT_APPL: Pkt dropped

W (54995) BT_APPL: Pkt dropped

W (55015) BT_APPL: Pkt dropped

W (55055) BT_APPL: Pkt dropped

W (55055) BT_APPL: Pkt dropped

W (55085) BT_APPL: Pkt dropped

W (55105) BT_APPL: Pkt dropped

W (55125) BT_APPL: Pkt dropped

W (55175) BT_APPL: Pkt dropped

W (55175) BT_APPL: Pkt dropped

W (55215) BT_APPL: Pkt dropped

W (55225) BT_APPL: Pkt dropped

W (55245) BT_APPL: Pkt dropped

W (55265) BT_APPL: Pkt dropped

W (55285) BT_APPL: Pkt dropped

W (55315) BT_APPL: Pkt dropped

W (55335) BT_APPL: Pkt dropped

W (55355) BT_APPL: Pkt dropped

W (55385) BT_APPL: Pkt dropped

W (55405) BT_APPL: Pkt dropped

W (55425) BT_APPL: Pkt dropped

W (55445) BT_APPL: Pkt dropped

W (55475) BT_APPL: Pkt dropped

W (55495) BT_APPL: Pkt dropped

W (55525) BT_APPL: Pkt dropped

W (55545) BT_APPL: Pkt dropped

W (55565) BT_APPL: Pkt dropped

W (55585) BT_APPL: Pkt dropped

W (55615) BT_APPL: Pkt dropped

W (55635) BT_APPL: Pkt dropped

W (55655) BT_APPL: Pkt dropped

W (55685) BT_APPL: Pkt dropped

W (55705) BT_APPL: Pkt dropped

W (55725) BT_APPL: Pkt dropped

W (55755) BT_APPL: Pkt dropped

W (55775) BT_APPL: Pkt dropped

W (55795) BT_APPL: Pkt dropped

W (55825) BT_APPL: Pkt dropped

W (55845) BT_APPL: Pkt dropped

W (55865) BT_APPL: Pkt dropped

W (55895) BT_APPL: Pkt dropped

W (55915) BT_APPL: Pkt dropped

W (55935) BT_APPL: Pkt dropped

W (55965) BT_APPL: Pkt dropped

W (55985) BT_APPL: Pkt dropped

W (56005) BT_APPL: Pkt dropped

W (56025) BT_APPL: Pkt dropped

W (56055) BT_APPL: Pkt dropped

W (56075) BT_APPL: Pkt dropped

W (56115) BT_APPL: Pkt dropped

W (56125) BT_APPL: Pkt dropped

W (56165) BT_APPL: Pkt dropped

W (56175) BT_APPL: Pkt dropped

W (56215) BT_APPL: Pkt dropped

W (56215) BT_APPL: Pkt dropped

W (56235) BT_APPL: Pkt dropped

W (56285) BT_APPL: Pkt dropped

W (56295) BT_APPL: Pkt dropped

W (56315) BT_APPL: Pkt dropped

W (56335) BT_APPL: Pkt dropped

W (56355) BT_APPL: Pkt dropped

W (56375) BT_APPL: Pkt dropped

W (56405) BT_APPL: Pkt dropped

W (56425) BT_APPL: Pkt dropped

W (56445) BT_APPL: Pkt dropped

W (56475) BT_APPL: Pkt dropped

W (56495) BT_APPL: Pkt dropped

W (56515) BT_APPL: Pkt dropped

W (56545) BT_APPL: Pkt dropped


[/Codebox]

gravity
Posts: 3
Joined: Sun May 01, 2022 8:16 pm

Re: a2dp_sink not works on last esp-idf (01 may 2022)

Postby gravity » Wed May 18, 2022 10:54 am

Hi.

Can anyone help with my question ?

Dymnop
Posts: 1
Joined: Thu Jun 16, 2022 9:45 pm

Re: a2dp_sink not works on last esp-idf (01 may 2022)

Postby Dymnop » Thu Jun 16, 2022 10:23 pm

I had a similar problem when switching from 4.3.1 to 4.4.1.

It ended up being because I didn't initialize all of the i2s_config_t parameters.

In particular it was because I needed to set fixed_mclk = 0.

The problem was that clk_cfg->mclk was being set to a random value. Below is the log of some of the internal calculations and the error:
E (3160) I2S: clk_cfg->mclk: 1073462992, rate: 44100, multi: 256
E (3162) I2S: expt_freq: 2146925984, o_div: -1
E (3163) I2S: i2s_set_apll_freq(916): Expected frequency is too small
E (3174) I2S: set APLL coefficients failed
E (3175) I2S: i2s_calculate_common_clock(1151): sample rate is too large
E (3187) I2S: i2s_calculate_clock(1200): Common clock calculate failed
I haven't tried with the example program, but I imagine it wouldn't have the same problem since uninitialized values in the struct should be initialized to 0 (due to the way it's initialized). In the case below I wanted to use

Code: Select all

.mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT
If fixed_mclk is set to a non-zero value it would use the fixed_mclk value like the case above, but I set it to 0 so:

clk_cfg->mclk = rate * multi
rate: sample_rate
multi: mclk_multiple

Log of the calculations with fixed_mclk = 0:
E (3181) I2S: clk_cfg->mclk: 11289600, rate: 44100, multi: 256
E (3182) I2S: expt_freq: 22579200, o_div: 6

gravity
Posts: 3
Joined: Sun May 01, 2022 8:16 pm

Re: a2dp_sink not works on last esp-idf (01 may 2022)

Postby gravity » Fri Sep 16, 2022 7:35 pm

Thank you! It's works!

Who is online

Users browsing this forum: No registered users and 60 guests