Use ADC Bandgap in KL27

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use ADC Bandgap in KL27

816 Views
lokuate
Contributor III

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

Labels (1)
Tags (3)
0 Kudos
2 Replies

468 Views
lokuate
Contributor III

My project was generated using processor expert, I have spent 2 days trying to make the adc work... Please help.

C

0 Kudos

468 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carlos,

      I have a KL27 KSD project based on PE, it can printf the bandgap adc value, you can refer to it.

    Please find the project from the attachment.

Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos