Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal DAC audio broke in v4.4 (IDFGH-6715) #8344

Closed
cfint opened this issue Feb 3, 2022 · 5 comments
Closed

Internal DAC audio broke in v4.4 (IDFGH-6715) #8344

cfint opened this issue Feb 3, 2022 · 5 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@cfint
Copy link

cfint commented Feb 3, 2022

Environment

  • Development Kit: none
  • Kit version: none
  • Module or chip used: ESP32-WROOM-32
  • IDF: v5.0-dev-1446-ga470ae224d
  • Build System: idf.py
  • Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2021r2) 8.4.0
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: external 5V

Problem Description

I2S internal DAC produces garbled sound with A2DP-Sink example. I've bisected the problem to commit f7f8c9c. The prior commit (2f1247e) does not compile. The most recent working commit on the v4.4 branch is 12c76b4.

The problem still exists on on current master (a470ae2)

Expected Behavior

Analog sound playback through I2S internal DAC.

Actual Behavior

Internal DAC doesn't play correct sound.

Steps to reproduce

  1. Install A2DP-Sink example on an ESP32 board.
  2. Pair an iPhone bluetooth with the ESP32.
  3. Play music on iPhone through Bluetooth audio.
  4. Hear garbled audio.
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 3, 2022
@github-actions github-actions bot changed the title Internal DAC audio broke in v4.4 Internal DAC audio broke in v4.4 (IDFGH-6715) Feb 3, 2022
@negativekelvin
Copy link
Contributor

#8327

@cfint
Copy link
Author

cfint commented Feb 6, 2022

#8327

That patch works with pschatzmann/ESP32-A2DP. The A2DP-Sink example is kind of working. It has much louder audio and it's full of static.

@L-KAYA
Copy link
Collaborator

L-KAYA commented Feb 17, 2022

#8327

That patch works with pschatzmann/ESP32-A2DP. The A2DP-Sink example is kind of working. It has much louder audio and it's full of static.

@cfint That may be caused by the input signed value are output in unsigned value, try the following change to see if it can help:
in examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/bt_app_av.c line 403, replace the function bt_app_a2d_data_cb with

void bt_app_a2d_data_cb(const uint8_t *data, uint32_t len)
{
    uint8_t *recv_data = malloc(len);
    for (int i = 0; i < len; i++) {
        recv_data[i] = data[i] + 128;
    }
    write_ringbuf(recv_data, len);
    free(recv_data);

    /* log the number every 100 packets */
    if (++s_pkt_cnt % 100 == 0) {
        ESP_LOGI(BT_AV_TAG, "Audio packet count: %u", s_pkt_cnt);
    }
}

@karawin
Copy link

karawin commented Feb 21, 2022

Working with patch https://github.com/espressif/esp-idf/pull/8327/files

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Mar 3, 2022
espressif-bot pushed a commit that referenced this issue Mar 3, 2022
@dzanis
Copy link

dzanis commented Jun 3, 2022

This fix broke the I2S ADC, had to revert the old code back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

6 participants