Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Time-stamping external TTL events with 1us precision

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



Time-stamping external TTL events with 1us precision
Moderator:
ANCY

Post Reply
Follow this topic



Time-stamping external TTL events with 1us precision

darioringach posted on 19 Jan 2013 2:37 PM PST
Member
8 Forum Posts

 

I have 2 external TTL signals I need to time-stamp with 1us precision.  They can switch at a rate  of ~16khz.

What is the best way to go about doing this?  

Can the signals be used directly as interrupts to the Cortex and is there a system clock that can be retrieved?  

Or do I need to run a basic counter at 1Mhz and read out from the status register(s) upon rising edge?  

Or something else?

Thank you!

--
Dario
 

 

 




Re: Time-stamping external TTL events with 1us precision

danaaknight posted on 19 Jan 2013 03:06 PM PST
Top Contributor
1773 Forum Posts

When I think of time stamp I think you want to record time of day, hrs:min:sec for

an event occuring every 1/16Khz secs, to a resolution of 1 uS. Or do you just want

to measure period of event ?

 

For later I would use rising edge of event to enable a counter being clocked at 1 Mhz,

and falling edge to implement a captureof count, which gens an interrupt to read

and reset counter. That way ISR rate is 16 Khz, a resonable rate that won't eat up

a lot of MIPs.

 

Regards, Dana.

 



Re: Time-stamping external TTL events with 1us precision

darioringach posted on 19 Jan 2013 05:39 PM PST
Member
8 Forum Posts

 

Thanks for the reply...  yes, I mean the former.  

The events are not really periodic... they are random.  But they occur at an average rate of 16Hz. 

--

Dario

 



Re: Time-stamping external TTL events with 1us precision

Bob Marlowe posted on 21 Jan 2013 12:52 AM PST
Top Contributor
1768 Forum Posts

Taking a 32-bit counter at 1 MHz (which will run for about an hour before overflowing) you may use the capture-properties to get your needed time-stamps. Timing is not as critical because the captured values are storedi in a FIFO and may be read-off in a polling-loop. Since the FIFO is only 4 entries deep it should be considered how many events have to be recorded within which time. 16kHz will give you about 1000 CPU-Cycles to process each event, so if you're not really wasting MIPS it can be done without touching the borders of PSoC design.

 

Bob



Re: Time-stamping external TTL events with 1us precision

Bob Marlowe posted on 21 Jan 2013 12:59 AM PST
Top Contributor
1768 Forum Posts

...And if that one-hour-counterr is not sufficent, you may use the period-Interrupt to increment a 32-bit-variable to get a 64-bit time-stamp which will last for ... ahhh... mhhhh... well..... 490,000 years ?

 

Bob



Re: Time-stamping external TTL events with 1us precision

danaaknight posted on 21 Jan 2013 04:04 AM PST
Top Contributor
1773 Forum Posts

Authors last post its a 16 Hz rate, not Khz ?

 

Regards, Dana.



Re: Time-stamping external TTL events with 1us precision

Bob Marlowe posted on 21 Jan 2013 06:24 AM PST
Top Contributor
1768 Forum Posts

Yes, I saw that, but since it was not correctes explicitly I took the second post as a typo and not the first.

 

Bob



Re: Time-stamping external TTL events with 1us precision

darioringach posted on 28 Jan 2013 09:03 PM PST
Member
8 Forum Posts

 Thanks... this works.  Yes, 16khz rate... and it works fine...

 



Re: Time-stamping external TTL events with 1us precision

Bob Marlowe posted on 29 Jan 2013 12:31 AM PST
Top Contributor
1768 Forum Posts

Congratulations! We like to meet you here in the fascinating world of PSoCs!

 

Bob






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