Does anybody have an example of using the digital filter without DMA, under software control only?
For example, ADC_SAR > Filter Channel 1 > DAC8, with code in main.c? In other words, simplest way possible without DMA?
It would be interesting to know why you want to cut the abilities (DMA, Ints) of the PSoC5.
What do you want to do with the filtered data, what is your needed/wanted conversion rate, what resolution is required?
Our timing is determined by a clock driven interrupt that sets the sample rate of the input ADC and DAC. Output of the ADC_SAR should go directly to the filter, output of the filter goes directly to the VDAC8 channel.
I guess the real question is:
Can the digital filter be used without using the DMA? If so, how? Where is an example?
Why? Because we wish to maintain timing of sample processing via software instead of relying on DMA. Reasons for this I cannot discuss here.
The DFB Assembler would be a straightforward way of accomplishing
what you want. All you need are filter coefficients and topology, IIR,
FIR, and the coding should be pretty simple. Coefficients you can get
from Cypress tool, or there is a lot of freeware for designing filters.
Food for thought, Dana.
Thanks Dana. We have the filter topology and coefficients figured out, the difficult part has been getting the data in and out of the filter in a way that we have full control over it.
I was hoping someone had already figured it out without us having to reinvent the wheel. My DSP guy has been smashing his head against the wall over this. He's not comfortable with DMA and learning curve is too steep with the deadline we have.
What we really need is an education in DMA and how we can keep up with it in software so when data is transferred we can synchronize the filter output to our processing algorithm.
Also, there are sample projects available for the componts (Right click, search for sample projects).
Last but not least: one can trigger a DMA via software, though indirectly: connect a 1-bit-control register to the DMA request input, then you can control when the DMA will happen (set it to pulse mode). A status register can be used correspondingly to read the DMA request output of the filter (use sticky mode then).
These might help -
http://www.cypress.com/?rID=37793 AN52705 Getting Started with DMA
http://www.cypress.com/?rID=82680 AN84810 PSoC® 3 and PSoC 5LP Advanced DMA Topics
http://www.cypress.com/?rID=44335 AN61102 PSoC® 3 and PSoC 5LP - ADC Data Buffering Using DMA
http://video.cypress.com/video-library/search/dma/ Videos on DMA
Don't forget there is a DMA wizard that aids in setting up DMA in Creator, in the tools menu.
As a followup to the original question, we did manage to poll the digital filter without using the DMA.
The functions are there in the API,
Filter_Start(), Filter_Write16(), Filter_Read16()
Filter_INT_CTRL_REG |= 0b11 to enable interrupt flags on filters when the filter has output data. We watched the status of the filter by polling its status register using Filter_IsInterruptChannelA() and Filter_IsINterruptChannelB(), used Filter_ClearInterruptSource() to clear the status bits, then used FIlter_Read16().
Keep in mind that the filter output is signed integer and the DAC8 is unsigned uint8, so conversion from 2's complement needs to be done before writing it to the DAC8.
Silly me 😞 I was looking at the data sheet before my answer, and completely missed that (and I was even looking for something like that).