We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have had a remarkable lack of success trying to locate information about the M0 ADC. I need to know
I want to create a voltage divider network that drops the sampled voltage down to the 0-1.0V requirement, that consumes minimum power while still giving the capacitor time to charge. The one circuit I've found consumes 20mA; if possible, I'd like to create one that reduces this to single-digit uA or better still, nA. But to do this, I need the resulting RC circuit to be able to charge the capacitor in, say, 80% of the sampling aperture time
To be more precise, I need this data for an Atmel SAMD21 chip
joe
I was not aware that a Cortex M0 was a "peripheral". I am using an Adafruit Feather M0 to build my latest project, and it needs to monitor a voltage. I finally found a data sheet I could download (why I was not able to find one yesterday escapes me), and it has a nice couple pages (727-729) that answered all my questions. Now the only remaining questions are how to set the sampling frequency from C without resoriting to inline assembly, and perhaps the sampling time as well. I was given a silly circuit that consumed 20ma in the voltage divider, and someone carefully explained to me that the sampling aperture was fixed (it isn't). I came up with a circuit that draws 7.5uA, which is still too much, but if I multiply everything by 4 I get down to under 2uA. To do this, I need to stretch the sampling clock. Another solution that occurred to me was to put the lower end of the voltage divider through a MOSFET, and turn it on only when I want to sample the voltage. All I have to do is calibrate to its voltage drop, and I get a nearly-zero-uA solution. I thought the ADC was part of the M0 chip. Perhaps were are not speaking the same language here.
The goal is to build a sensor that allows me to measure battery consumption in any external project, either 3.3V or 5V, for portable battery-powered devices. It will log each 1/1024th of a Coulomb (roughly, count milliCoulombs).
To make the "peripheral" thingy clear: the Cortex M0 really is just the processor core. It does not provide any peripherals like an ADC. That's what's implemented by the vendor, Microchip in Your case. And that's why in this forum you might not have much success in getting an answer. The Microchip Forum might be a better place to ask specifics. But let my try and help you with your questions: The SAMD21 ADC's sampling time is controlled via its SAMPCTRL Register. You can write a register in C by simply defining a variable with its address like this, e.g:
#define ADC_SAMPCTRL *(uint32_t*)0x42004003
ADC_SAMPTCRL = your value...I'm also not entirely sure you have the right manual, though, since the ADC part starts on page 888.The manual I'm talking about can be found here: http://ww1.microchip.com/downloads/en/DeviceDoc/SAM-D21-Family-Datasheet-DS40001882C.pdf, the register I'm talking about is described on page 906.Regarding the current draw, the ADC just consumes 100nA, so it really is all about your voltage divider...Hope this helps to some extent!