AnsweredAssumed Answered

Use ADC Bandgap in KL27

Question asked by Carlos Rodriguez on Jun 16, 2015
Latest reply on Jun 17, 2015 by Kerry Zhou

Hi!

 

I'm using the reference code from the ADC16 driver example 'adc16_example_frdmkl27z' but cannot get correct conversions, I'm using the code:

 

  pmc_bandgap_buffer_config_t pmcBandgapConfig = {

      .enable = true,

  };

    // Enable BANDGAP reference voltage

    PMC_HAL_BandgapBufferConfig(PMC_BASE_PTR, &pmcBandgapConfig);

 

  ADC16_DRV_ConfigConvChn(FSL_ADCONV1, 0, &Vbgap);

  // Wait for the conversion to be done.

  ADC16_DRV_WaitConvDone(FSL_ADCONV1, 0);

  // Fetch the conversion value.

  adcValue = ADC16_DRV_GetConvValueSigned(FSL_ADCONV1, 0);

  // Pause the conversion.

  ADC16_DRV_PauseConv(FSL_ADCONV1, 0);

 

adcValue is either 0 or a single digit number less than 5, I configured the ADC to work with 12bits single mode.

 

Kindest Regards,

Carlos

Outcomes