- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone help to speed up the GPIO output timing for BCM20737 ?
With the following GPIO function codes below :
// generate SCLK2 High pulse
gpio_setPinOutput(SCLK2_PIN / 16, SCLK2_PIN % 16, GPIO_PIN_OUTPUT_HIGH);
// generate SCLK2 Low pulse
gpio_setPinOutput(SCLK2_PIN / 16, SCLK2_PIN % 16, GPIO_PIN_OUTPUT_LOW);
Measure the SCLK2 high time, and it's about 2.5us. To control one external driver, the SCLK2 high time needs to be around 0.5us.
Is this possible for BCM20737 (I suppose the internal CPU clock should be fast enough) ? or any suggestion ?
Solved! Go to Solution.
- Labels:
-
GPIO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's no faster way to toggle a GPIO. No timer callback will give you anything near 500ns. A clock line is the only thing that can achieve down to the nanosecond level.
The SPI hardware will be able to clock out chunks of 8 bits, but not just 1 bit at a time.
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the below thread helpful to you?
Looking for suggestion for 100hz Pulse generating to GPIO on BCM20732S?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, but that doesn't help. What I ask is to shorten but not increase the delay. In my case, the pulse rate is about 500K~1MHz.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May I know what is the external component that you are driving? And where did you get the above piece of code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's a kind of LED driver with serial data/clock inputs. The piece of code we use (with gpio_setPinOutput and bleapputils_delayUs) is pretty similar to the thread as you said. Its was working for the old model with slower driver, but not for this new one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This code will bring out a 2MHz (T = .5us) clock line onto pin 32:
#include "aclk.h"
gpio_configurePin(32 /16, 32 % 16, GPIO_KS_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_HIGH);
aclk_configure(2000000, ACLK0, ACLK_FREQ_24_MHZ);
You can toggle it on and off to try to control your peripheral.
Alternatively, you can route this same clock line through the PWM which is specifically meant for these types of applications. Please see the pwm_tones application in the SDK for example code on using the PWM.
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My case is to send out serial data bits one time only (during each change). It's not like PWM with continuous waveform generation. I still hope to know how CPU can handle GPIO control in a fast way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
still an issue, but just take a walk around with different driver.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's no faster way to toggle a GPIO. No timer callback will give you anything near 500ns. A clock line is the only thing that can achieve down to the nanosecond level.
The SPI hardware will be able to clock out chunks of 8 bits, but not just 1 bit at a time.
Jacob