Author Topic: Cyclone V configuration using SPI  (Read 7852 times)

0 Members and 1 Guest are viewing this topic.

Offline gideonz74Topic starter

  • Newbie
  • Posts: 5
  • Country: nl
Cyclone V configuration using SPI
« on: September 10, 2017, 02:55:10 pm »
Does anyone have experience using a standard SPI Flash to configure a Cyclone V FPGA in active serial mode?  If so, which brand / types work?

I have used Winbond and ST flashes in the past for Cyclone IV and Spartan III without any issues. However, on a new board, using a 5CEBA4, I do not get configuration to work, using a Winbond Flash.  I tried W25Q32 as well as W25Q128.

Programming the Flash is not an issue; I can simply configure the FPGA using JTAG. I configure it with a design that has a NiosII core, then download a Flash programmer program through Eclipse. I have not been able to use the .jic method, as there is another "unknown" device in the JTAG chain, which does not seem to be supported. What I do for Cyclone IV is simply take the .rbf file, swap all the bits (7..0 -> 0..7), and program the resulting file at flash offset 0. Works like a charm. Therefore, I do not need any special quirks to trick Quartus into programming my Flash.

However, on Cyclone V, after programming the Flash, it seems that the FPGA does not configure itself.  :rant: It does load the header section using opcode 0x13 (wrong!), which is a 32-bit read command, then issues a 24-bit address.. this goes OK for address zero to read the header, but it fails when it continues reading from offset 0x012C. It sends the address 0x012C00. I tried to insert a blank area between the header and the actual FPGA content by (0x12c00 - 0x12c) bytes, but to no avail... The configuration stops after a bit more than one byte and resets to reading the status register, then the ID code, and then it tries again, using opcode 0x13. Probably, because the SPI flash, which waits for 4 bytes of address only gets 3, so it outputs the first byte one byte late.  This sequence was captured using another FPGA with SignalTap...


What options do I have?
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Cyclone V configuration using SPI
« Reply #1 on: September 10, 2017, 04:20:51 pm »
What options do I have?

The 'official' configuration devices are so laughably expensive that you can probably get a microcontroller with enough built-in flash for less. Use the MCU as an SPI master, strap the FPGA into passive serial mode, and have the MCU configure the FPGA at power-up.

Of course, if you already have an MCU, then you may already have all you need. You may just need to swap to a bigger one with some spare flash capacity.

Offline gideonz74Topic starter

  • Newbie
  • Posts: 5
  • Country: nl
Re: Cyclone V configuration using SPI
« Reply #2 on: September 10, 2017, 06:38:38 pm »
1) https://www.micron.com/~/media/documents/products/other-documents/altera_compatibility_chart_flash_dram.pdf

2) https://www.alteraforum.com/forum/showthread.php?t=41079

3) https://rocketboards.org/foswiki/Documentation/SocBoardQspiBoot

4) https://www.altera.com/support/support-resources/supported-flash-devices-for-cyclone-v-and-arria-v-soc.html

5) https://www.eevblog.com/forum/microcontrollers/altera-configuration-flash-crazy-prices-alternatives/
1) Found this one earlier... Seemed to give hope.. but it speaks of PASSIVE configuration using an MCU..
2) This is actually a great link! Thank you...
3) I am not using SoC
4) I am not using SoC
5) Found this one.. it does not seem to give exclusion on the Cyclone-V issue..

As I couldn't get hold of Numonyx Flashes in a usable package, I have ordered some S25FLxxxL flashes, instead of the 'S' variant. The datasheet says that the mentioned opcodes are supported. This gives hope.  The board is hard-strapped to active serial, so I cannot change that for now.
 

Offline gideonz74Topic starter

  • Newbie
  • Posts: 5
  • Country: nl
Re: Cyclone V configuration using SPI
« Reply #3 on: September 10, 2017, 06:53:01 pm »
The 'official' configuration devices are so laughably expensive that you can probably get a microcontroller with enough built-in flash for less. Use the MCU as an SPI master, strap the FPGA into passive serial mode, and have the MCU configure the FPGA at power-up.

Thank you!  It should be less indeed. I budgeted $0.50 for the Flash storage for my product.. I do not want to go beyond $1... Seems like I have to.

For now, the FPGA is hard strapped to active serial mode, and I cannot access these balls of the BGA.. so I'll need some different flashes to get the protos to work. From the other post, it seems that the N25Q or N25P flashes should work. Couldn't find them on short notice.. Going to try Cypress S25FLxxx"L" first.

I don't have an MCU just yet, but this might actually justify placing one. Storage does not need to be in the MCU tho; I could simply use the very cheapest MCU + cheapest external Flash. MCU generates the first READ opcode to the Flash and keeps supplying clock. Flash then lets the data stream out directly into the FPGA in passive serial mode. This should work. Just have to think about how to program it.. Maybe, with a bit of luck, I could attempt to keep the serial flash connected to the ASMI pins of the FPGA, and access it using the asmi atom after configuration..
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 3719
  • Country: us
Re: Cyclone V configuration using SPI
« Reply #4 on: September 11, 2017, 05:07:58 am »
I have spent way too much time dealing with altera flash configuration devices and alternatives.  There are at least two gotchas:

256 Mbit and larger chips require the 4BYTEADDREN and 4BYTEADDREX commands as the mechanism to allow addressing beyond the 128 MBit that can be reached with the standard 3 byte commands.  The cypress chips don't have separate commands for this, but they have flag register bits that are used to enable 4 byte addressing, and also separate 4byte read and write commands

Second, many manufacturers including Micron use stacked dies to reach the larger sizes, typically above 512 MBit/s.  Cyclone V and Arria V FPGAs do not support stacked dies for the configuration device.

Can you get by with a 128 Mbit chip?  AFAIU, if you can do that most of the compatibility problems go away.
 

Offline gideonz74Topic starter

  • Newbie
  • Posts: 5
  • Country: nl
Re: Cyclone V configuration using SPI
« Reply #5 on: September 11, 2017, 05:32:29 am »
Thank you Jeffery for this useful answer!

I have spent way too much time dealing with altera flash configuration devices and alternatives.
I second that.. I also spent way too much time on this simple thing.
Quote
There are at least two gotchas:

256 Mbit and larger chips require the 4BYTEADDREN and 4BYTEADDREX commands as the mechanism to allow addressing beyond the 128 MBit that can be reached with the standard 3 byte commands.  The cypress chips don't have separate commands for this, but they have flag register bits that are used to enable 4 byte addressing, and also separate 4byte read and write commands.
So I read somewhere indeed. The "S" versions do not have these commands, but the "L" versions do. Even the smaller versions seems to have it, according to this:
64 Mbit: http://www.farnell.com/datasheets/2309630.pdf?_ga=2.172098660.612976383.1505037860-398769884.1451243689
128 Mbit: http://www.farnell.com/datasheets/2309631.pdf?_ga=2.217778129.612976383.1505037860-398769884.1451243689
256 Mbit: https://media.digikey.com/pdf/Data%20Sheets/Cypress%20PDFs/S25FL256L_Rev_A.pdf

The funny thing is, when SignalTapping the configuration sequence, I have not seen commands 'E9' or 'B7' commands pass by. Maybe these commands are only used in the SFL? (Which I don't / cannot use..)

Quote
Second, many manufacturers including Micron use stacked dies to reach the larger sizes, typically above 512 MBit.  Cyclone V and Arria V FPGAs do not support stacked dies for the configuration device.

Can you get by with a 128 Mbit chip?  AFAIU, if you can do that most of the compatibility problems go away.
I could get by with a 64 Mbit chip; 32 Mbit if I really had to.  That's why I am so surprised that the Winbond W25Q32 / W25Q128 that I tried don't work. It probably has everything to do with the Silicon ID that the FPGA reads right at the start. I did see that the CycloneV used command 0x13 for read, which my Flash does not support officially. It does seem to respond to it correctly, tho.

Once I have results from the Cypress S25FLxxx"L" chips, I'll let you guys now.
 

Offline Boscoe

  • Frequent Contributor
  • **
  • Posts: 276
Re: Cyclone V configuration using SPI
« Reply #6 on: September 12, 2017, 01:02:17 pm »
I used the M25P16-VMN6P device from Micron with Cyclone 4 successfully. They aren't made any more but maybe helpful in finding what you need.
 

Offline gideonz74Topic starter

  • Newbie
  • Posts: 5
  • Country: nl
Re: Cyclone V configuration using SPI
« Reply #7 on: September 13, 2017, 10:16:19 am »
Hi Guys!

Thank you so much for your time in reviewing my frustrating post.
Finally I managed to get things to work, EVEN with the Winbond Flash.

The trick is:
1) UNCHECK the checkbox "Use Configuration Device" in the Device&Pin options dialog   <-- this is probably what I had not tried before
2) Rerun fitter + assembler stage
3) Go to 'Convert Programming files' and create '.pof' file.
4) Go to Advanced, Tick the checkbox 'Disable EPCS/EPCQ Device ID check'
5) Generate the POF file.
6) Strip the header (non-0xFF gibberish at the beginning) and bit-swap all bytes of the file; truncate after the FPGA data
7) Program the resulting file "as-is" in the Flash chip.

I'll still have to figure out what the differences in the resulting binaries really are... Going through the .pof step is a bit of a hassle.  But this is what works for me.
Tested with Winbond W25Q32FV ($0.30) as well as Cypress S25FL064L..

Best regards,
Gideon
« Last Edit: September 13, 2017, 10:18:08 am by gideonz74 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf