Announcements

Equip yourself to optimize PSoc4 MCUs for Evs at the EV Webinar. Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

AlRu_4725236
Level 1
Level 1
First like received First reply posted First question asked

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

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi

I tested it with my CY8CKIT-042

I could achieve about 0.13 us.

000-wave-form.JPG

The schematic

001-schematic.JPG

Interval Timer config

003-Interval-config.JPG

004-Interval-config2.JPG

Timer (pulse generator) config

005-Timer_config.JPG

006-Timer_config2.JPG

pins

002-pins.JPG

main.c

=======================

#include "project.h"

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    Timer_Start() ;

    Interval_Start() ;

    for(;;)

    {

        /* Place your application code here. */

    }

}

=======================

moto

View solution in original post

0 Likes
3 Replies
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi

I tested it with my CY8CKIT-042

I could achieve about 0.13 us.

000-wave-form.JPG

The schematic

001-schematic.JPG

Interval Timer config

003-Interval-config.JPG

004-Interval-config2.JPG

Timer (pulse generator) config

005-Timer_config.JPG

006-Timer_config2.JPG

pins

002-pins.JPG

main.c

=======================

#include "project.h"

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    Timer_Start() ;

    Interval_Start() ;

    for(;;)

    {

        /* Place your application code here. */

    }

}

=======================

moto

0 Likes

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?

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.

RGB LED strip and CY8C4146AZS

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

0 Likes