Page 1 of 1

Differential input mode (ADC) on Sam3

Posted: Fri Nov 27, 2015 3:49 pm
by sebi_sam3
Hello at91 community :D

I got some issuse with the ADC from my ATSAM3S4B. I hope this is the right place for my question.

I like to use the ADC channel 6 in differential input mode. In addition to that i like to use channel 4 and channel 5 as singel ended input. The code below shows my Initializations-Funktion.

Code: Select all

void adc_setup(void){

	PMC->PMC_PCER0 = REGION29;//Power to adc
	adc_init(ADC, sysclk_get_main_hz(), ADC_CLOCK, ADC_SETTLING_TIME_3);
	adc_configure_timing(ADC, 0, ADC_SETTLING_TIME_3, 1);
	adc_set_resolution(ADC, ADC_MR_LOWRES_BITS_12);
	adc_configure_trigger(ADC, ADC_TRIG_SW, 1);
	
	adc_enable_anch(ADC);
	adc_enable_channel_differential_input(ADC, ADC_CHANNEL_6);
	adc_enable_channel(ADC, ADC_CHANNEL_6);
	
	adc_enable_channel(ADC, ADC_CHANNEL_4);
	adc_enable_channel(ADC, ADC_CHANNEL_5);
	adc_start(ADC);
}


But this funktion lead to my problem which is that all channel's are in the singel ended mode.
I had read the datasheet but cannot find any hint for solution. I searched in the web for idee's but do not get one. This is the reason for my post.

Is here someone how can tell me what is wrong with my Initialize funktion ore can give me a hint????

With my debugging tool (Atmel Ice) i had controlled the register values. The funktion set the requierd bits in the registers. But i dont get the funktionellity which i need :x

My development environment is atmel studio 6.2 with ASF 3.27.0 (old version November 2015).

I hope for help :) :) :)

Re: Differential input mode (ADC) on Sam3

Posted: Mon Nov 30, 2015 3:43 pm
by sebi_sam3
Is there really no one who can help me :?:

My ADC works but, only in the single ended mode. I can not understand what is wrong with this Initialize function because this function will set the bits in the register requiert.

in ADC_MR ANACH is 1
in ADC_COR DIFF6 is 1
in ADC_COR DIFF7 is 1

Did you mean i forgot something ?

Is there a possibility that my problem occurse with wrong setup for Gain and offset?
Shoud i enable clock for PIOB?

Re: Differential input mode (ADC) on Sam3

Posted: Tue Dec 01, 2015 7:21 pm
by jonavarque
I wrote to Atmel about the exact same situation with the G55 and got no response. NO info in the docs. Very poor.

Re: Differential input mode (ADC) on Sam3

Posted: Wed Dec 02, 2015 11:02 am
by sebi_sam3
hmm ok very nice :shock: :oops: :cry:

Can I ask you, when you wrote to Atmel ?

On which way you solved this problem in your application ?
Did you take two singel ended channels, and subtract the results for the difference value?