Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > ADC SAR low SPS issue

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



ADC SAR low SPS issue
Moderator:
ANCY

Post Reply
Follow this topic



ADC SAR low SPS issue

stoyan posted on 07 Nov 2011 4:37 PM PST
Senior Member
14 Forum Posts

Hi,

 I want to run SAR ADC at lower sampling ratio, let say 300 SPS, which is not allowed in the design. I read that there is a way around this using external clock for the SAR. I put a clock at 5400 Hz, and rebuild the project. It automatically put the SPS ratio to 300 and gets the clock of 5.40054 kHz. But there is a flashing red exclamation mark in the field with the clock in the component window. It says that accepts between 1MHz and 18MHz clock frequency only (the thing that I want to go around), but with that frequency I cannot get a low SPS. And I need 2 SARs to work in parallel getting signals from 2 different analog inputs. Nevertheless the project could be build without errors. So, is that an issue, or I should not pay attention to it. If this is a problem, why compiler (clean and rebuild option) does not catch it, and if it is not an issue, why do I have the error?

Thank you!

Stoyan




Re: ADC SAR low SPS issue

H L posted on 07 Nov 2011 09:26 PM PST
Top Contributor
679 Forum Posts

Don't use the ADC in continous mode, just do a AD conversion every 3.3mS



Re: ADC SAR low SPS issue

Gautam Das posted on 08 Nov 2011 02:23 AM PST
Cypress Employee
742 Forum Posts

Hi Stoyan,

 

Is there any specific reason why you want to sample at 300 SPS?

Are you using interrupt after every conversion to read the ADC data? If so, you can sample it at any higher permissible rate and give a 300Hz clock to "soc" terminal of the component. For this, the "Sample Mode" should be set to "Triggered".

 

Connecting an external clock of 5.4kHz to the ADC component might not be a good idea.



Re: ADC SAR low SPS issue

stoyan posted on 10 Nov 2011 09:30 AM PST
Senior Member
14 Forum Posts

 

 

Hi all,

Thanks, for the replies. The reason to use a low SPS is that I want to fill a continuous buffer (FIFO type) with the result of the ADC, so I can apply a filter to it. And due to limitation of the resources in the design (there won’t be enough memory to fill the buffer for let say 30 sec at 55k SPS) I want to reduce the SPS rate. I do not need the high SPS, and I need 3 channels. I prefer not to use MUX for switching between the channels, and use 100% of the ADCs available in the PSoC 5 instead (2 SAR ADC and 1 delta Sigma (DS) ADC). I read that multiplexing would cause me a lot of troubles if I use it on a DS ADC.  So the final configuration would be 3 ADCs (running at low rate – I need only about 100 SPS from each – my signal is between 5 and 15 Hz, but could go higher if I have to) filling 3 FIFO buffers. Due to limitations in the PSoC 5 architecture, I cannot use 3 DFB because I have only one DFB with 2 channels, and multiplexing may not work with the DFB. So I will apply software low pass filters on each buffer before continuing with the signal processing.

I can still put a timer and trigger an interrupt every 10 ms and get the result from the ADC. I am not sure how "correct" this approach would be.

Another approach would be to use a variable (double or long int) and sum the output of the ADC at 55k SPS. Then every 10 ms to get the result and divide it to 550 or so, and thus getting an average of this samples. this average would be my input for the FIFO buffer.

Either approach will take some processing and developing time, I usually prefer simplistic approach.

Could you please advise on this! Any help would be greatly appreciable.

Thanks!

Stoyan



Re: ADC SAR low SPS issue

H L posted on 10 Nov 2011 02:41 PM PST
Top Contributor
679 Forum Posts

You can use a fast ADC for slow sampling. Your ADC just finished faster.
Here is a simple c program to do this.
Note: You should consider what to do before the first 100 samples were
read. But that's is another problem.

void timer_interrupt (void)
{
 // interrupt every 3.3ms */
 /* all ADC are triggered mode */
 read ADC1;
 save reading to ADC1_data[counter];
 start ADC1 conversion;

 read ADC2;
 save reading to ADC2_data[counter];
 start ADC2 conversion;
 
 read ADC3;
 save reading to ADC3_data[counter];
 start ADC3 conversion;

 if (++currentCounter == 100)
 {
  currentCounter = 0;
 }

}

/* global variable */
uint8 currentCounter = 0;


void main(void)
{
 uint8 oldCounter = 0;

 /* init routine */
 
 while (1)
 {
 ....
  
  if (oldCounter != currentCounter)
  {
   oldCounter = currentCounter;
   
   /* do the averaging here */
   averageADCreadings();
  }
 .... 
  
 }
}
 



Re: ADC SAR low SPS issue

H L posted on 10 Nov 2011 04:01 PM PST
Top Contributor
679 Forum Posts

It is saver to do the following with the current counter

if (++currentCounter >= 100)
 {
  currentCounter = 0;
 }



Re: ADC SAR low SPS issue

yanhe posted on 11 Jun 2012 07:30 PM PST

1 Forum Post

I also have the same problem.I really want to use low SPS,but in Free Running Mode it seems can't realize.



Re: ADC SAR low SPS issue

Bob Marlowe posted on 12 Jun 2012 02:39 AM PST
Top Contributor
1768 Forum Posts

In free-running mode, that will not work as you expect. Use the triggered mode an set up a PWM or timer to trigger your ADC with the right frequency. When done, use the EOC with an interrupt to get woken up to retrieve the converted value or use a DMA to store them wherever you like, because at low conversion frequencies you'll waste all your MIPS when you poll for the result ready.

 

Bob



Re: ADC SAR low SPS issue

danaaknight posted on 12 Jun 2012 03:06 AM PST
Top Contributor
1773 Forum Posts

Muxing is the way to go. Primary concern with a mux is when channel is changed to allow mux

output to settle. This is because of mux Ron x Cstray and Cgd and Cgs charge injection into output

of mux from gate switch signal.

Also use of one SAR conserves Pdiss, code space, and resources for other uses.

Here is a generalized ap note on switches and muxes - http://www.maxim-ic.com/app-notes/index.mvp/id/638

Regards, Dana.

 






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20