1 2 Previous Next 18 Replies Latest reply on Jan 27, 2015 8:23 AM by jevi_285856

    Getting 16-bit data through a Filter


      Using the PSoC5LP development board CY8CKIT-050, I have found examples of getting 8-bit data out of a filter and into a VDAC. I want to get the digital data out of the Filter into SRAM arrays. In this build, I have verified that I can get data out of the Sequencing SAR but I cannot get data out of the following filter.


      I initialize two elements of the destination arrays just to see if they get overwritten by new data.  I am using the 10K pot at P6[5] for one data source and from the junction of two 2700 ohm resistors at P3[3] for the other data source.  I use the LCD to write three elements of each array to see what the output looks like.


      What destination address should I use for the DMAs?  LO16((uint32)Filter_STAGEAM_PTR)
      or LO16((uint32)Filter_STAGEAH_PTR)
      or LO16((uint32)Filter_STAGEA_PTR)


      Should I be using Filter_DALIGN_REG |= 0x0F; to align the data?


      Note that I am not starting the isr_dma here. This was used to successfully read data from the SAR. I start the isr_filt interrupt to get data unsuccessfully from the filter.


      Can anyone suggest what I am doing wrong or point to an example project that does not involve a VDAC?

        • 1. Re: Getting 16-bit data through a Filter

           Pardon me, but I meant to post this zip file. Please ignore the previous zip and look at this one.

          • 2. Re: Getting 16-bit data through a Filter

            Your source is sar_finalArray[] which is not a peripheral, but an array in memory. So using CYDEV_PERIPH_BASE is wrong.


            Use as destination CYDEV_PERIPH_BASE and Filter_STAGEA_PTR.


            Is TD_INC_SRC_ADR really correct?




            I would suggest you to first work with one channel only and later add the second to see if the two channels influence each other.





            • 3. Re: Getting 16-bit data through a Filter

               Bob, that was a good catch noticing that sar_finalArray[] is in SRAM, not the device. And you're right that I should not have incremented the source. I am in the process of breaking the project down into separately debugged components. I'll post results as I progress. Thank you.

              • 4. Re: Getting 16-bit data through a Filter

                 I have simlified the project to one step. I am just trying to get 8-bit data through the filter.
                The simplified path is:


                Generate an array with sawtooth data in SRAM.
                Feed this SRAM array through DMA to the Filter, then to SRAM array
                Then I try to display sample elements of the filter output array on the LCD. Nothing is displayed.  Using polling and checking for interrupt in the while loop.  Debug shows that I never get inside the if statement


                        if (Filter_IsInterruptChannelA())




                            Filter_A[n] = Filter_Read8( Filter_CHANNEL_A);





                    Any ideas?   
                • 5. Re: Getting 16-bit data through a Filter

                  I am afraid that I cannot judge your issue without a look at all of your settings. Please upload a workspace bundle here to have a look at.





                  • 6. Re: Getting 16-bit data through a Filter

                     I am so sorry. I forgot the attachment (duh).

                    • 7. Re: Getting 16-bit data through a Filter

                       oops again. Here is the zip file workspace bundle.  The clock is set to 1200 Hz.  I'm not sure what frequencies that would produce from the sawtooth wave from my DMA_A initialization. But I would expect some output that would generate an interrupt for the query 
                      if (Filter_IsInterruptChannelA()) ...


                      Thank you for looking at my query.  -Jerry

                      • 8. Re: Getting 16-bit data through a Filter

                         I still have not solved this problem of how to get 16-bit data (12-bit resolution) through a FIR Filter.  I have tried to do so with DMA, Interrupt, and Polled.


                        I have tried to do it with Filter_DALIGN_REG |= 0x0F; and with Filter_SetCoherency. I have tried to direct the &sar_finalArray[0] to Filter_STAGEAH_PTR, and Filter_STAGEAM_PTR, andFilter_STAGEA_PTR. No combination works.


                        I have read every document I can find on Cypress. Yes, I can find 8-bit examples; but no 16-bit examples.


                        Can anyone provide a working example project in the form of a Workspace Bundle for getting 12 or 16 bit data through a FIR Filter (only need 32KHz low pass)?  Two channels would be great but I would settle for a one-channel working example.


                        Note: I do not want to output to a DAC. I need the output in an SRAM array.

                        • 9. Re: Getting 16-bit data through a Filter

                          Looking in your source code, I point some strange code :


                          - DMA setting TD_AUTO_EXEC_NEXT is not correct


                          - not sure relying on Filter_IsInterruptChannelA() for polling while DFB interrupts are not activated is the good way


                          - Your DFB input is a buffer (uint8 DMA_A[LENGTH+4]) with 1 byte elements and you specify burst size 2







                          • 10. Re: Getting 16-bit data through a Filter

                            TD_AUTOEXEC_NEXT is correct imho. At time of DMA-start all data are present in memory, there is only one DMA_start signal for the complete transfer. and the transfer is done in smaller chunks.





                            1 of 1 people found this helpful
                            • 11. Re: Getting 16-bit data through a Filter

                              I misunderstand the documentation (Getting started with DMA).


                              Auto Execute Next TD
                              0: The next TD in the chain is executed only after the next DMA request.
                              1: The next TD in the chain is automatically executed after the current TD transfer is finished.


                              I guess the 1200Hz clock is used to process DMA request at the desired rate to feed the Filter at a fixed sampling rate.







                              1 of 1 people found this helpful
                              • 12. Re: Getting 16-bit data through a Filter

                                Here is an example project filtering 16 bits values coming from an SRAM array using the "Filter DFB component". A DMA & a clock are used to feed flowlessly the Filter without involving the CPU. Keep us informed if it match your needs.







                                • 13. Re: Getting 16-bit data through a Filter

                                   @PNN, Thank you so much for your contribution. I had to upgrade to PSoC Creator 3.1 to read your file -- and that's a good thing.


                                  Nevertheless, your contribution was for a 20-bit (24-bit) sample.  Thus, the DALIGN and Coherency parameters are different from a 12 or 16 bit data filter. This is good for anyone searching for such a solution in this Developer Community. Thank you.


                                  I opened a log with technical support but the example of 16-bit (or 12-bit) sample takes the LCD printout at the SAR's ISR They comment out the desired result at the Filter.  I have been "playing" with this for days and I cannot get digital results to populate an array out of the filter.  Nada, zilsch, bubkes.


                                  Forget the previous zip file.  A better simulation is to use the CYC8KIT-050 Developer Kit  with its onboard potentiometer at P6[5] to simulate "analog" input.  I installed, on the breadboard, a second potentiometer between Vdda and Vdds with the wiper arm at P6[0].


                                  Please take a look at this workspace as well as the tech support's suggestion. My file and tech support's file are attached.  I just want digital results out of the Filter to go into an array.  I will process the data later.


                                  I cannot get data into the arrays.  I don't care about the VDAC output. This is a Filter problem more than anything.  I can get any data I want out of the SAR.  I cannot get digital data (array) out of the Filter.


                                  Please help.

                                  • 14. Re: Getting 16-bit data through a Filter

                                     Oops, her is the official reply sample from Technical Support.  So many DMA configs are commented out.  My problem is still not solved. We don't want to sample the SAR. We want digital results (in the form of an array) from the Filter.



                                    1 2 Previous Next