You are here

Setting Up and Using ADC for CYBLE-222014-01 | Cypress Semiconductor

Setting Up and Using ADC for CYBLE-222014-01

Summary: 3 Replies, Latest post by Bob Marlowe on 17 Jul 2017 01:34 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Ted Mawson's picture
User
22 posts

I've got a Sequencing SAR ADC (ADC_SAR_Seq_1) in my project and I want to read 2 channels, Vbatt and a mic level input.  The mic level needs to be read 250 SPS and Vbatt maybe 2 SPS.  This is a super low-power project so any chance to save power will need to be taken.  I do have a timer interrupt system set up that is called 250 times per second that I could use to trigger a conversion.

At first I thought I'd make my ADC Free Running and live with the fact that the Vbatt input would be way oversampled but the minimum clock frequency of 1000 kHz gives a SPS of 1557 so I gave up on that and set it to Hardware trigger.  Reading the DS, I can see that I can start a sample by ADC_StartConvert() but it's not clear how I select which channel to convert as there doesn't seem to be an ADC_SelectChannel() command.

Have I missed something in that I may still be able to free run at 250 SPS?  If not, how can I select which channel gets converted?  What's the best way to save power between conversions?

Attachments: 
user_1377889's picture
User
10705 posts

The SequencingADC will scan all channels (in your case only one) at soc except the "Injection Channel". This conversion you may start using the ADC_EnableInjection() API which will additionally scan it at the next soc. All can be handled quite easy within the eoc interrupt handler.

 

Bob

Ted Mawson's picture
User
22 posts

Bob,  Please look at the graphic I attached.  I have 2 channels + the Injection Channel although I confess I don't know what the Injection Channel is for.  If I start a conversion during my 250 every second ISR (I think you're saying both will be converted), how will I get the 2 different results back?

user_1377889's picture
User
10705 posts

Please read the first page of datasheet for "Injection Channel"

An optional “Injection channel” may also be enabled by firmware to occasionally scan a signal that does not need to be scanned at the same rate as other channels.

So your regular conversion channel is the mic and occasionally the Vbat.

To get the values, see list of APIs in DS.

 

Bob

Log in to post new comments.