Hello everyone!
I just started working with the MSP432P401R launchpad. My goal for now is to sample audio at 44.1kHz and then re-output it through a DAC to an amplifier with an 8-ohm speaker on the output.
I have the ADC working fine, but I'm having trouble with my sampling timer. I'm running the chip at 48 MHz in VCORE1 active mode. Here is my timer initialization code as well as the interrupt function:
void TA0_0_IRQHandler(void)
{
P2->OUT ^= BIT7;
}
void TIMER_init()
{
TIMER_A0->CCTL[0] = TIMER_A_CCTLN_CCIE; //Enable CC interrupt
TIMER_A0->CTL = TIMER_A_CTL_TASSEL_2 | //Select SMCLK as source for timer
TIMER_A_CTL_ID_3 | //Divide clock by 8 (this yields 6 MHz for the timer clock)
TIMER_A_CTL_MC_1 | //Up mode
TIMER_A_CTL_CLR ; //Clear timer count
TIMER_A0->CCR[0] = 136; // 6 MHz / 44.1 kHz = 136
}
Fore testing purposes, my interrupt function just toggles a GPIO pin so I can analyze it with my oscope. Here's a picture of what the output of the pin looks like:
http://imgur.com/a/VJBmMWith the current settings, the pin is being toggled every 744ns. It seems like the interrupt function is just being ran constantly, because when I put a breakpoint in my while(1) loop in my main function, it never hits. But when I put a breakpoint in my timer interrupt function, it always hits.
Are there flags I HAVE to clear or something? It would make sense that the ISR keeps getting triggered if I'm never servicing/clearing the flag. I'm just not sure what to do.