I have a DM643x DSP device with an FPGA. This FPGA is loaded on device powerup via a two wire interface, connected via two GPIO pins (called DATA0 and DCLK). You set DATA0, then set DCLK and then clear DCLK. I want to do this as fast as possible.
My hardware guys say that the FPGA can handle basically any speed the DSP can generate, but that the GPIO has a speed limit (28Mhz?).
In the code below, I have a function BusyWaitDelayNsec(5) to throttle the GPIO. However, I don't really know how to cause a small delay like this in a portable manner. Do you have a suggestion for this?
Do I need a delay? Or will the GPIO throttle itself?
for (int i = 0; i < rbfFileSize; i++) {
for (int j = 0; j < 8; j++) {
if ((pData[i] >> j) & 0x01)
SetFPGA_DATA0();
else
ClearFPGA_DATA0();
// Toggle the clock
SetFPGA_DCLK();
BusyWaitDelayNsec(5);
ClearFPGA_DCLK();
BusyWaitDelayNsec(5);
}
}