Forum Discussion
mfro
Occasional Contributor
7 years agoif you have some GPIOs left, it's only a few lines of C to program the FPGA with a .rbf from there with any µC:
GPIO &= ~FPGA_CLOCK; /* FPGA clock => low */
/* pulling FPGA_CONFIG to low resets the FPGA */
GPIO &= ~FPGA_CONFIG; /* FPGA config => low */
wait(10); /* give it some time to do its reset stuff */
while ((GPIO & FPGA_STATUS) && (GPIO & FPGA_CONF_DONE));
GPIO |= FPGA_CONFIG; /* pull FPGA_CONFIG high to start config cycle */
while (!(GPIO & FPGA_STATUS))
; /* wait until status becomes high */
fpga_data = (uint8_t *) FPGA_FLASH_DATA;
do
{
uint8_t value = *fpga_data++;
for (i = 0; i < 8; i++, value >>= 1)
{
if (value & 1)
{
/* bit set -> toggle DATA0 to high */
GPIO |= FPGA_DATA0;
}
else
{
/* bit is cleared -> toggle DATA0 to low */
GPIO &= ~FPGA_DATA0;
}
/* toggle DCLK -> FPGA reads the bit */
GPIO |= FPGA_CLOCK;
GPIO &= ~FPGA_CLOCK;
}
} while ((!(GPIO & FPGA_CONF_DONE)) && (fpga_data < fpga_flash_data_end));