MSP430F1612: generating sinusoidal signals

Hello:

What would be the most efficient (i.e. minimizing the involvement of resources) and fastest way to generate sinusoidal signals (using the DAC for output) in the TI MSP430F1612?

Just approximate (can be stepped, output by the DAC, not filtered), in the audio range (up to 6KHz or so).

I heard that part of the necessary algorithms are HW-wired somewhere in the chip, not sure.

Thanks. Marius Hancu

Reply to
Marius Hancu
Loading thread data ...

OK, I've found this reference:

DMA eases CPU's workload for waveform generation Code uses the fewest cycles to implement periodic waveform with DACs.

Mike Mitchell, Texas Instruments, Houston, TX; Edited by Brad Thompson and Fran Granville -- EDN, 12/5/2005

formatting link

Not sure if something better can be done with this processor in terms of periodic waveform generation.

Any ideas?

Marius Hancu

Reply to
Marius.Hancu

DMA is good when you _already_ have the samples (a period) stored somewhere in the DMA accessible memory. If this is the case then - there you are. But in case by "generating", in your original message, you mean you need to calculate those samples, then I suggest you have a look at "Table look-up and interpolate" algorithms (you can find an Application Note on TI's page, I think it was written for '2x DSPs).

Succes :-) Adrian

Reply to
Adrian Spilca

Does the chip incorporate a DDS? If it does then maybe that is what you are looking for? I believe you can get DDS chips that a uC can interface to. They are also pretty straight forward to implement in an FPGA too. You could implement a DDS in software but only if it was very low frequency.

6KHz sounds too high for that approach though.

Paul.

Reply to
Paul Taylor

It depends what frequency accuracy / frequency step is needed and what the spurious response requirements are.

In the beginning of that article, there was a simplistic calculation about using a programmed approach to generate a 1 kHz sine wave using a 32 kHz sample and interrupt rate. The waveform looks good on an oscilloscope even without the LPF, but for audio applications, this would be an overkill.

For audio applications just over 2-3 times the highest sine wave frequency should be enough.

If the highest sine frequency you needed is 6 kHz, then 16 kHz might be the suitable interrupt rate, which would be 1/2 of the interrupt rate of the initial 32 kHz programmed case, so the load figures would also be one half of that example.

The numerically controlled oscillator can be used to generate quite clean waveforms with modest sampling frequencies.

In this case, for each frequency that needs to be generated, perhaps a

16 bit phase accumulator would be enough. At each interrupt, a phase increment (depending of the frequency needed) is added to the phase accumulator, which may freely overflow. The highest bits of the phase accumulator (say 8 bits) are used to address the sine look-up table and the table element value is loaded into the DAC. In this case the frequency tuning step is 16000 Hz/65536 or 0,24 Hz and the look-up table would contain 256 elements.

As long as the sampling frequency is not a harmonic multiple of the sine wave frequency, different elements in the look-up table are addressed at different cycles, so even when observing the waveform before the LPF with an oscilloscope, after a few overlapping traces, a clean sine wave will appear on the screen.

Of course, other phase accumulator sizes and look-up table sizes can be used, but these involve some extra shift instructions.

In the article, the 32 kHz sampling rate with 1 MHz crystal frequency caused 58 % load for a single output frequency, so with 16 kHz sample rate would be above 29 %, due to the extra instructions to extract the high bits from the phase accumulator. With 8 MHz crystal frequency, the load would be about 4 %.

Paul

Reply to
Paul Keinanen

OK - forget all of that. My new reader wasn't showing *any* of the other responses in this thread. I think it's a problem with the tiscali news service.

Need to change... or just use google groups.

Regards,

Paul.

Reply to
Paul Taylor

... snip ...

See my sig. You don't want to use google.

--
Some free news servers.  I use teranews and gmane.
           (1 time charge)    (free)
                                 (free)
                                    (free)
            (free)
                   (free)
             (mail-lists via news)  (free)
                   (pay)
Reply to
CBFalconer

Thanks - I agree with you about not wanting to use google.

Regards,

Paul.

Reply to
Paul Taylor

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.