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
My project was generated using processor expert, I have spent 2 days trying to make the adc work... Please help.
C
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!
-----------------------------------------------------------------------------------------------------------------------