cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Contributor II

  We have done some tests internally.

   

  Using block transfers, we can only get about 500,000 bytes per second over the USB, using libUSB in Linux.  This works out to 250,000 samples per second for a 12 bit SAR.

   

  Using isochronous transfers with libUSB, we can get 1,100,000 bytes per second over the USB using libUSB in Linux. (You have to google a lot to get the isochronous transfer examples for LibUSB.)   This works out to about 550,000 samples per second from a 12 bit SAR.

   

   Using build in SPI, we can get about 1,200,000 samples per second (without DMA) off of the device.  We are using 18 mhz clock, which we just found out is a no-no for 16 bit transfers, according to the data sheet for high speed.

   

   We are currently seeing about 1us between data packets on the SPI.  We will be attempting DMA.  The DMA wizard refuses to recognize the SPI device (I guess because it is UDB based), and so we stole from the SPIM example project.

   

  I will update this post with the results soon.

   

  Any suggestions?

15 Replies
Esteemed Contributor

See the following dicussing SAR clock rate and application of 16 clocks/conversion -

   

 

   

    

   

          

   

SAR Clock Discussion     http://www.cypress.com/?app=forum&id=2233&rID=108973

   

 

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

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.

0 Likes
Reply
Contributor II

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

0 Likes
Reply
Honored Contributor II

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.

0 Likes
Reply
Contributor II

  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.

0 Likes
Reply
Esteemed Contributor II

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

   

 

   

Bob

0 Likes
Reply
Contributor II

  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.

0 Likes
Reply
Esteemed Contributor

The DMA can support transfers of 8.,16, and 32 bits -

   

 

   

 

   

 

0 Likes
Reply
Contributor II

  I understand what that says.

   

  However, when I configure the SPI to 12 bits, DMA silently fails!

0 Likes
Reply
Anonymous
Not applicable

 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.

0 Likes
Reply
Anonymous
Not applicable

 Sorry. The Psoc4 project is here.

0 Likes
Reply
Contributor II

   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.

0 Likes
Reply
Contributor II

  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.

0 Likes
Reply
Anonymous
Not applicable

Hi.  I did a project using DMA, but it is not working, and i don't know why, could you take a look?

0 Likes
Reply
Contributor II

 I think the TransmitBuffer and ADC_sample buffer has to be outside of the  int main() {} function, to take it off of the stack.

   

  The stack can't handle that much data, usually.

   

If you look at the ADC_DMA_VDAC01 example program, in main.c,  you probably want to re-arrange the order of your initialization code to match the order of their initialization.

   

  try with just one transfer, then you can do recycling, but use more than one buffer.

   

 

   

  The way you have it now, your data will be overwritten before your processor can get to it.

0 Likes
Reply