- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am looking to sample 16 inputs using the ADC and my PSoC5. I am looking for the most efficient and the fastest way to do this.
My current attempt is not working well - I tried to use an ADC_SAR_Seq block with 16 inputs. I am getting some values that are vaguely relevant but the performance is really really bad.
What I actually need is to sample different channels at different points in my main loop. Some need a Moving Average filter, some are fine as single sample. So I think I will need to implement a component based solution, i.e. a separate MUX and ADC.
Signal wise:
0-5v input
<10Hz sampling frequency required.
Performance improvements:
Decoupling RC on each pin - high frequency noise removal.
As I know from Step1 to Step2 what the next channel that needs sampling is, I can preset the MUX and allow it to settle.
I can introduce a generic LPF between the MUX and ADC ( not sure how well this would work) using the highest frequency acceptable for my signals.
Do I need a PGA after the MUX, before the filter? Could probably use a unity gain amp there.
Thank you very much!
Andrei
Do you have any suggestions how to best implement this?
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Every suggestion depends on the usual required answers:
Max signal frequency
wanted conversion rate
wanted precision
Signal to noise ratio
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
I mentioned that my max freq is 10Hz.
Ideally I want 12bit precission and fastest conversion rate and best signal to noise.
( I know these are the worst requirements possible - fastest, best etc ) but I would like to achieve the best with minimum processor intervention.
My other idea is to use DMA and a ring buffer and just poll in my main whenever I need the value. The problem here is I have not worked with DMA so it's more of a second stage development idea this one.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can introduce a generic LPF between the MUX and ADC ( not sure how well this would work) using the highest frequency acceptable for my signals.
Do I need a PGA after the MUX, before the filter? Could probably use a unity gain amp there.
That is a good idea, eg. Mux >> LPF >> ADC. If you account for the ADC Zin (if
you bypass input buffer) you can design the filter appropriately w/o having to use
PGA. Filter can be DFB or just use Sallen Key solution with a PSOC OpAmp.
Latter less noise, power, but there are other tradeoffs, passive filter T sensitivity
on passive components for example.
Real question about G is what's the range you have to handle and the resolution, 1 LSB
V equivalent, you need. You can take G in the front end of the ADC, but you give up
R-R performance if you do. And G limited to 8.
If you are in a high CM environment then use A/D in differential mode.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some DMA ap notes -
http://www.cypress.com/documentation/application-notes/an52705-psoc-3-and-psoc-5lp-getting-started-d... AN52705 Getting Started with DMA
http://www.cypress.com/documentation/application-notes/an84810-psoc-3-and-psoc-5lp-advanced-dma-topi... AN84810 PSoC® 3 and PSoC 5LP Advanced DMA Topics
http://www.cypress.com/documentation/application-notes/an61102-psoc-3-and-psoc-5lp-adc-data-bufferin... AN61102 PSoC® 3 and PSoC 5LP - ADC Data Buffering Using DMA
www.cypress.com/file/48886 CE56273 – SPI With DMA in PSoC® 3 / PSoC 5
http://video.cypress.com/video-library/search/dma/ Videos on DMA
https://www.youtube.com/results?search_query=dma+psoc Videos on DMA (some overlap)
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another important question - Should I just abandon the ADC_SAR_Seq block and just use the separate component approack?
It's really not working well and seems that some channels influence each other.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given that you want to filter each channel, the best approach would
be a mux in front of SAR operated as one channel, so you can implement
one LPF for all channels. Keep in mind, however, you need to calc the
settling time of the filter to the resolution you want to run at, or its settling
time will add to the error budget.
Or use DelSig, with mux. Advantage here is higher resolution, up to 20 bits.
Your 10 Hz, x 2 Nyquist x 16 channels = min sample rate of 320 sps. The delsig
will do 19 bits at that rate.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On the subject of channel crosstalk, several considerations -
1) If your source Z is quite high thats a candidate for E field coupling,
so layout critical. Also subject to common mode pickup, so differential
signal path architecture best.
2) The faster you run sampling the more crosstalk you will get.
Tradeoffs, always tradeoffs.
3) Use PSOC as its own testbed. Use the DelSig to measure channel to channel isolation.
Use WaveDAC8 to inject a channel with sine and measure the other channels.
Ref material - https://www.dropbox.com/s/ruaf9booe17jk8n/PCB%20Layout.zip?dl=0
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dana,
Thanks for all the info. The Dropbox folder seems to be empty though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!
I will test the config tonight and feedback asap.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This might sound like a silly question but:
Can the ISR functions live in a separate file or MUST they be in the Main?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
They can be on:
- The main file. You can define the function before the main loop with CY_ISR nameofyourfunctionhere{...code here...}, then inside the main loop you start it using the ISR_StartEx(nameofyourfunctionhere); function.
- The .c file related to the interrupt component, you only use ISR_Start() on the main loop, and place your code on the CY_ISR() function (this function is in the .c file related to the isr component), between /* `#START ISR_Switch_Interrupt` */ and /* `#END ISR_Switch_Interrupt` */ flags.
- Or if you are using Creator 3.3 there is a new header file named "cyapicallbacks.h", you can declare the function there, and define it anywhere else.