Digital filter without DMA or interrupts

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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?

   

 

   

Thanks,
Rory

   


 

0 Likes
9 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

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.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

 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.

   

 

   

http://www.cypress.com/?rID=60720

   

 

   

Food for thought, Dana.

0 Likes
Anonymous
Not applicable

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.
 

   

Rory

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

There are several AppNotes regarding introduction into the DMA. Start with AN52705 (http://www.cypress.com/?rID=37793 ), if you want to go deeper look at AN84810 (http://www.cypress.com/?rID=82680 ).

   

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).

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

And these -

   

 

   

    

   

          

   

https://www.youtube.com/results?search_query=dma+psoc Videos on DMA (some overlap)

   

   

 

   

Regards, Dana

0 Likes
Anonymous
Not applicable

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.

 

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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).

0 Likes