Reading analog data from FRDM KW38 board

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

Reading analog data from FRDM KW38 board

1,181 Views
notanivipul
Contributor II

Hi,

I am facing trouble in reading analog data from my FRDM KW38 board, I am confused on what bases we select the SDC1 channel and ADC0

Thanks and regards

Vipul

0 Kudos
5 Replies

1,175 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi notanivipul,

    Do you mean, you don't know which pin for ADC1 and ADC0?

   You can check the reference manual, this part:

image.png

 

Then you can check the related pin in RM chapter 3.2 KW39/37 Signal Multiplexing and Pin Assignments

 

Wish it helps you!
If you still have questions about it, please kindly let me know!
Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------

 

0 Kudos

1,172 Views
notanivipul
Contributor II

Hi @kerryzhou 

According to the reference manual if I am reading data from PTB1 then channel 1 should be assigned for conversion right?

while(1) {

ADC0->SC1[0] = 1;
while (!(ADC0->SC1[0] & 0x80)){}
int res = ADC0->R[0];
PRINTF("%d\n",res);}

is this correct? I have initialized ADC0 before these lines of code and also set PTB1 as analog pin

and my other question is how to do I read 2 analog inputs at the same time? let's say the input pins are PTB1 and PTB3

Thanks and regards

Vipul

0 Kudos

1,161 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi notanivipul

    Do you also set the ADC0->SC1[0]  DIFF bit to 0?

    Now, what's the issue you are meeting?

   Do you try the SDK code, and modify the channel to ADC channel1:

SDK_2.6.7_FRDM-KW38\boards\frdmkw38\driver_examples\adc16\polling

   The SDK can be downloaded from this link:

   https://mcuxpresso.nxp.com/

Whether it works or not?

Please try the SDK ADC code at first.

Any updated information, just kindly let me know.

Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-----------------------------------------------------------------------------

0 Kudos

1,138 Views
notanivipul
Contributor II

Hi @kerryzhou 

Sorry for the late updates

Answering your first question ->  yes I have set the DiFF bit to 0.

When I select channel 1 (ADC0->SC1[0] = 1) I am getting values which are continuously varying but when i tried using channel 0(ADC0->SC1[0] = 0)  I got stable readings.

For my current project I have to write the drivers on my own that's why i can't use the SDK.

I tried referring the polling example in SDK, but I found it hard to understand.

Thanks and regards

Vipul

0 Kudos

1,122 Views
kerryzhou
NXP TechSupport
NXP TechSupport

HI notanivipul

   I mean, you can try the SDK, just modify the channel to your used channel, whether you still have issues or not? If the SDK don't have issues, I think we need to check more details about your code. That doesn't mean you use the SDK driver.  Just used for the testing.

  So could you please test the SDK on your side when you have time?

   Or If you can wait, I will help you to test it after Oct. 9th, as we are taking the National day from tomorrow.

Best Regards,

Kerry

0 Kudos