Variating frequency of the sine wave generated on LPC54628.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Variating frequency of the sine wave generated on LPC54628.

Jump to solution
1,248 Views
Rutvikk
Contributor I
I have been working on a project that requires generation of a Sine wave and variation of frequency and amplitude. I am using the example i2s_dma_transfer from the driver_example included with the SDK but cannot understand how I should manipulate the clocks to variate the frequency. The variation of the frequency has to be in the range of 3.00 Hz to 400.00 Hz. Here I am using the pre-written sine table and also want to change the sine table for 24 bit. But I cannot figure out how to change the values as the normal sine table generator values, when fetched to the array gives an erroneous output. Please if someone can solve my query and guide me to figure out how to go about with this task. If someone has an experience working on the similar project please guide me on how you carried the task out. Thanks.
0 Kudos
Reply
1 Solution
1,236 Views
frank_m
Senior Contributor III

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.

View solution in original post

0 Kudos
Reply
2 Replies
1,222 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

 

The Integrated Inter-IC Sound Bus (I2S) is a serial bus interface standard used for connecting digital audio devices together, not used to generate sine wave. 

 

BR

Alice

0 Kudos
Reply
1,237 Views
frank_m
Senior Contributor III

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.

0 Kudos
Reply