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.

MSP430FR2355: MSPFR2355 ADC Trigger with Timer1 Issues

Part Number: MSP430FR2355

Hi All

We are developing a system that needs the ADC to start a conversion after a exact period after a comparator has triggered. This time is in a small amount of us.

For this we intended to setup Timer1.CC1 to trigger the ADC. The timer is started when the COMP (comparator) triggers its interrupt. The Timer 1.CC1 signal ‘form’ is shown below:

 

        ____________
____|                      |__________________

DLY |  TRG Pulse  | Delay to next measure

As the Timer CC1 (which is used to trigger the ADC) has two outputs (one TB1.1A to P2.0 and one TB1.1B to ADC), we have directed the other to P2.0 and measuredon an oscilloscope to make sure we are getting the correct waveform we expect. 

 So, we confirmed all is OK with the signal from the timer, but we get the below behavior:

  • ADC only triggers once, but doesn't look to be in sync with the rising edge of the pulse
  • ADC then remain busy forever.

Other notes are:

  • ADC works fine with a periodic software start (changing the trigger source of coarse).
  • If we setup for software start and do not make a software trigger, then the ADC never triggers (as expected)
  • Changing the length of the positive pulse makes no different

One of my worries is that is TB1.1A (measured) the same as TB1.1B?

Why would the ADC stay busy?

ADC setup code is below:

Many Regards

void InitialiseADCConverter(void)
{
    ADCCTL0 &= ~ADCENC;                                       // ADC Disabled to allow setup

    ADCCTL0 = ADCSHT_2;                                       // S&H=16 ADC clks
    ADCCTL0 |= ADCON;                                         // Turn ADC On
    //ADCCTL0 |= ADCMSC;                                      // Multiple conversions

    ADCCTL1 = ADCSHS1;                                        // Sample an hold trigger will come from Timer1 CCR1
    ADCCTL1 |= ADCSHP;                                        // Use the sampling Timer
    // Default is no inversion (bit ADCISSH)
    ADCCTL1 |= ADCDIV0;                                       // We will divide the clock by 2 to get a 4MHz ADC clock (Max 6.6MHz for 10 bit)
    ADCCTL1 |= ADCSSEL0 | ADCSSEL1;                           // Select the SMCLK (8MHz)
    //Default is single channel Conversion (ADCCONSEQ0..1)


    //No clock pre-scaler (ADCPDIV0.1)
    ADCCTL2 |= ADCRES_1;                                      // 10-bit conversion results
    // Unsigned Binary result as default (ADCDF)
    // ADC Buffer support 200Ksps as default(ADCSR)
    ADCMCTL0 |= ADCSREF0;                                      // Internal Reference
    // Default input channel is 0 (ADCINCH0..3)

    ADCIE |= ADCIE0;                                          // Enable ADC conv complete interrupt

    ADCCTL0 |= ADCENC;                                         // Enable Conversions
    //ADCCTL0 |= ADCSC                                          // Start an ADC conversion

    //Now we need to sort the reference or the ADC first start will be delayed
    //whilst the ADC waits for the reference to be ready.
    PMMCTL2 = 0; // this will be the 1.2V reference
    PMMCTL2 |= REFBGEN | REFGEN; // Enable the Internal voltage references
    PMMCTL2 |= TSENSOREN; // Enable the temperature sensor.

}

void InitialiseADCConverter(void)
{
    ADCCTL0 &= ~ADCENC;                                       // ADC Disabled to allow setup

    ADCCTL0 = ADCSHT_2;                                       // S&H=16 ADC clks
    ADCCTL0 |= ADCON;                                         // Turn ADC On
    //ADCCTL0 |= ADCMSC;                                      // Multiple conversions

    ADCCTL1 = ADCSHS1;                                        // Sample an hold trigger will come from Timer1 CCR1
    ADCCTL1 |= ADCSHP;                                        // Use the sampling Timer
    // Default is no inversion (bit ADCISSH)
    ADCCTL1 |= ADCDIV0;                                       // We will divide the clock by 2 to get a 4MHz ADC clock (Max 6.6MHz for 10 bit)
    ADCCTL1 |= ADCSSEL0 | ADCSSEL1;                           // Select the SMCLK (8MHz)
    //Default is single channel Conversion (ADCCONSEQ0..1)


    //No clock pre-scaler (ADCPDIV0.1)
    ADCCTL2 |= ADCRES_1;                                      // 10-bit conversion results
    // Unsigned Binary result as default (ADCDF)
    // ADC Buffer support 200Ksps as default(ADCSR)
    ADCMCTL0 |= ADCSREF0;                                      // Internal Reference
    // Default input channel is 0 (ADCINCH0..3)

    ADCIE |= ADCIE0;                                          // Enable ADC conv complete interrupt

    ADCCTL0 |= ADCENC;                                         // Enable Conversions
    //ADCCTL0 |= ADCSC                                          // Start an ADC conversion

    //Now we need to sort the reference or the ADC first start will be delayed
    //whilst the ADC waits for the reference to be ready.
    PMMCTL2 = 0; // this will be the 1.2V reference
    PMMCTL2 |= REFBGEN | REFGEN; // Enable the Internal voltage references
    PMMCTL2 |= TSENSOREN; // Enable the temperature sensor.

}

  • Update:

    Sorry, the first ADC measurement is in sync with the timer output (measurement error with my triggers).

    The first ADC trigger pulse works but on the second pulse the ADC goes permanently busy and never completes the conversion.

  • Are you toggling ADCENC (=0, then =1) in the ISR? This is required for a timer trigger even with CONSEQ=0 [Ref User Guide (SLAU445I) Sec 21.2.7.1, 2nd paragraph]. I'm pretty sure you would see this symptom if you forgot to do this.

    -------------------

    >ADCCTL2 |= ADCRES_1; // 10-bit conversion results

    This sets ADCRES=3 ("Reserved"), since ADCRES1 is pre-set [Ref UG Table 21-25]. I don't think this is your problem, but it might cause trouble later Try:

    >ADCCTL2 =  ADCRES_1; // 10-bit conversion results

  • Hi Bruce;

    You are a top man!!! Many thanks, I missed this in my reading!!! Much appreciated!!!

    Many Regards

    Tony

**Attention** This is a public forum