Skip to content

I2S sending data 1 bit too early, results in clipping/garbage at high volumes #4571

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

Closed
6 tasks done
earlephilhower opened this issue Mar 26, 2018 · 0 comments · Fixed by #4574
Closed
6 tasks done
Assignees
Milestone

Comments

@earlephilhower
Copy link
Collaborator

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

Platform == all [n/a]

Settings in IDE

IDE == all [n/a]

Problem Description

I've got a reasonably popular audio codec library for the ESP8266 that drives I2S DACs for decoded output. Many people have found that at high levels their DACs generate noise/garbage, but when they drop the volume or add a delay (R/C on the I2SDOUT pin) to the data it works properly. I thought it was wiring/cap issues, but it's a SW bug in core.

After looking through the ESP32 manual's I2S section the cause is the I2S on the ESP8266 is being configured improperly.

The I2S module, by default, is configured to send PCM format waveforms where the MSB and the Left/Right select are output on the same clock. I2S, however, requires a 1-bit delay from LRCLK to MSB.

There's a config bit, undocumented on the ESP8266 but listed in ESP32, which should add this delay, I2STMS. We're setting it on receive, for some reason, even though the code in core can't actually receive...

Will send in a PR.

MCVE Sketch

N/A, but you can try https://github.com/earlephilhower/ESP8266Audio/blob/master/examples/PlayRTTTLToI2SDAC/PlayRTTTLToI2SDAC.ino if you're so inclined.

Debug Messages

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant