AnsweredAssumed Answered

How to configure differential ADC on K22FN1M0

Question asked by Angelo Quattrociocchi on Jul 26, 2014
Latest reply on Aug 5, 2014 by Richard Tseng

I am using the MQX4.1 lwadc based on the example code for the twrk21f120m board, and for single-ended readings it appears to work fine.  But I also have a differential input on a custom board I want to use and I'm not sure how to set that up.

 

The source I'm using is ADC0_SOURCE_ADPM1 (pins 14 an 15 on the 100pin K22).  This source (according to adc_mk21f.h) includes the ADC_SOURCE_DIFF flag, so I was hoping it would work without extra effort, but it looks like I'm getting only a single-ended reading.

 

If I call _lwadc_get_attribute(lwadc_ptr,LWADC_DIFFERENTIAL,&value), I get a response of 0.  If I try to set it (calling _lwadc_set_attribute(lwadc_ptr, LWADC_DIFFERENTIAL, 1)), I get an error.

 

Are there some other flags or configuration I need to do to get differential readings?

 

Thanks,

Angelo

Outcomes