ADC configuration to work with multiple pins

Discussions around product based on ARM Cortex M0+ core.
This forum will be discontinued soon.

Moderator: nferre

Yaro
Posts: 13
Joined: Mon May 25, 2015 8:00 pm

ADC configuration to work with multiple pins

Wed Nov 25, 2015 3:43 pm

Hi all,

I've a question about ATSAMD20 ADC module. I've added ADC Converter(polled) driver from ASF and I wanted to used it to convert inputs from ADC pins.

My problems is that the example is very simple and I've problems to set it with my custom board.

In particular I've 4 pins ADC each with a signal and I need to sample each pin individually when I need. For example, start ADC module and read pin 1 after some time read pin 2 ecc.

I've also added two references on my board (VREFA and VREF) that I want to use.

Can someone help me how to setup ADC with external pin reference? And how I can tell to ADC to sample me a particular pin, it should initializated with ADC or initializated after ADC init.?

Thank you!
sarlacii
Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

Re: ADC configuration to work with multiple pins

Wed Nov 25, 2015 4:13 pm

Hi Yaro, I think you're asking too broad a question. It's pretty much "how do I use the ADC" in breadth... and I'm not sure if you'll get the answer you want. You need to hit the documentation and ASF references (like http://www.atmel.com/images/Atmel-42109 ... T03243.pdf) to get the general idea. Then pop by the forum with some specific questions?
Go well.
Yaro
Posts: 13
Joined: Mon May 25, 2015 8:00 pm

Re: ADC configuration to work with multiple pins

Wed Nov 25, 2015 8:31 pm

Thank you for your answer. I've checked the document and made working ADC module. But I've a dubt about pin selection. I've 1 ADC and up to 20 channels. I can sample multiple pins using pin_scan mode that sample all pins I need every time I call ADC. But if I have 2 channels to sample and I want to sample only the first channel and after some minutes the second or another case where sometimes I want to sample the first channel and sometimes the second(reducing time of sample instead sample every time first and second channel), I need every time stop ADC module and init. it again with new channel pin settings?
sarlacii
Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

Re: ADC configuration to work with multiple pins

Thu Nov 26, 2015 10:32 am

Hi there, yip - the ARM devices give you a ton of options, but they can only do so much. If you swap between fundamental signal paths you do have to set things up each time. Perhaps have a look at using the events system (http://www.atmel.com/Images/Atmel-42108 ... T03245.pdf) to allow the various signals to get through to another peripheral without your immediate intervention (ADC count to timer etc.)?

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 1 guest