-
Notifications
You must be signed in to change notification settings - Fork 17
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
redirect to I2S for an external DAC+Amp and volume control #1
Comments
@knopserl, I am happy it works and that you are able to further tweak it!
I do not see a way to route internal DAC signal (or CW generator itself) back to the I2S.
I would follow ESP_Sprite's advice in https://esp32.com/viewtopic.php?f=13&t=9342#p39062. Try code provided in https://github.com/espressif/esp-idf/tree/master/examples/peripherals/i2s. |
@krzychb Thanks for your replay/hints. The reason why I was asking was because I saw the thread in the ESP32 forum which advises to not directly to the CW to DAC connection but go thru the I2S to the internal DAC. So if the CW can route the signal thru I2S to internal DAC, then I2S can also connect an external DAC (with an amplifierer), because I2S allows the selection of internal or external DAC. Here is the advise from ESP_Sprite, but he does not explain HOW to implement his sdvise. I have also asked in this thread how to follow his advise with a small code snippet or example. ESP_Sprite advice: |
What thread was it (suggesting CW can route the signal thru I2S)? I am afraid ESP_Sprite meant using sine calculation by math calc and saving it to memory (to output "entire chunks of memory" using I2S to internal or external DAC). |
@krzychb Thanks. That is where I was comming from. I used a precalculated sine sample value array (at compile time) or a calculation during runtime before feeding the I2S output (for an external DAC/Amp) and I was not really successful with the result (probably my fault). So I liked this one as it does it with HW and without CPU load, but I see now, that it only works with internal DAC and it has also only 8bit resolution. |
@knopserl what particular problem did you have? To make it work or to get desired resolution, range, and fast frequency changes? I would like to do some testing but I see that support for I2S and Internal DAC is broken in master and I do not have external IS2 DAC to check it for external higher resolution output. |
@krzychb thanks a lot for your willingness to spend time for my problem. I thought I can set the prescale to a value, that it allows one 1 or 2 Hz steps but it seem I misunderstood that. I probably can only set the prescaler from 1 to 15 right? And thus the smallest resolution I get is 15.61Hz. So do you see any chance to get a 1 or 2 Hz step delta and also fulfill the other requiremenst like amplitude control and a sweep within a second with that 1-2Hz steps? In addition I was wondering if the CW output can be redirected to the I2S and then to internal or external DAC but I guess that is not possible. very strange demand right? with such a small module it could be done in HW (frequency and amplitude), but that would mean I give up to do it within the ESP32. |
@knopserl: If I understood you correctly, your problem should be solveable by streaming a prepared signal through the DAC? If yes, you might have a look at this (The program is using ISR function to write to the DAC) |
@github-ec Thans for testing/spendig your time. I was also trying it with a sine wave generation in RAM and play it via internal/external DAC (using I2S). But the ESP32 seem to have a problem with sine waver and frequencies up to 10kHz. I also need to change the frequency every few micro-seconds. |
@krzychb great solution, that saved me! I need to create a sine sweep generator from 100Hz to 10kHz. This is done in HW and generates a quite clean sine wave. So I changed the clock diverder to 64 and created a loop which allows 2Hz steps.
Now I need a hint how to redirect the internal DAC signal to the I2S for an external DAC + amplifier as I need 3V output and I need volume control for the DAC/I2S.
Any hints which brings me further?
The text was updated successfully, but these errors were encountered: