Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > Timed SPI Communication for Controlling Remote ADC Sampling Rate

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



Timed SPI Communication for Controlling Remote ADC Sampling Rate
Moderator:
RKRM

Post Reply
Follow this topic



Timed SPI Communication for Controlling Remote ADC Sampling Rate

jram posted on 01 Feb 2013 11:08 PM PST
Top Contributor
31 Forum Posts

I need some help determining the best way to interface the PSoC 3 with and SPI capable ADC. The timing of the ADC sampling must be controlled by the SPI Master (PSoC). That is, the rate at which the master request samples determines the ADC sampling rate. Once a convert command is received by the ADC the result is sent back two CS/SS pulses later.

 

What is the best way to allow the PSoC to control the ADC sampling timing via the SPI interface? Should I setup a timer to execute an ISR to request data, wait for the data, then send data to buffer? I will need the ADC to take 3000 samples at a rate between 40-60 ksps total. Thus at 60 ksps I would need to send "convert" commands every 1/60ksps = 16.6us. Will there be enough time to send the request, wait for the data, and then DMA it to a buffer?

 ---------------------------------------

Below is a sample of info from the datasheet. I’ve also attached part of the datasheet.

The RHD2000 ADC samples the selected analog signal on the falling edge of CS.  The CS line must be pulsed high between every 16-bit data transfer, even when the command word does not request an analog-to-digital conversion.  The RHD2000 samples MOSI on the rising edge of SCLK.  The master should sample MISO on the rising edge of SCLK.  (The master device SPI interface should be configured with SPI options CPOL=0 and CPHA=0.) 

 

After receiving a CONVERT(C) command from the master, the on-chip ADC samples channel “C” on the falling edge of the next CS pulse.  The analog-to-digital conversion is performed during the next 16 SCLK cycles, and the result is relayed to the master over the MISO line during the following 16 SCLK cycles (two total commands later).

 

The RHD2000 uses a pipelined communication protocol; each command sent over the MOSI line generates a 16-bit result that is transmitted over the MISO line two commands later.  Communication with the chip is illustrated in the following example diagram:

 

 


Re: Timed SPI Communication for Controlling Remote ADC Sampling Rate

alex108 posted on 01 Feb 2013 03:31 AM PST
Cypress Employee
1 Forum Post

 At PSoC (master) side, get the data using DMA. Connect DMA to interrupt output pin and in device configuration window select "Interrupt when Rx FIFO not empty".

To generate CS/SS, use ISR which should be triggerd by TRQ output pin of DMA.

In SPI command window, set the bit rate as your application demands..

 

 






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: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20