Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > Why does SPI stall between bytes?

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Why does SPI stall between bytes?
Moderator:
RKRM

Post Reply
Follow this topic



Why does SPI stall between bytes?

lkoziarz posted on 10 Mar 2011 2:08 PM PST
Member
7 Forum Posts

Thanks to Uday I've got some SPI transmission working, but I'm seeing a very strange problem with the transmission speed on SPI.

My device is a CY8C3866-ES3.  I'm using a SPIM Mode 0 @ 2.5 MBit, tx/rx buffer set to 96 bytes.  I fill TX with 80 bytes using SPIM_PutArray and then watch the transmission using my scope.

What I see is 8 bits getting clocked out in about 3.2 microseconds, then a 17 uSec gap before the next byte starts to transmit. 

I have two interrupts enabled besides the default: IRQ on Tx FIFO empty and IRQ on Rx FIFO full.

What could be stalling the SPI hardware to take this long before sending another byte?  This effectively is limiting my SPI transmission to under 1Mbit when I should be going 2-3 times faster.

Thanks,

Louis




Re: Why does SPI stall between bytes?

anmd posted on 14 Mar 2011 11:40 PM PST
Cypress Employee
15 Forum Posts

When the SPIbuffer size is set to >4 bytes  , the internal interrupts are used to manage the software buffer. The delay that you are seeing is most probably the interrupt latency and delay in moving bytes from software buffer to hardware FIFO . Setting buffer size to 4 and moving data to and from FIFO using DMA(triggered by FIFO not full / Rx FIFO not empty ) might help to reduce the delay.

 

Regards,

Anu



Re: Why does SPI stall between bytes?

lkoziarz posted on 15 Mar 2011 06:05 AM PST
Member
7 Forum Posts

 Thanks, Anu.  I'll give that a try.

Louis



Re: Why does SPI stall between bytes?

lkoziarz posted on 15 Mar 2011 08:50 AM PST
Member
7 Forum Posts

 Anu: When will the Psoc3 SPI DMA example (http://www.cypress.com/?rID=38792) be available again?



Re: Why does SPI stall between bytes?

U2 posted on 25 Mar 2011 05:25 AM PST
Cypress Employee
589 Forum Posts

Hi,

The DMA Example project that you wanted is available on the webpage.

-Udayan



Re: Why does SPI stall between bytes?

jackyho posted on 01 Apr 2011 03:32 AM PST
Member
2 Forum Posts

My Case face similar issue,   PSoC3(CY8C3866-ES3)’s SPI Master component is used to interface with an external SPI Flash memory device. PSoC3 reduce the rx and tx buffers to 4 bytes and disable the SPI interrupts, it can obtain a minimum delay of around 6 us between bytes.  However, reading the status register and reloading the buffer in between 4-byte bursts takes about 20 us.  Is there any other way to more directly write to the SPI component to reduce the delay?

 

 

 

 



Re: Why does SPI stall between bytes?

U2 posted on 08 Apr 2011 10:47 PM PST
Cypress Employee
589 Forum Posts

Can you give us some more information about your SPI configuration.

  1. Clock speed of SPI Master,
  2. Master Clock of PSoC and
  3. Buffer size

-U2



Re: Why does SPI stall between bytes?

jackyho posted on 08 Apr 2011 01:15 AM PST
Member
2 Forum Posts

HI,

Thinks for your reply. The delay is already fixed by using DMA to move date in/out from buffer. But there are other issue,  the data send to the I2S component from SPI memory by the DMA . There are used 4 DMA to transfer the data for 2 audio channel. The sound can be released but there have a noise randomly appeared. Threre may be a some problem on DMA or I2S. Would you have any material for me to know how the DMA working like the detial of TDs in DMA and how to read the coding of DMA and TD?



Re: Why does SPI stall between bytes?

lkoziarz posted on 09 Apr 2011 06:23 AM PST
Member
7 Forum Posts

 I'd like some more detail about DMA TDs as well.  I'm looking at the SPI/DMA example code and application notes, and don't quite understand how to add code to perform some work when the DMA transfer is completed.

The SPI/DMA example uses a second chained TD to shut off the interrupt and finish the transfer, but in my project we have SPI Slave Select muxxed to various peripheral devices.  I need to be able to toggle the SS lines under software control, or have an interrupt handler do it.

Most of Cypress' PSoC SPI examples are done by having a SPIM and SPIS on the same chip, which is nice for learning, but doesn't give a lot of real-world example when interfacing the PSoC to other external devices over a hardware bus.



Re: Why does SPI stall between bytes?

U2 posted on 13 Apr 2011 01:27 AM PST
Cypress Employee
589 Forum Posts

The AN52705 - Using DMA on PSoC® 3 and PSoC 5 ,this application note describes the basic and important steps in configuring the DMA. The application note is associated with four projects that describe how to configure DMA to transfer data in four different scenarios. The important DMA APIs and DMA configurations are illustrated through the following example projects.

 







ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20