Hi.
I use the ADC_LDD in processor_expert for KE02 Part.
but, it always lock in below line.
while (!AD1_GetMeasurementCompleteStatus(adcDevData)) ;
I create my project refer to help on commponet .
I saw someone else on communiyt also have this problem .
Do you have any idea for solving this issue?
Linda
Hi Linda,
Thank you for your interest in Freescale's kinetis product, I would like to provide service for you !
I think you are using this mode: One conversion of a created sample group, without interrupt service
The code in the help is really have problem.
I create a KE02 CW project based on the PE in CW with component ADC_LDD.
When I use the code from the help , I meet the same question with you.
So I check the ADC register, after I run this code:
Error = AD1_StartSingleMeasurement(MyADCPtr);
I find the ADC_SC1[COCO] already be 1, it means, the ADC already complete once converstion.
But when run
while (!AD1_GetMeasurementCompleteStatus(MyADCPtr));
The Status = DeviceDataPrv->CompleteStatus; in AD1_GetMeasurementCompleteStatus(MyADCPtr) function didn't get 1.
The problem is the real register of ADC didn't updated to DeviceDataPrv->CompleteStatus.
Then I modify the code in the main function to update the code to DeviceDataPrv->CompleteStatus and DeviceDataPrv->IntBuffer[Sample], the code will run OK, and the ADC result is correct.
My code in main function is as follows:
I also attached my project, you can refer to it.
Wish it helps you!
If you still have question, please contact me!
Regards,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. It would be nice!
-----------------------------------------------------------------------------------------------------------------------
Hi,
I find the function of "ADC_PDD_GetConversionCompleteFlag()" on PDD->ADC, while how put it in ADC:ADC_LDD, and in the methods i couldn't find it.
And how i find the code about this function ?
Thanks!
Linda
Hi Linda Yang,
The defination of ADC_PDD_GetConversionCompleteFlag is as follows:
#define ADC_PDD_GetConversionCompleteFlag(PeripheralBase, Index) ( \
(uint32_t)(ADC_SC1_REG(PeripheralBase) & ADC_SC1_COCO_MASK) \
)
This is just to check the ADC_SC1_COCO, if ADC_SC1_COCO=1, it means the ADC converstion is complete, then you can read the convert adc value.
You can find this funciton in ADC_PDD.h.
Wish it helps you!
If you still have question, please contact me!
Regards,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,JingJing
I could find the function, I mean that can I put "ADC_PDD_GetConversionCompleteFlag" to the components->AD1.like the screenshot
Thank you !
Linda
Hi Linda,
No, you can't put "ADC_PDD_GetConversionCompleteFlag" to the components->AD1 directly, and you don't need to put it into the ADC_LDD module.
Because in the AD1.h, it will include the ADC_PDD.h directly.
WIsh it helps you!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------