This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

Not reaching ADC interrupt after enabling/starting conversion.

Intellectual 400 points

Replies: 2

Views: 351

I am using the MSP430FR5725.  My code involves a pwm.  On its high signal, I am turning on a pin, then enabling an ADC conversion, but after enabling the conversion, it does not go to the ISR.  Below is my ADC initialization, PWM initialization, timer ISR, and my ADC ISR.

void adc_init()
{
//Disable ENC to set bits
ADC10CTL0 &= ~ADC10ENC;
//Hold time, ADC on
ADC10CTL0 |= ADC10SHT_0 + ADC10ON + ADC10IE;
//Sequence of channels, SMCLK, hold pulse
ADC10CTL1 |= ADC10CONSEQ_1 + ADC10SSEL_3 + ADC10SHP;
//10-bit conversion results
ADC10CTL2 = ADC10RES;
//Vref set
ADC10MCTL0 |= ADC10SREF_0 + ADC10INCH_15;
}

void pwm_init(void)
{
//PWM sleep mode, 50ms period
TA1CCR0 = 50000;
//1% duty cycle, HI 500us
TA1CCR1 = 500;
//SMCLK, div 1, UP mode, clear timer
TA1CTL = TASSEL_2 + ID_0 + MC_1 + TACLR;
//Disable interrupt for CCR0, out = rst/set
TA1CCTL0 = OUTMOD_7 + !CCIE;
}

#pragma vector = TIMER1_A0_VECTOR
__interrupt void TA1_CCR0_ISR(void)
{
//Toggle receiver
PJOUT_PDN ^= RX_PDN;
//Enable and start ADC conversion
ADC10CTL0 |= ADC10ENC + ADC10SC;
}

#pragma vector = ADC10_VECTOR
__interrupt void ADC_ISR(void)
{
  //Save A14, Rx RSSI
if(adc_count == 14){
//Save RSSI voltage
rssi_result = ADC10MEM0;
    if(rssi_result >= 240){
//////////////////
//System Wake-Up//
//////////////////
      //Activate system. Wake Up
G_AWAKE = 1;
PJOUT_PDN |= RX_PDN;
      //Exit low power mode
_BIC_SR(LPM0_EXIT);
      //Reset time-out interrupts
timer_count = 0;
TA0CTL |= TACLR;
      // Enable interrupts for CCR0.
TA0CCTL0 = CCIE;
}
}
  else if(adc_count == 0){
//Reset count
adc_count = 15;
    //Clear flag
ADC10IFG = 0;
}
}

I have the PWM timer interrupt disabled in the initialization, but I enable it in main, then go into PWM.  I am reading in a few analog channels, so I'm using CONSEQ_1.  I deleted a couple statements in my ADC ISR (if statements for saving different values), but left the one that is most important.  Does anyone have any idea why I'm enabling and starting the conversion, but nothing happens.  I have checked the ADC10MEM0 register and nothing is stored in it, so it's not going reading anything.

  • Guru 46710 points

    Maybe you forgot GIE?

  • In reply to Ilmars:

    I went ahead and verified your response because I can see people forgetting.  I ended up reaching my ISR.  My problem was that I was trying to enable the ADC interrupt in a register it didn't belong to.  I removed ADC10IE from where it is in my post and changed it to its own line of "ADC10IE |= ADC10IE0".  That worked.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.