Welcome, Guest
Username: Password: Remember me

TOPIC: ADC_CHER configuration

ADC_CHER configuration 3 years 5 months ago #490

  • freddylamenace
  • freddylamenace's Avatar
  • OFFLINE
  • New Member
  • Posts: 13
  • Thank you received: 5
  • Karma: 2
Hi,

I'm a new user for arduino DUE and i have a problem for configuration : I want another POT for making special filtrers and I can't find explications for configuration of ADC_CHER[] and the while :

(extract from original code)
ADC->ADC_CHER=0x1CC0; // Enable ADC channels 0,1,8,9 and 10
while((ADC->ADC_ISR & 0x1CC0)!=0x1CC0)

Thanks.
The administrator has disabled public write access.
The following user(s) said Thank You: AuDioChosis

ADC_CHER configuration 3 years 5 months ago #491

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
Hi,

Have a look at this link:
www.avrfreaks.net/forum/arduino-due-adc-channel-sequence

Its also good to understand how the ADCs are mapped in arduino DUE, in this image you can have a clear idea:
www.robgray.com/temp/Due-pinout-A4.png

You can see there how the ADC labeled on the board as "A0" is in fact the ADC7. This is how sometimes configuring that register is a bit confusing.

Also dont forget the DUE micorocontroller datasheet (SAM3X-SAM3A):
www.atmel.com/Images/Atmel-11057-32-bit-...-SAM3A_Datasheet.pdf

If you still have problems, let me know!
The administrator has disabled public write access.
The following user(s) said Thank You: freddylamenace, AuDioChosis

ADC_CHER configuration 3 years 5 months ago #492

  • freddylamenace
  • freddylamenace's Avatar
  • OFFLINE
  • New Member
  • Posts: 13
  • Thank you received: 5
  • Karma: 2
Hi,

thanks for you answer but i don't understand the relation between 0x1CC0 and the number of the channels.

For example, if i want a pot in channel 11 (AD 13), what is the argument for ADC_CHER ?

Thanks
The administrator has disabled public write access.

ADC_CHER configuration 3 years 4 months ago #499

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
we want to enable ADCs 0, 1, 8, 9 and 10 that correspond to ADC7, AD6, AD10, AD11, AD12 respectively (you canverify it looking at this image www.robgray.com/temp/Due-pinout-A4.png).

Going to the datasheet page 1338 (www.atmel.com/Images/Atmel-11057-32-bit-...-SAM3A_Datasheet.pdf) you can see the ADC_CHER register, you can see that AD7, AD6, AD10, AD11 and AD12 correspond with bits 7, 6, 10, 11 and 12

if you take hits register (by default all zeroes) and place ones in the bits 6,7,10,11 and 12 you get 0011_1100_1100_0000 which is 0x1CC0 in hex.

If you want to add an extra pot in AD13 the binary would be 0011_1100_1100_0000 in hex 0x3CC0
The administrator has disabled public write access.
The following user(s) said Thank You: freddylamenace, AuDioChosis

ADC_CHER configuration 1 year 10 months ago #1150

Hello and thanks for clarifying this. The original Pedal Due code had confused me:

ADC->ADC_CHER=0x1CC0; // Enable ADC channels 0,1,8,9 and 10 (???)

The comment says ADC channels but the numbers apparently refer to Arduino pin pad numbers.

And the SAM3 data sheet isn't all that clear. It uses the term "ADC channel" on page 1338 but refers to its pins as AD0..AD15 elsewhere. Plus the somewhat perverse mapping of Arduino pin pads and labeling adds more confusion.

The reality is that the pedal code assigns ADC_CHER=0x1CC0 which enables ADC channels 7, 6, 10, 11, & 12 ( not 0,1,8,9 and 10). However those ADC channels do correspond to Arduino pin pad numbers 0,1,8,9 and 10.

So if I wanted to use just ADC channel 0, I would assign ADC_CHER=0x0001
and connect my input to Arduino Dup pin pad number A7, yes?

Thanks again for helping with this issue.

Cheerio, Aaron[/size]
The administrator has disabled public write access.

ADC_CHER configuration 1 year 10 months ago #1151

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
The reality is that the pedal code assigns ADC_CHER=0x1CC0 which enables ADC channels 7, 6, 10, 11, & 12 ( not 0,1,8,9 and 10). However those ADC channels do correspond to Arduino pin pad numbers 0,1,8,9 and 10.
Yes, as I mentioned before the way the Atmel datasheet labels the ADCs is different from the Arduino labels. It is confusing yes, if you name them one way or the other, somebody is going to be confused.

So if I wanted to use just ADC channel 0, I would assign ADC_CHER=0x0001
and connect my input to Arduino Dup pin pad number A7, yes?
Yes, you are right.
Last Edit: 1 year 10 months ago by Ray.
The administrator has disabled public write access.
The following user(s) said Thank You: AuDioChosis
Time to create page: 0.215 seconds
Powered by Kunena Forum
Joomla SEF URLs by Artio