12 FPGA configuration through RS-232
12.1 Pluto/-II/-IIx FPGA configuration
Unlike Pluto-II/-IIx and Pluto-3, Pluto doesn’t have an FPGA boot-PROM, so Pluto needs to be configured after each
power-up. This is usually done through the serial port of a PC, but it can also be accomplished using a microcontroller
(using only one output pin).
There are 2 techniques, depending on the presence or absence of a UART in your microcontroller.
With a UART
Set the microcontroller UART at 115200 bauds, and run the following C pseudo-code:
For each byte of the RBF file, do:
for(j=0; j<8; j++) serial.write(((rbfbyte >> j) & 1) ? 0xFF : 0xFE);
A more complete example could be:
int i, j;
FILE *fpIn = fopen("LEDblink.rbf", "rb" );
char buf[0x10000];
int len = fread(buf, 1, sizeof(buf), fpIn);
fclose(fpIn);
OpenCom();
SetCommBreak(hCom); Sleep(50); // un-configure FPGA
ClearCommBreak(hCom);
for(i=0; i<len; i++)
for(j=0; j<8; j++)
WriteComChar(((buf[i] >> j) & 1) ? 0xFF : 0xFE); // 8.6µs or 17.3µs pulses
CloseCom();
This code also work from a PC, see the chapter 16 for some COM source code.
Without a UART
If your microcontroller doesn’t have a UART, you can just send pulses on one IO pin. Sending 0xFF above is equivalent to
sending a pulse of 8.6µs, while sending 0xFE sends a pulse twice that long. Pulses are positive (inactive level is “0”) and
they need to be separated by 30µs or so between them. To un-configure Pluto (before sending the RBF), send a “break”
condition (a high signal) for about 50ms.
The RBF file is a binary file which is usually compressible, in case you run out of memory in the microcontroller.
12.2 Pluto-3 FPGA configuration
Pluto-3's configuration scheme is even simpler. To configure the FPGA, just send the RBF binary content through RS-232
at 115200 bauds in 8-bits mode. To un-configure the FPGA (before sending the RBF), send a “break” condition (a high
signal) for about 50ms.
On Linux, this script could be used.
#!/bin/bash
#
# pluto3configure :: send an rbf file to a Pluto-3 FPGA board
#
SERIAL=/dev/ttyUSB0
if [ ! -f "$1" ]
then
echo "Usage: $(basename $0) filename.rbf" >&2
exit 1
fi
(stty 115200 raw cs8 -cstopb -parenb -ixon -crtscts 0<&1 ; sendbreak; dd "if=$1" bs=1k) > $SERIAL
FPGA RS-232 development boards Page 17