Programming an FPGA from the AVR?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all:

I'm looking specifically for the source code that goes with "doc3301.pdf" from the atmel web site; does anyone have this? It seems to have disappeared from the Atmel site.

Cheers,
mvdw

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The datasheet for your chosen FPGA will give you the programming sequence, and there shall be plently of application note that describe programming FPGAs from MCUs.

Basically you will need to toggle the PROG and INIT lines to clear the FPGA SRAM, then shift in all configuration bits, and monitor the DONE bit. It's just copying a large block of binary data from one place to another.

What FPGA are you using?

Tim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using a cyclone III.

The copying is relatively straightforward, but I had hoped to be able to directly use the AT45 series dataflash to program the FPGA - ie, bypass the ATMega, just using it as basically an SPI master for slave to slave copying. However, I fear that the clock sequencing will defeat that pipedream (clock out of memory does not directly clock in to FPGA, as the clocks are inverted), and I'll have to bit-bang at least one of the interfaces (probably AVR->FPGA).

The main problem I foresee is the time taken to move 4MBit around, which will stretch out the startup time of my system, although I think my original back-of-the envelope calc's were out by a factor of 8 due to bit/byte confusion. I believe I can do it in around 4 seconds, which is well within acceptable ranges.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used Cyclone I's.

The FPGA is the master, not the memory device when using the Active Serial mode. But it won't work with AT45 series memories anyway. But you don't need to use the ridiculously expensive EPCSxxx devices either :) A couple of devices of ST work equally well and are very cheap.

The Active Serial mode clocks around 20MHz IIRC, so you can't beat it with an AVR.

Have you looked into compressed bitstreams? Cyclone's support this and might reduce the amount of data that needs to be transferred. It's a simple radiobutton somewhere in Quartus ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

has anybody tried to program spartanII devices.
i mean xc2s200?
i have used fatfs and sd cards in my projects.
so can i use it to program the spartan using my sd and avr?
is it simple and fast!(mean how long does it take to program it using 16MHz avr clock and full spi speed)

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With an AVR at 16MHz you can at most transfer half a bit per clock cycle, so it's limited to 8 megabits per second, or 1 megabyte per second; if you can feed the SPI unit with data this fast. If you have to share the SPI unit with the SD card, then how fast you can fill up the FPGA config memory at least halves. Not counting in all the software overhead which will take up time too.

I don't know how big the bitstream for xc2s200 is; if you know it, you can make a rough guestimate.

I guess the maximum average rate you'll be able to achieve is around 50 kilobytes per second. Just a rough BPF ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok then what is the algorithm for filling the fpga?

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know. The datasheet of the FPGA of your choice should contain information on that.