How to use Differential A/D on KW41z?

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

How to use Differential A/D on KW41z?

630 Views
danieltseng
Contributor V

I see the user guide has this set of circuits, maybe it can test read differential A/D (ADC0_DM0 and ADC0_DP0).

Does SDK have a corresponding example that can be used directly? I haven't found this example so far.

pastedImage_1.png

 

Labels (1)
  • KW

0 Kudos
3 Replies

513 Views
danieltseng
Contributor V

When I try to change the ADC pin define, the following blank screen appears. How do I change the pin define?

pastedImage_1.png

pastedImage_2.png

0 Kudos

513 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel,

 

Could you please let me know if you can see the pin configurations after changing the active project from the drop-down list?:

pastedImage_2.png

If that doesn't work, could you please try clicking the following button with your ADC project selected in the project explorer window in MCUXpresso?:

pastedImage_4.png

 

Best regards,

Sebastian

0 Kudos

513 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel, I hope you're doing well!

 

To enable differential mode for an ADC channel, the DIFF field in the ADC Status and Control Registers 1 (ADCx_SC1n) has to be set to 1.

 

For instance, in the adc16 polling SDK example (found in the SDK path, here <...\SDK_SDK_2.2.1_FRDM-KW41Z\boards\frdmkw41z\driver_examples\adc16\polling>), the ADC channel can be changed to:

#define DEMO_ADC16_USER_CHANNEL 0U‍

And the differential conversion flag to:

#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE
    adc16ChannelConfigStruct.enableDifferentialConversion = true;
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */‍‍‍

 

This configures ADC0 to use differential mode, but this has some other implications, like changing the way the MODE field in the ADCx_CFG1 behaves. When differential conversion is enabled, there's an additional bit used in the ADC's output, as data is returned in 2's complement, and the MSB is used for the sign.

In the example, the corresponding pins for differential ADC0 Channel 0 must also be be enabled and routed:

pastedImage_2.png

 

There's some additional information about differential mode in the KW41Z's Reference Manual (chapter 29.2.5), as well as in the KW41Z's device Datasheet.

 

Please let me know if you need any more information.

 

Best regards,

Sebastian

0 Kudos