- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have a look into "System Reference Guide" from Creator Help menu.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will check it out. Thanks again. Merry Christmas!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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