How to use ADC by differential mode

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5 posts / 0 new
Last post
imaizumi.k
Offline
Last seen:1 month 1 week ago
加入:2018-06-22 01:18
How to use ADC by differential mode

Dear Dialog team,

I want to use ADC by differential mode, but I can't understand how to set input pins.

For example, I want to set P0_6 as positive input pin and P0_7 as negative input pin.

But I couldn't set both input pin in adc_config_t because selectable input pin is one.

adc_config_t adc_cfg =

{
.input_mode = ADC_INPUT_MODE_DIFFERENTIAL,
.input = ADC_INPUT_DIFF_P0_6, // Where can I write ADC_INPUT_DIFF_P0_7 ?
.smpl_time_mult = 2,
.continuous = false,
.interval_mult = 0,
.input_attenuator = ADC_INPUT_ATTN_NO,
.chopping = false,
.oversampling = 1
};

Could you tell me the solution?

Best Regards,

Keywords:
Device:
PM_Dialog
Offline
Last seen:15 hours 59 min ago
工作人员
加入:2018-02-08 11:03
Hi imaizumi.k,

Hi imaizumi.k,

Thanks for your question and for your inputs. I would like to inform you that we are working on that internally, so I will get back to you as soon as possible.

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:15 hours 59 min ago
工作人员
加入:2018-02-08 11:03
Hi imaizumi.k,

Hi imaizumi.k,

The ADC configuration structure seems to be correct. Please use the same configuration structure and pass it into adc_init(). After the call of adc_init(&adc_cfg); you should select the P0_6 as a positive input, so please add the following line:

SetBits16(GP_ADC_SEL_REG, GP_ADC_SEL_P, 2); // select P0_6 as a positive input channel

然后,你商店uld use adc_set_diff_input() function in order to select the negative differential input channel.

adc_set_diff_input (ADC_INPUT_DIFF_P0_7) ; // select P0_7 as a negative differential input channel

Please let me know if you can use the differential with the above instruction. Any feedback or suggestion would be more than welcome!

Thanks, PM_Dialog

imaizumi.k
Offline
Last seen:1 month 1 week ago
加入:2018-06-22 01:18
Thank you for your response.

Thank you for your response.

But I’m worried to access register directly for setting a positive input without using API.

Do you have some plan to improve ADC API ?

Best Regards,

PM_Dialog
Offline
Last seen:15 hours 59 min ago
工作人员
加入:2018-02-08 11:03
Hi imaizumi.k,

Hi imaizumi.k,

I have already raised it internally. Thanks for your valuable feedback.

Regards, PM_Dialog