-
Notifications
You must be signed in to change notification settings - Fork 190
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
Fix ESP32 port #301
base: master
Are you sure you want to change the base?
Fix ESP32 port #301
Conversation
Removed outdated comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Config of I2S for ESP32 Updated documentation on ESP32
1e91f3f
to
4680312
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Thank you so much for working on this!!!!!! I am using MOZZI_OUTPUT_I2S_DAC with a PT8211 in a side project and will test this out when I get a chance, although it won't be a for a few weeks. |
Memory usage change @ 1070453
Click for full report table
Click for full report CSV
|
Alright, sorry for the delay since the original issues (but I did not used to own an ESP32 ;) but this should update the ESP32 port to the new API. Seems to work well here (tested on both an ESP32 and ESP32-S3) but testing is always welcome, so mentioning thereafter people that might be concerned: @sensorium , @kicetwigs , @thomasfredericks , @MatteoHMarangoni , @1183747933 , @dietervandoren , @amiel . Documentation is done (I think) but will only be published once merged. |
Thank you so much!!!!! As of yesterday, this was working well for me using an esp32 (just plain original esp32) with: #define MOZZI_AUDIO_MODE MOZZI_OUTPUT_I2S_DAC
// and one custom pin
#define MOZZI_I2S_PIN_WS 25 I'm using headphones with the PT8211, which is not recommended, so it's hard to say if the sound is good. I will test again tomorrow with the latest changes. |
@amiel Thanks for this! Really appreciate some feedback! I think, for a PT8211, you should also have (and 25 should be the default for WS): #define MOZZI_I2S_FORMAT MOZZI_I2S_FORMAT_LSBJ |
Ohhhh.Thank you, I'll try that out! |
Have you ever used a MAX98357A? That was my initial attempt and I never got it to sound right (but the PT8211 worked out-of-the-box with mozzi 1). I'm wondering if maybe I just needed to do something like |
Was that with an ESP32? There are two (at least…) formats to I2S: standard, and LSBJ (and variants on each -_-), PT8211 is LSBJ but most DAC are on the standard. If I got the previous port okay, the I2S was configured for LSBJ and not modifiable to the other format which would explain what you observed. In order to keep coherency with the other I2S ports (especially RP2040) I changed the default format to plain (which should work with the MAX):
I have not tested though (I kind of remember now that I might have one around…) and the signals on the scope look a lot like standard I2S. |
Yes, it was with an ESP32.
This is really good to know. I will try the MAX98357A again, as I would prefer to use that for my project anyway. I'll let you know how it goes if that would be helpful. |
FYI: This is working perfectly with the MAX98357A (no LSBJ). Thank you so much! |
@amiel Thanks for the feedback! |
Note:
I have done everything using the ESP-IDF documentation (https://docs.espressif.com/projects/esp-idf/en/v5.4/esp32/index.html) but not the Arduino-esp32 one (https://docs.espressif.com/projects/arduino-esp32/en/latest/api/i2s.html).
Work in progressDone (?)The goal is to change the port for the ESP32 to the new version of the API (v.5). Below the state of the work.
Note: only tested on ESP32-WROOM-32D (which have a native DAC) and ESP32-S3 (which does not).
EXTERNAL_TIMED
Fixed
Can be tested with, as a config:
and as an
audioOutput()
:INTERNAL_DAC
Compiles and run (does not panic) but no soundFixed (see below)Still resists me… I tried to switch to a DMA written DAC as per the docs but still got some error message from the ESP… If anyone has an idea… Worst case, something like the
dacWrite
used in the example above could do the job, but that's not really satisfying…Note: espressif/arduino-esp32#10851
Mozzi runs,
updateControl
is called, i2s writing function is called…Edit: I think I'll do the workaround described for the timed_output usingdacWrite
in the near future, and will change when espressif gives some feedback (or I find the problem myself…)I did the workaround above. Works well but probably not the most efficient. Will probably evolves but that works.
Default mode for ESP32
NATIVE_I2S
Fixed
Default config to plain format (different than before) to be coherent with the others I2S ports (especially RP2040). Mode can be further changed to LSBJ (PT8211) and lines phases can also be edited.
Works in MONO and STEREO for the PT8211 (do not have the DAC to test plain, or at least not in super close reach).
PWM
New addition, mainly to support the ESP32 chips that do not have a DAC on-board. A bit fancier than a
analogWrite
but not much. Default mode automatic selection is not yet implemented (and this is not tested on other boards yet…). This will fix #278 .Default pins are 15 and 16.
Default mode for all other boards (ESP32-XX)