PSoC 4 Fast GPIO?

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

cross mob
Anonymous
Not applicable

Hi all,

   

I am working on a project that needs a fast GPIO bit-banging of around 4MHz.

   

Seeing 48MHz system clock on the datasheet, I thought I give CY8CKIT-049 a go.

   

After googling, I found that the fastest toggling can be achieved by using this (from an app note):

   

for(;;)
{
        CY_SYS_PINS_SET_PIN(LED__DR,LED_SHIFT);
        CY_SYS_PINS_CLEAR_PIN(LED__DR,LED_SHIFT);
}

   

I also changed the internal main oscillator (IMO) from 24MHz to 48MHz in PSoC Creator 4.

   

 

   

Using the above code and my oscilloscope, I found that the high-period lasted for 200ns which is way too slow for my application.

   

 

   

Forgive my ignorance, but, can someone advise me on how to get the fastest GPIO manipulation?

   

 

   

Thank you.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Afdhal,

The maximum frequency output you can get from depends on the VDD, the load capacitance and the gpio pin mode. Please check the image attached. Make sure that the GPIO is kept in " strong drive mode" . And I hope you are working at 5V VDD. I think adjusting these should solve your problem.

Best Regards,
VSRS

View solution in original post

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You might think setting the project build settings from "Debug"´ zo "Release". But for the world of PSoCs it is always faster to use generated signals (Timer/counter, LUTs,FFs) instead of directly bit-banging.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

   

Thank you for your reply!

   

Yup, I changed to "Release" and the low-time has reduced a bit but the high-time is still 200ns.

   

Thank you for your suggestions, I will try to use internal hardware to see how it fares. 

   

BTW, is there any tips on direct port access? I need to drive three pins for the bit-banging.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Have a look into "System Reference Guide" from Creator Help menu.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I will check it out. Thanks again. Merry Christmas!

0 Likes
lock attach
Attachments are accessible only for community members.
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Afdhal,

The maximum frequency output you can get from depends on the VDD, the load capacitance and the gpio pin mode. Please check the image attached. Make sure that the GPIO is kept in " strong drive mode" . And I hope you are working at 5V VDD. I think adjusting these should solve your problem.

Best Regards,
VSRS

0 Likes
Anonymous
Not applicable

Hi vsrs,

   

Can I know where did you get the screenshot?

   

I am running at 5V Vdd from USB and the GPIO is defaulted to fast mode. 

   

I believe the slow toggle is caused by C.

   

 

   

Kind regards,

   

Afdhal

0 Likes