已解决! 转到解答。
I hade done a somehow similar project years ago. But with a DAC as direct output, and not I2S.
The DAC output was served from a timer interrupt at a 100kHz rate. Within the interrupt, I calculated the sine table index from the current requested output frequency and the timer period, and wrote this value to the DAC. The latter was internal, and thus just a simple 16-bit write. Two ADC channels with attached potentiometers served for frequency and amplitude adjustment in realtime.
Run on a first-generation M3 with 72MHz core clock, it worked sufficiently well up to about 40kHz output frequency.
I suppose this does not really well apply to your case. I am not sure about manipulating the I2S clock, and how an attached device would handle that.
I hade done a somehow similar project years ago. But with a DAC as direct output, and not I2S.
The DAC output was served from a timer interrupt at a 100kHz rate. Within the interrupt, I calculated the sine table index from the current requested output frequency and the timer period, and wrote this value to the DAC. The latter was internal, and thus just a simple 16-bit write. Two ADC channels with attached potentiometers served for frequency and amplitude adjustment in realtime.
Run on a first-generation M3 with 72MHz core clock, it worked sufficiently well up to about 40kHz output frequency.
I suppose this does not really well apply to your case. I am not sure about manipulating the I2S clock, and how an attached device would handle that.