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.

MSP430FR2311: How to achieve 200 ksps conversion rate

Part Number: MSP430FR2311


Hello,,

  i am using MSP430FR2311 microcontroller... 10 bit ADC

  anyone can tell me how to calculate the sampling frequency.....??

  when i can achieve maximum conversion rate 200ksps....?

  wright now i have configured adc ... clock = MODOSC

                                                                  SAMPLING TIME = 16 ADC10CLK CYCLES

                                                                   REF : 1.5VREF +  VSS (INTERNAL REFERENCE)

                                                                  RESOLUTION : 10 BIT 

                                                               

right Now i'm achieving only 23.86 Ksps

i have attached my code... if there is any mistake please notify me.... thank you all

My Code:

int main(void)
{
   

    P1DIR |= BIT0;                                           
   
    // Configure ADC A1 pin
    P1SEL0 |= BIT1;
    P1SEL1 |= BIT1;

   
    PM5CTL0 &= ~LOCKLPM5;

    // Configure ADC10
    ADCCTL0 |= ADCSHT_2 | ADCON;                     // ADCON, S&H=16 ADC clks
    ADCCTL1 |= ADCSHP;                                       // ADCCLK = MODOSC; sampling timer
    ADCCTL2 |= ADCRES;                                       // 10-bit conversion results
    ADCMCTL0 |= ADCINCH_1 | ADCSREF_1;                              // A1 ADC input select; Vref=1.5v
    ADCIE |= ADCIE0;                                             // Enable ADC conv complete interrupt
  
   // Configure reference
  PMMCTL0_H = PMMPW_H;                         // Unlock the PMM registers 
  PMMCTL2 |= INTREFEN;                             // Enable internal reference
  __delay_cycles(400);                                    // Delay for reference settling
    while(1)
    {
        ADCCTL0 |= ADCENC | ADCSC;                           // Sampling and conversion start
        __bis_SR_register(GIE);                  // LPM0, ADC_ISR will force exit
       
    }
}

// ADC interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC_VECTOR
__interrupt void ADC_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC_VECTOR))) ADC_ISR (void)
#else
#error Compiler not supported!
#endif
{
    switch(__even_in_range(ADCIV,ADCIV_ADCIFG))
    {
        case ADCIV_NONE:
            break;
        case ADCIV_ADCOVIFG:
            break;
        case ADCIV_ADCTOVIFG:
            break;
        case ADCIV_ADCHIIFG:
            break;
        case ADCIV_ADCLOIFG:
            break;
        case ADCIV_ADCINIFG:
            break;
        case ADCIV_ADCIFG:
P1DIR ^= BIT0;
          break;  
default: 
break; 
} 
}

  • Hi,

    The sampling frequency can be calculated by:

    clock frequency / ((# of bits +1) + sample and hold cycles).

    So, assuming a MODOSC frequency of 4.8 MHz, your sampling frequency should be 4.8MHz / (11 + 16) = 178 ksps.

    To increase the sampling frequency, you would need to use a higher clock rate or a smaller sample and hold time. Also, how are you measuring the sampling rate? If you are relying on a GPIO toggle this may be adding latency, which would give you a lower measured conversion rate.

    Regards,

    Nathan

  • Thans for prompt reply.

    I'm Measuring the sampling rate by toggleing the GPIO.

    Any other way which I can measure Sampling rate Practically ?

    Kelvin

  • Can any one tell me how can I measure sampling rate practically ?

    Kelvin Kalariya.
  • Hi,

    Toggling the GPIO should be an OK way to do this. Could you try not putting the ADC enable and global interrupt enable in a while loop? This may be taking the extra time that you are seeing. So replace your while loop with something like this:


    ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start
    __bis_SR_register(GIE); // LPM0, ADC_ISR will force exit

    while(1);

    Also, you are not going into a low power mode, so you do not need to be unlocking the PMM registers.

    Regards,
    Nathan
  • hi,

    I have a tried with the suggestion given by you.
    Earlier I have aslo tried with same as well. But, the sampling rate is still 27.62 Khz
    I'm expecting 200 khz.
    Any option to watch MODOSC clock ?


    // Configure ADC10
    ADCCTL0 |= ADCSHT_2 | ADCON; // ADCON, S&H=16 ADC clks
    ADCCTL1 |= ADCSHP;
    ADCCTL2 |= ADCRES; // internal Reference select
    ADCMCTL0 |= ADCINCH_1 | ADCSREF_1; // A1 ADC input select; Vref=1.5V
    ADCIE |= ADCIE0; // Enable ADC conv complete interrupt

    // Configure reference
    PMMCTL0_H = PMMPW_H; // Unlock the PMM registers
    PMMCTL2 |= INTREFEN; // Enable internal reference
    __delay_cycles(400); // Delay for reference settling


    ADCCTL0 |= ADCENC | ADCSC; // Sampling and conversion start
    __bis_SR_register(GIE);



    while(1)
    {



    }



    Kelvin Kalariya
  • This problem is resolved by Increasing the ADC Clock

    Thanks
    Kelvin Kalariya

**Attention** This is a public forum