You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiler version toolchain-xtensa-esp32 8.4.0+2021r2-patch2
Operating System: [macOS]
Using an IDE?: [PlatformIO]
Power Supply: [USB]
Problem Description
When using I2S with internal DAC, 2 channels, 16000 frames/sec, the sound emitted is a short swaks and DMA buffers are emptied far too fast compared to regular I2S audio with external chip.
The original PCM sound is the following and lasts over 660ms:
Actual Behavior
Recording the output with a scope shows a correct waveform but played 11x faster than normal speed.
I did a detour on i2s_hal_tx_clock_config() to check what clock values were calculated, and force-injected some different clock values until the sound was good again.
With the previous setting: 16KHz, 2 channels, internal DAC. IDF calculates the following clock: sclk=160000000 mclk=128000 bclk=64000 mclk_div=1250 bclk_div=2
Although the number seem correct, mclk_div hardware is only 8 bits, so 1250 is overflowing.
Injecting my own calculated value, I made it work at correct speed with: sclk=160000000 mclk=1024000 bclk=32000 mclk_div=156 bclk_div=32
Having a combined mclk_div=156 bclk_div=32 achieves a divider of ~5000 over sclk.
I suppose that an easy patch would be to set bclk_div=32 instead of bclk_div=2 and it should allow for all audio frequencies.
Steps to reproduce
Code to reproduce this issue
Debug Logs
Other items if possible
sdkconfig file (attach the sdkconfig file from your project folder)
elf file in the build folder (note this may contain all the code details and symbols of your project.)
coredump (This provides stacks of tasks.)
The text was updated successfully, but these errors were encountered:
Environment
Problem Description
When using I2S with internal DAC, 2 channels, 16000 frames/sec, the sound emitted is a short swaks and DMA buffers are emptied far too fast compared to regular I2S audio with external chip.
Problem is largely described in espressif/arduino-esp32#5938
Expected Behavior
The original PCM sound is the following and lasts over 660ms:
Actual Behavior
Recording the output with a scope shows a correct waveform but played 11x faster than normal speed.
I did a detour on
i2s_hal_tx_clock_config()
to check what clock values were calculated, and force-injected some different clock values until the sound was good again.With the previous setting: 16KHz, 2 channels, internal DAC. IDF calculates the following clock:
sclk=160000000 mclk=128000 bclk=64000 mclk_div=1250 bclk_div=2
Although the number seem correct,
mclk_div
hardware is only 8 bits, so 1250 is overflowing.Injecting my own calculated value, I made it work at correct speed with:
sclk=160000000 mclk=1024000 bclk=32000 mclk_div=156 bclk_div=32
Having a combined
mclk_div=156 bclk_div=32
achieves a divider of ~5000 over sclk.I suppose that an easy patch would be to set
bclk_div=32
instead ofbclk_div=2
and it should allow for all audio frequencies.Steps to reproduce
Code to reproduce this issue
Debug Logs
Other items if possible
build
folder (note this may contain all the code details and symbols of your project.)The text was updated successfully, but these errors were encountered: