- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Regards,
PNN
- 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
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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++;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- 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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Regards,
PNN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Regards,
PNN
- 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
@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.
- 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
Here is an example project to get 16 bits data from a SAR component (ADC_SAR_Seq) without involving the CPU. This example has been stripped to the minimal configuration for better understanding. If one needs to catch multiple channels, he could increase the numer of analog inputs to the ADC_SAR_Seq, cut&past the same C code and schematic. I check only the behavior with the internal potentiometer (CY8CKIT-050), so impossible to check the filter lowpass "accuracy".
IMO, the only way to check the filter accuracy is using a VDAC and a scope to check the output and a signal generator in input with a sine wave at the cut-off frequency and check for -3db.
If one wants to fill a bigger buffer than 4095 bytes, he has to initialize and chain multiple TDs (each one is limited to 4095 bytes).
Regards,
PNN
- 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
@PNN, Wow! Your solution exceeds my expectations. It is terrific. From a 12-bit SAR, I find it amazing that I get output approaching 65,535 (216) when 212 would be 4096. I am still trying to figure out your secret sauce.
There is a line in the dma_restart function that is interesting:
CyDmaTdFree(dma_out_A_TD[0]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The purpose of the dma_restart is to reset the address counter of the TD to avoid a memory corruption on the fixed size buffer. One solution is to destroy the TD and create a new one with the same parameters for reuse during the next transfer. Another way to do is perhaps (not tested) to use the parameter "preserveTDs = false" for the DMA channel.
Regards,
PNN