ADC does not enable

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

I am using the ADC example program with a AT32UC3B1256, STK600 and JTAGICE mkii. I step through the below line of code, but when I look at the ADC registers, the ADC enable bit for chan 6 is not being set.

adc->cher = (1 << 6);

I tried setting the bit for other channels, but they would not set either. Is there some kind of lock bit that I don't know about that might be stopping me from enabling the ADC? Any other ideas why the ADC won't enable?

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

UC3B1256 contains only 6 ADC channels

Check Configuration summary of UC3B data sheet

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

Thanks for pointing this out. It is always a good idea to use an existing ADC instead of an imaginary one! I still have the issue at other ADC's as well. I tried all six. The ADC just returns 1023 no matter what the reference voltage is. Also, when I look at the ADC_CHER register it does not get set. It seems as though it is locked out somehow. I tried a couple of devices to see if it was device specific, but they both behave the same way. Could there be a lock bit somewhere I don't have set properly?

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

I found my issue. I was trying to read ADC_CHER. ADC_CHER is a write-only register. I need to read ADC_CHSR to get back the status.

The actual ADC problem was a mishandling of pointers. Nothing related to ADC_CHER getting set.