- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am using a CY8CKIT-042 PSoC 4 Pioneer Kit.
I need to be able to produce microsecond (or less) long pulses at fixed intervals. I know of the CyDelayUs() function, but it's not as accurate as I need it to be, the way I'm using it at least.
Firing a digital output, calling CyDelayUs(1), then turning the output off produces a pulse of about 3.2 us as measured on an oscilloscope, and that's as low as I could seem to get it.
I also tried using a Timer Counter component in One shot mode with a period of 10 and a clock frequency of 6 MHz. With this configuration it should count up to 10 in 1.67 us, then turn off. In code I have a digital output firing if the counter is greater than 0, and turned off otherwise. Looking at the output with an oscilloscope, I am seeing a pulse duration of exactly 2.5 us, and no matter what I do I can't get it any faster than 2.5 us. Even with a clock frequency of 12 MHz and a period of 5, which should give me a pulse of about .42 us, I still see a pulse of 2.5 us. It seems the speed is being bottlenecked by something else I am not aware of.
I know the processor is capable of doing this, as I can see <1 us pulses using a PWM component with the right configuration, but I need single pulses at fixed intervals, sometimes several seconds apart.
So, what is the quickest pulse I can manually achieve, and what is the proper method of doing so?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I tested it with my CY8CKIT-042
I could achieve about 0.13 us.
The schematic
Interval Timer config
Timer (pulse generator) config
pins
main.c
=======================
#include "project.h"
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
Timer_Start() ;
Interval_Start() ;
for(;;)
{
/* Place your application code here. */
}
}
=======================
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I tested it with my CY8CKIT-042
I could achieve about 0.13 us.
The schematic
Interval Timer config
Timer (pulse generator) config
pins
main.c
=======================
#include "project.h"
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
Timer_Start() ;
Interval_Start() ;
for(;;)
{
/* Place your application code here. */
}
}
=======================
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, it works. I was relying on software to do the switching of the output, I guess it's too slow for <2.5 us?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In the discussion below, I could flip GPIO in abut 0.5 us.
But I think that it was about as fast as we could get from the firmware.
In your case, you wrote "the quickest pulse",
so I tried it with hardware.
But since you wanted to have a stable time interval,
using a hardware timer must be better than using the firmware, I hope.
moto