I am currently working with MSP430 FR5969 evaluation board.
I have configured P4.2 as ADC channel 7.
I am checking ADC12IFG7 bit to see if conversion has happened or not.
I don’t see any conversion happening.
Code is as follows (modified sample code from TI):
#include <msp430.h>
volatile unsigned int ADCvar;
#define SAMPLES 256
unsigned int rx_buffer[SAMPLES*2] = {0};
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
int i = 0;
// Configure GPIO
P2SEL1 |= BIT4; // Enable A/D channel A0
P2SEL0 |= BIT4;
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Configure ADC12
ADC12CTL0 = ADC12ON | ADC12SHT0_2; // Turn on ADC12, set sampling time
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL0 = ADC12VRSEL_4; // Vr+ = VeREF+ (ext) and Vr-=AVss
ADC12CTL0 |= ADC12ENC; // Enable conversions
while (i < SAMPLES)
{
ADC12CTL0 |= ADC12SC; // Start conversion-software trigger
while (!(ADC12IFGR0 & BIT7));
rx_buffer[i] = ADC12MEM7; // Read conversion result
i++;
__no_operation(); // SET BREAKPOINT HERE
}
}