Forums

12-bit ADC in MSP430FR2476 seems not to work properly

Started by Skfir 3 months ago2 replieslatest reply 3 months ago57 views

Hello friends! This is my very first question on this site. Here is the problem: I am trying to initialize the 12-bit built-in ADC on MSP430FR2476, but no matter what I do it seems to work at 10 bits. I change the resolution bits in a control register and alas, to no avail. No matter what I have tried nothing helps, always 10 bits. Please help, here is a snippet of the code:


//Configuring ADC

  PMMCTL2 |= (INTREFEN);         //Internal reference ,default 1.5V

  ADCCTL0=ADCCTL1 = 0;           //Ensuring that the ADC is off

  ADCCTL0 |= (ADCSHT_7 +ADCMSC);                    //sample and hold time = 64clk, multiple conversion

  ADCCTL1 |= (ADCSHP + ADCSSEL_2 + ADCCONSEQ_1*+ ADCDIV_7);        //Conversion is triggered                                  //manually, ADC clock source - SMCLK/8 ~2Mhz, sequence of channels single                                              //conversion,

  ADCCTL2 |= (ADCRES_2);                                //12 bit resolution

  ADCMCTL0 |= (ADCSREF_1 + ADCINCH_1);                   //Employing the internal reference and starting                                                                                                //conversion from A1 (P1.1)

  ADCIE |= ADCIE0;                                      //Activate interrupt

  ADCCTL0 |= (ADCON);                             //ADC on

  SYSCFG2 |= (BIT1);   //Activate ADC module on the pins (removing this line doesn't make any                                                       //difference)


//Interrupt just sends the most significant byte over UART

__attribute__((interrupt(ADC_VECTOR)))

void ADC_ISR(void){

    switch(__even_in_range (ADCIV, 0x0C)){

    case 0x0C:

        adc_data[adc_index] = ADCMEM0;

        UCA1TXBUF = (unsigned char)(ADCMEM0>>8);

        break;

    }

}

[ - ]
Reply by CJac78March 10, 2022

Hi Skfir,

There is a similar question "LP-MSP430FR2476: Unable to set ADC to 12 Bit Resolution" on TI forum : LP-MSP430FR2476: Unable to set ADC to 12 Bit Resolution - MSP low-power microcontroller forum - MSP low-power microcontrollers - TI E2E support forums with a solution that seems to work.

You could try it.


[ - ]
Reply by SkfirMarch 10, 2022

Works! Thank you!!