For 1Msps you definetely need to use DMA. Running the ADC with 18MHz doesn't imply that the rest of the PSoC cannot run faster (54MHz are fine). And the DMA can run at full speed.
For SPI it depends on the features you use, look at its component data sheet.
I wasn't clear. DMA from the SAR to memory is no problem.
The issue is that we need 12 bits resolution. That means 2 bytes. The SAR DMA works fine. 2 megabytes per second DMA into SRAM works fine. No problems there. Staying on the device is easy.
The issue becomes getting the data off of the PSOC onto a remote computer at 1 megasample per second. (2 megabytes per second.)
We were able to get decent speeds from Full Speed USB, 1.1 megabytes per second (550,000 samples per second) which is 55% of the speed we need. We need 2 megabytes per second off of the PSoC to get the data rate needed.
We were able to get the SPI to transfer data at about 1.2 megabytes per second using DMA. That is running slightly faster than specs, but it looks like we might get away with it. (Extremely low production volume, we can hand select devices). We are not sure if the SPI to USB device from FTDI will handle this, as the SPI block from Cypress never asserts SS between bytes if using DMA in a stream. This could be an issue, it might not be.
It looks like we can use 2 spi units and transfer data at a combined rate close to 2 megabytes per second, to SPI to USB High Speed devices, and that should work. We will have to recombine packets in the computer we transfer to, but at that point it is a dual or quad core 2ghz machine, so should not be a problem.
Too bad High Speed USB is not available on PSoC devices. (I'm aware high speed USB is one of Cypress' offerings, just not in the PSoC family).
The SPI master in PSoC5 can run with a SCLK of up to 18MHz, meaning you can transfer 18/8=2.25 mega byte per second, without running out of spec.
Slave Select will only be de-asserted by the SPI master when its FIFO runs empty.
That is close. On page 32 of the data sheet, it says if you are in 16 bit mode, maximum clock rate is 16mhz.
The problem with the SPI is that in 12 bit mode, you write to a 16 bit register to send the data out. (I traced the API code to prove this)
The DMA engine cannot write to 16 bit registers. It can only write to 8 bit registers.
"The DMA engine cannot write to 16 bit registers." This is probably not quite right. DMA can read and write 16 bit registers if setup correctly.
OK. I'll bite.
Set up the SPI in 12 bit mode, which uses a 16 bit register, and have the DMA transfer 16 bit words into it and have the SPI transmit out that 12 bits of data.
I'm sure I'm missing something. This would help a lot.
The DMA can support transfers of 8.,16, and 32 bits -
I understand what that says.
However, when I configure the SPI to 12 bits, DMA silently fails!
Hello all. I need a little help.
I need to get at least 10000 samples, using a 1Msps ADC (8 or 10 bits), then I have to compare these samples with a threshold, if any samples were out of this threshold I have to send the samples to a computer using Uart or USB.
I did a project like this using Psoc 4, but it has only 4K of sram and I could sample only 1200 samples. The project is attached.
I bought recently the CY8CKIT-059 PSoC® 5LP Prototyping Kit to try to solve this problem because it has more Sram, but the project didn't work well.
Any one could help me unfortunately I dont know how to work with DMA yet.
Go to your PSoC creator, File menu->Example Projects.
Look under Device Family -> PSoC 5LP
The second Example project is ADC_DMA_VDAC.
It shows you how to set up the DeltaSigma ADC for DMA.
There is a setup for the DMA in that example. Follow it closely, since you cannot set up the DMA from ADC through the DMA wizard. It is missing that option.
In addition, the example ADC_SAR_PrISM project also has a SAR ADC DMA in it.
Also look at the other DMA projects, and use the wizard to setup a transfer from a register into a buffer. That should give you the framework to make changes and get your DMA into memory done.
One more thing.
Since you have to get 10,000 samples into memory, the maximum number of samples you can transfer is 4095 (not 4096!), so you will have to chain the DMA from one buffer to another.
It can be done. Start with transfering 300 bytes, but only at say, 1,000 samples per second. Once that works, go for faster, better. One step at a time.