How to start an ADC, Processor ecpert, KSDK 1.3.0

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

How to start an ADC, Processor ecpert, KSDK 1.3.0

Jump to solution
1,169 Views
randenewberry
Contributor IV

Using KDS_3.0+KSKD_1.3+PE with a MK02FN64VLH10 on a custom board.

I'm new to this and its probably something obvious..but after a day of trying I have to ask:

 

I used PE and the adCnv1:fsl_adc16 component to set up ADC0_se12 as an 8 bit Converter.

I checked Pin_mux>ADC , and this was the default for 2,PTB , so I did not change anything there.

I selected A/D channel (pin), and under ADC Configurations>Name, I changed this to Low_Bat_InitConfig0.

 

For some reason I have a new event, ADC0_IRQHandler. I don't want to convert on an interrupt, I want to:

 

1. Start a conversion in code. (can't find anything that looks like it will do this)

2. Wait for the Conversion to finish, See this one: ADC16_DRV_WaitConvDone(adConv1_IDX,); But not sure what the pass values are..

3. Get the results, also see this, ADCBattvaule=ADC16_DRV_GetConvValueSigned(adConv1_IDX,); Again, not sure what to pass in..

 

What is the structure to get the adc started?

And, exactly what should I put after the comma in the in the parenthesis?

Labels (1)
0 Kudos
1 Solution
706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Rande,

- I recommend you refer to one ADC demo , under the KSDK1.3  there is no ADC demo about MK02 chip,

while you can refer to the other chip demo, for example , you  can refer to the TWRK60d100m

(KSDK_1.3.0\examples\twrk60d100m\driver_examples\adc16), the usage of the functions is the same among the

chips, you can also refer to how to pass the parameter.

In the example , you can see the three functions you mentioned :

pastedImage_0.png

- About the interrupt of ADC complete , you can disable it at here(uncheck the "Interrupt")

pastedImage_0.png


Have a great day,
Alice Yang

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

View solution in original post

0 Kudos
6 Replies
707 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Rande,

- I recommend you refer to one ADC demo , under the KSDK1.3  there is no ADC demo about MK02 chip,

while you can refer to the other chip demo, for example , you  can refer to the TWRK60d100m

(KSDK_1.3.0\examples\twrk60d100m\driver_examples\adc16), the usage of the functions is the same among the

chips, you can also refer to how to pass the parameter.

In the example , you can see the three functions you mentioned :

pastedImage_0.png

- About the interrupt of ADC complete , you can disable it at here(uncheck the "Interrupt")

pastedImage_0.png


Have a great day,
Alice Yang

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

0 Kudos
706 Views
randenewberry
Contributor IV

Hi Alice,

After some time I found the definitions, they are all 0's, except

ChnConfig. I could not find another occurrence of that term, so I put in

the name I gave it, and it worked.

After I debugged the ADC without a problem, I found an error popped up

in the SDK>drivers>src.adc16 > fsl_adc16_driver.c. I tried close, exit ,

open, clean, rebuild but the error is still there, see below pic.

It does not affect anything so far..but do you know what would cause

this, or how to remove the error?

Rande Newberry

H-ITT, LLC, a Hyper-Interactive Teaching Technology Company

420 Shearer Blvd.-Cocoa, FL, 32922

PH: 888-322-0089

rande@h-itt.com

0 Kudos
706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Rande,

Please delete the ksdk_platform_lib on the KDS project explorer :

pastedImage_1.png

then delete the "debug" folder :

pastedImage_0.png

then re-import it , build.

If still have error , please show me the console window :

pastedImage_2.png

(Doesn't you change the code of the driver ?)

BR

Alice

0 Kudos
706 Views
randenewberry
Contributor IV

Hi Alice,

I was not that far into the project so I deleted it and started a new one.

So far everything is working well.

Thank you for all the assistance!

Rande Newberry

H-ITT, LLC, a Hyper-Interactive Teaching Technology Company

420 Shearer Blvd.-Cocoa, FL, 32922

PH: 888-322-0089

rande@h-itt.com

0 Kudos
706 Views
sportsradar
Contributor I

Alice, you recently replied to Rande Newberry referring him to use the demo sample. After trying that and following along, the code still doesn't work.
Could you through the code together and post for me, on Rande's post.
Thank you so much for your help.

0 Kudos
706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Katrina,

Sorry  i do not know your meaning , do you want the demo code i mentioned ? This is the kSDK demo ,

after you install the KSDK, you can find it.

And if you need help , could you please describe detail about the "doesn't work", do you also use K02 chip ? KDS? thank!

BR

Alice

0 Kudos