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.
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:
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.
When I try to change the ADC pin define, the following blank screen appears. How do I change the pin define?
Retrieving data ...