I'm trying to do a little steady-state signal processing on a circuit, making use of the cosine waveform (CW) generator as per this repo. The code there doesn't actually allow me to retrieve the current CW value and so at the moment I have to do my own CW lookup table (costing CPU and memory).
Is there a way I can avoid this and actually get the current CW value in a way that I can perform calculations with it?
How do I access the contents of the CW generator / DAC?
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: How do I access the contents of the CW generator / DAC?
No, but you have a 240MHz processor at your disposal; there's very little stopping you from generating the waveform yourself.
Re: How do I access the contents of the CW generator / DAC?
Despite this, the best I can get out of this loop is 120kHz square wave:ESP_Sprite wrote: ↑Thu Feb 21, 2019 8:59 amNo, but you have a 240MHz processor at your disposal; there's very little stopping you from generating the waveform yourself.
Code: Select all
while(1) {
dac_output_voltage( DAC_EXAMPLE_CHANNEL, 0 );
dac_output_voltage( DAC_EXAMPLE_CHANNEL, 255 );
}
Code: Select all
uint8_t timestamp = 0
while(1) {
dac_output_voltage( DAC_EXAMPLE_CHANNEL, sine_lookup_table[timestamp++%51] );
}
I need a 15kHz sine including access to the actual waveform values - is there a way to do it?
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: How do I access the contents of the CW generator / DAC?
Don't try to write to the dac directly, you'll get jitter and the CPU use will be high. Instead, configure I2S to output to the internal DACs and feed it entire chunks of memory. (You can use the ESP-IDF I2S driver to do this.) The hardware will take care of writing to the DACs. You should be able to get up to some MHz that way, if memory serves.
Re: How do I access the contents of the CW generator / DAC?
I need a high precison sine tone sweep generator (200 to 8000Hz at least) and I found a working solution using the CW generator.
I used this source: https://github.com/krzychb/dac-cosine
Now I found your hint, that I should not go the the internal DAC directly but via the I2S.
That is axcatly what I need because I want to use an external DAC + Amp like the PCM5102 or MAX98357 for higher output voltage/wattage.
Can anybody give me a hint (code snipped) how to use the cos/sin generator (from the source link) how to use the generated sine wave and connect it to the I2S (external DAC not internal).
A shoht hint for volume adjustment would be also appreciated.
I used this source: https://github.com/krzychb/dac-cosine
Now I found your hint, that I should not go the the internal DAC directly but via the I2S.
That is axcatly what I need because I want to use an external DAC + Amp like the PCM5102 or MAX98357 for higher output voltage/wattage.
Can anybody give me a hint (code snipped) how to use the cos/sin generator (from the source link) how to use the generated sine wave and connect it to the I2S (external DAC not internal).
A shoht hint for volume adjustment would be also appreciated.
Who is online
Users browsing this forum: iParcelBox and 103 guests