-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
The esp32 i2s internal DAC output is not working with the release 2.0.1 #5938
Comments
PTAL, @PilnyTomas. relates to: espressif/esp-idf#7684 |
It did work until V2.0.0-rc2 |
Do you have news for this @PilnyTomas ? |
Hi, sorry for the late response - I was working on other tasks. |
I found the braking commit, from Oct 1, 2021: 00214d5c2a1c2b1904f2caf6f0d5ddfe952331ff |
We are now discussing the issue with ESP-IDF team, we will let you know about the update. |
Maybe this https://www.esp32.com/viewtopic.php?t=6025 |
Maybe this could be related to ? |
I doubt. I did some detour on |
@s-hadinger What is the version of the arduino core that you are using? |
I use 2.0.2 with IDF 4.4. I believe the problem is in idf, not Arduino Core. One highly possible cause is that the calculated Values calculated by IDF 4.4 for 16000Hz audio, DAC, 2 channels Hardware registers:
The overflow may explain why I got random results, and why I only could get something to work by increasing Edit: for information,
Edit2: 1250 (0x4E2) would be truncated to 226 (0xE2) which could explain why the playback was 11x times the normal rate. |
I have now confirmation. For 16000Hz, 2 channels, internal DAC is 8 bits. Knowing that the My working version sets: I'm still unclear whether a and b factors have an influence. |
I opened a new issue with these information espressif/esp-idf#8326 |
Recompiling esp-idf with the fix above(thanks @Jason2866) makes Audio DAC working again. Here are the new values computed: |
The framework with the idf i2s fix is here if anyone wants to try. |
@Jason2866 Thanks for your framework but what is exactly the fix done inside the idf? |
This is still broken (I2S using I2S_MODE_DAC_BUILT_IN) - it still does not work for Arduino ESP32 core v. 2.0.3 |
@pjmi1 Please open a new issue with specifications for your problem. Please include a complete sketch that demonstrates the issue. |
I can confirm this is still broken in Arduino 2.0.4, IDF 4.4.1 Not sure why we need to open a new bug for this @PilnyTomas? Here is the sketch I used. If I change from internal DAC to PDM it works although really noisy.
|
Hi @ifrew I tried your code and it takes 110 seconds to generate that 0.25sec tone. Please try improving tone generation. |
@PilnyTomas It isn't actually my code, I was just using an example I found to show the potential issue. However, I did find the issue in the example. as I stated in #6856. Thanks for getting back though. |
I have tried IDF example and the output is very laggy, so I opened an issue for the IDF team |
The esp32 I2s internal DAC output is NOT working with the release 2.0.5 I tested yesterday the last Board Manager release 2.0.5 and a sketch to generate a sinus signal with I2S and the internal DAC output. Same result: Not Working! HW: Adafruit ESP32 feather and an oscilloscope With the Board Manager 2.0.0 the sketch works but all the Board Manager > 2.0.0 have same bug Is there any work around? Note: I discovered the bug trying to evaluate the Adafruit ESP32 feather V2. You need to upgrade the Board Manager to 2.0.4 |
@cicciocb, @ifrew, @pjmi1, can you please try this sketch if it works for you? It does for me. |
this sketch <https://github.com/PilnyTomas/issues/blob/4b5315b5547165c9f080fd3e993dce24bf0fe7bf/issue_7252B/issue_7252B.ino> is also working for me
But:
.use_apll = 1
produces sporadic glitches with the Arduino Board Manager 2.0.5 . See: espressif/esp-idf#9321
Alternatives:
.use_apll = 0 (For my application is fine)
or
Arduino Board Manager 1.0.6 .use_apll = 1 does not produce glitches
Best whishes
De: Tomáš Pilný ***@***.***
Enviado el: lunes, 17 de octubre de 2022 17:12
Para: espressif/arduino-esp32
CC: JoseEnriqueFA; Comment
Asunto: Re: [espressif/arduino-esp32] The esp32 i2s internal DAC output is not working with the release 2.0.1 (Issue #5938)
Can you please try this sketch <https://github.com/PilnyTomas/issues/blob/4b5315b5547165c9f080fd3e993dce24bf0fe7bf/issue_7252B/issue_7252B.ino> if it works for you? It does for me.
—
Reply to this email directly, view it on GitHub <#5938 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AML3OVBGNJP7I5XPRQY2PR3WDVUFBANCNFSM5I5BQEUQ> .
You are receiving this because you commented. <https://github.com/notifications/beacon/AML3OVDEOLFN733AH3RD6MTWDVUFBA5CNFSM5I5BQEU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJRNO6SY.gif> Message ID: ***@***.***>
|
The topic seems to be dead, so I am closing it. |
Hi, I ran into this issue yesterday. Took me hours of testing different boards and max chips, checking wiring and pin layout etc. to finally come to the conclusion that the only difference of my hitherto working code vs. non working code and device was 1.0.6 vs 2.0.6 esp32 framework. Arduino 1.8.6, esp32 2.0.6 framework, esp32 dev board, max dac chip. Downgraded to 1.0.6, dac works again immediately. |
Hi,
After many hours used in this issue ....
You have to init I2S depending the Board Manager you are using, see my code bellow
In summary
with Adafruit feather I follow using B.M. 1.0.6
with Adafruit feather v2 I use B.M. 2.0.4
Nevertheless take care of
1- if you change use_apll = false, to true
with B.M. 2.0.4 you will get glitches
It does not happen with B.M. 1.0.6
2- In my application
I cannot use B.M. 2.0.5 because there are other issues related SPIFFS ...
I should investigate ....
3- I have not tested B.M. 2.0.6
Good luck
////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef B_Manager_1_0_6
void i2sInit()
{
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
.sample_rate = I2S_SAMPLE_RATE_LOW, // The format of the signal using ADC_BUILT_IN
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, // is fixed at 12bit, stereo, MSB
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 8,
.dma_buf_len = 64,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0
};
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL); //install and start i2s driver
i2s_set_pin(I2S_NUM_0, NULL); //for internal DAC, this will enable both of the internal channels
}
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// Board Manager superior a 2.0.4 needs for ADAFRUIT ESP32 feather V2
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef B_Manager_>_2_0_4
void i2sInit()
{
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
.sample_rate = I2S_SAMPLE_RATE_LOW, // The format of the signal using ADC_BUILT_IN
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, // is fixed at 12bit, stereo, MSB
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = I2S_COMM_FORMAT_STAND_MSB, // B.M. 2.0.4
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 8,
.dma_buf_len = 64,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0
};
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL); //install and start i2s driver
i2s_set_pin(I2S_NUM_0, NULL); //for internal DAC, this will enable both of the internal channels
}
#endif
De: McMornan ***@***.***
Enviado el: miércoles, 09 de noviembre de 2022 18:13
Para: espressif/arduino-esp32
CC: JoseEnriqueFA; Comment
Asunto: Re: [espressif/arduino-esp32] The esp32 i2s internal DAC output is not working with the release 2.0.1 (Issue #5938)
Hi, I ran into this issue yesterday. Took me hours of testing different boards and max chips, checking wiring and pin layout etc. to finally come to the conclusion that the only difference of my hitherto working code vs. non working code and device was 1.0.6 vs 2.0.6 esp32 framework.
Arduino 1.8.6, esp32 2.0.6 framework, esp32 dev board, max dac chip.
Downgraded to 1.0.6, dac works again immediately.
—
Reply to this email directly, view it on GitHub <#5938 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AML3OVE75QDJFXPZNP6GKUDWHPLRRANCNFSM5I5BQEUQ> .
You are receiving this because you commented. <https://github.com/notifications/beacon/AML3OVHCU7WC7XW4GQXHGLLWHPLRRA5CNFSM5I5BQEU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJYDPBFA.gif> Message ID: ***@***.***>
|
Please understand the difference between IDF and arduino-esp32. From version 2.0.3 of arduino-esp32 there is I2S library using Arduino API (Arduino Documentation) Arduino-esp32 is based on IDF so you can always use IDF functions and combine them with Arduino API. We pull updates done in IDF from time to time, which could cause breaking changes or introduce bugs, but most of the time they are fixing previous bugs. |
The audio output using I2S works both with an external DAC or in PDM mode but not using the internal DAC.
This seems to be related to the ESP-IDF https://github.com/espressif/esp-idf/issues/7684
The text was updated successfully, but these errors were encountered: