ADC problems with SAMD10 D14

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Hello from Germany!

Since 2 month, I have been programming the SAMD10 D13 MCU, as the ARM CORTEX
world is absolutely new to me. I do not use ASF or CMSIS, as I want to prevent huge code,
and I want to be independant. Many things like GPIOs, TC1 and TC2, UART work very well, but
the ADC annoys me since some days. Things like averaging, oversampling are switched off. I use
single ended mode, 12 bit,right adjusted and VREFA=2.5V. The huge offset of 512 (all numbers are decimal)  
could be compensated by offset correction. But an input voltage of 2.5 V does not cause 4095 as ADC value,
but something like 1300. 3.3 V cause about 2050. This means, gain is much too low, but even a gain
correction with data 0xFFF is not sufficient. A very critical item in my case is the calibration register,
requiring correction data from the NVM area 0x806020 von Bit 27-37, being address 0x806023 Bit 3 to
0x806024, bit5. I copy the NWM correction 11 bits as follows:

Addr 0x806023 Bit3 -> register CALIBRATION bit 0
Addr 0x806023 Bit4 -> register CALIBRATION bit 1
Addr 0x806023 Bit5 -> register CALIBRATION bit 2
Addr 0x806023 Bit6 -> register CALIBRATION bit 3
Addr 0x806023 Bit7 -> register CALIBRATION bit 4
Addr 0x806024 Bit0 -> register CALIBRATION bit 5
Addr 0x806024 Bit1 -> register CALIBRATION bit 6 and so on.

But the result is, that the ADC behaves like a random generator, meaning,
a copy of wrong bits. Therefore I do not use it at present. What is wrong,
referring to my train of thoughts?

Kind regards,
Uwe
This topic has a solution.
Last Edited: Tue. Feb 27, 2018 - 08:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Maybe create (dare I say it) an ASF project with just the ADC and compare the register settings.  Also, verify the ADC clock is not too fast.

/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Meanwhile I have solved this problem. The solution is, SAM D10/D20 ADC always work with differential inputs, even if you use

single ended mode, which is not directly mentioned. Technical documentation sucks. Therefore you must connect the negative

input with GND internally (INPUTCTRL.MUXNEG=0x18).

 

I want to avoid ASF, as its code is much too long, as it must cover all purposes, how to use the driver, is overengineered. And frankly, you hardly

don't learn much, you get dependent, and ASF does not release you, to read the technical manual, so you have double work!

Kind regards,

 

Uwe 

Last Edited: Mon. Feb 26, 2018 - 10:29 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Uwe60 wrote:
I have solved this problem

So please mark the solution - see: https://www.avrfreaks.net/comment...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...