ADC on FRDM-KL03Z

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

ADC on FRDM-KL03Z

Jump to solution
750 Views
steffenwickersh
Contributor I

Hello,

 

i´m trying to initialize the ADC module on the board FRDM-KL03Z with the Kinetis Design Studio + KSDK 1.2.0, but i didn´t found an example which tells me how i should start.. Can everyone help me?

 

Thanks!

Labels (1)
0 Kudos
1 Solution
514 Views
EarlOrlando
Senior Contributor II

Hello Steffen,

The function ADC16_DRV_ConfigConvChn triggers a new conversion if it is configured as software trigger.

The instance is a parameter to differentiate an ADC module when the MCU contains more than one module, in this case there is only one ADC instance (one ADC module) so you need to send a 0.

The ADC has two channel groups, A and B. If you review the KL03Z Reference Manual​ you will see that there are two SC1 registers (ADC0_SC1A and ADC0_SC1B), the chnGroup parameter chooses between these two groups for the same instance. As you are using software trigger you need to choose the group A, that is chnGroup = 0 because the group B is used only for hardware trigger (pages 385/386).

Best regards,

Earl.

View solution in original post

0 Kudos
3 Replies
514 Views
EarlOrlando
Senior Contributor II

Hello Steffen,

The FRDM-KL03Z driver example for the ADC is located in the path C:\Freescale\KSDK_1.2.0\examples\frdmkl03z\driver_examples\adc16. Please take a look into it. If you have doubts I remain at your service.

Best regards,

Earl.

0 Kudos
514 Views
steffenwickersh
Contributor I

Thank you!

I have a question for this example:

What is the difference between the parameter uint32_t instance and uint32_t chnGroup in the function call:

adc16_status_t ADC16_DRV_ConfigConvChn(uint32_t instance,

    uint32_t chnGroup, const adc16_chn_config_t *configPtr)

My goal is to configure the PTB1 (Pin13) as ADC. Depending on the analog value, a led on pin 14 (PTB2) should light up.

Thanks!

Steffen

0 Kudos
515 Views
EarlOrlando
Senior Contributor II

Hello Steffen,

The function ADC16_DRV_ConfigConvChn triggers a new conversion if it is configured as software trigger.

The instance is a parameter to differentiate an ADC module when the MCU contains more than one module, in this case there is only one ADC instance (one ADC module) so you need to send a 0.

The ADC has two channel groups, A and B. If you review the KL03Z Reference Manual​ you will see that there are two SC1 registers (ADC0_SC1A and ADC0_SC1B), the chnGroup parameter chooses between these two groups for the same instance. As you are using software trigger you need to choose the group A, that is chnGroup = 0 because the group B is used only for hardware trigger (pages 385/386).

Best regards,

Earl.

0 Kudos