Hello,
I am working on a project for a class and I am using an MSP430FR5949. One of the parts that I am working on is a siren so I'm trying to output a sine or sawtooth wave to a DAC and then to a class AB amplifier that I made and tested that it works. I was able to get a sine and a sawtooth wave out of my DAC and amplifier when I scoped it however without any delays it only outputs about 370 Hz. I'm using a lookup table with about 100 values to output my wave and so my frequency increases if I decrease the number of values in my lookup table however doing that also decreases the quality of my wave. Therefore, I tried to increase my clock speed to a higher frequency so that my program would run faster but for some reason it ended up decreasing my wave frequency to about 32 Hz. Here is my code that I used to set up the clock speed, am I missing something or doing something wrong? I also need to increase the clock speed because I am also trying to scan 3 ADCs very quickly in addition to outputting a siren on a speaker. Thank you very much, I appreciate all the help!
// Configure one FRAM waitstate as required by the device datasheet for MCLK
// operation beyond 8MHz _before_ configuring the clock system.
FRCTL0 = FRCTLPW | NWAITS_1;
// Clock System Setup
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL1 = DCORSEL | DCOFSEL_4; // Set DCO to 16MHz
CSCTL2 = SELS__DCOCLK; //SMCLK --> DCO
CSCTL3 = DIVS__1; // Set all dividers
CSCTL0_H = 0; // Lock CS registers // Clock System Setup