Use ADC Bandgap in KL27

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Use ADC Bandgap in KL27

845 次查看
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

标签 (1)
标记 (3)
0 项奖励
2 回复数

497 次查看
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 项奖励

497 次查看
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 项奖励