How use ADC to take measurements

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

How use ADC to take measurements

Jump to solution
1,533 Views
jacewalton
Contributor III

I am using an ADC peripheral  driver to take measurements of voltage.

I am using sdk 1.3.0 and the MK22F board 

I used PE to set up the ADC. 

I see the the   PE_low_level_init(); function the ADC in initalized but how do I use it. 

I already checked the ADC examples in C:/freescale/sdk1.3.0/examples.... 

I could not get the projects to build I shall include my project in case you need it. 

 

Here are the functions that I am using to try to read the ADC value

 

ADC16_DRV_SetChnMux(0, 0);
val = ADC16_DRV_GetConvValueRAW(0, (uint32_t)0);

 

The project's name is Worktax.

Original Attachment has been moved to: worktrax.zip

Labels (1)
1 Solution
818 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

If you are using FRDM-K22F board, download the FRDM-K22F-SCH Schematics from this weblink.
You need check whether the crystal(Y1) and C31\C38 are  soldered correct.

That fei_blpi example works because it did't use the external crystal as clock source.

If the crystal is correct soldered, then other examples will works.

Best Regards,

Robin

 

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

View solution in original post

0 Kudos
6 Replies
818 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Since you are using FRDM-K22F board, why not direct test the ADC demo examples in SDK_2.1_FRDM-K22F?

readme.png

ADC SDK_2.1_FRDM-K22F.png

Search 'K22F' then select FRDM-K22F board.

Select FRDM-K22F.png

After specify additional configuration settings, you can download SDK_2.1_FRDM-K22F.

download SDK_2.1_FRDM-K22F.png

 

You can getting start with KSDK and KDS from reading below:

 "How to start with KSDK"  and "KDS Document List".

 

Best Regards,

Robin

 

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

818 Views
jacewalton
Contributor III

Thank you for the replies I have done this however and could not get the Demo to run it will build and debug for non of the functionality on any of the demo apps has worked for me or my colleague.

not sure what the problem is.

I also do have the Platform project that is necessary to build the projects with.

any ideas?

818 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Jace,

It looks like the examples in SDK_2.1_FRDM-K22F never works on your FRDM-K22F board.

From your first question "HardFault problem in KDS using K22F ", hardfault happens when trying to run CLOCK_InitOsc0() function. Have you ever modified the crystal circuit of FRDM-K22F board?

441338 2.png

Would you please try to run the fei_blpi example( ...\SDK_2.1_FRDM-K22F\boards\frdmk22f\driver_examples\mcg\fei_blpi).

fei_blpi SDK_2.1_FRDM-K22F.png

If that example works(the Green LED blink), you may need to check your crystal circuit.

crystal circuit FRDM-K22F.png

Best Regards,

Robin

 

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

0 Kudos
818 Views
jacewalton
Contributor III

the Green LED blinks. where do I find the crystal circuit and in what way do I modify it?

0 Kudos
819 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

If you are using FRDM-K22F board, download the FRDM-K22F-SCH Schematics from this weblink.
You need check whether the crystal(Y1) and C31\C38 are  soldered correct.

That fei_blpi example works because it did't use the external crystal as clock source.

If the crystal is correct soldered, then other examples will works.

Best Regards,

Robin

 

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

0 Kudos
818 Views
jacewalton
Contributor III

I got a different k22f board and the demo apps work, there must be a problem with my crystal circuit...

thanks

0 Kudos