xc3sprog writing to flash: verification error


Recommended Posts

I'm trying to write my (Xilinx ISE generated) .bif file to the papilio flash, and xc3sprog gives this Verifying Failure (see below).

It seems somehow 6c33 is inserted in the bitstream. After page 245 many more pages fail.


Re-trying the same command will fail with the same errors at the same page.


I can flash other .bit files, it really seems to be this bit file that is a problem (this .bit file is from a sligtly larger project, maybe it's the size?)

The bitfile can be sent to the FPGA directly (without the -I and -R options to xc3sprog)


./xc3sprog -c papilio -I../bscan_spi/bscan_spi_xc3s500e_papilio.bit ~/VHDL/ClkTrig/design_top.bit  -v -R


Verifying page    244/  1109 at flash page    244
Verify failed  at flash_page    245

Attached is the design_top.bit file that causes the problem, and the full output of xs3sprog.

I'm using the Papilio One;

XC3SPROG © 2004-2011 xc3sprog project $Rev: 691 $ OS: Linux  (retrieved from git 17th of april 2013)
Ubuntu 13.04


Anyone know a fix?



Link to comment
Share on other sites

Thanks for the suggestion. When I compile and run papilio-prog, I get this:



$ sudo ./papilio-prog -v -f ~/VHDL/LEDTest/LEDtest.bit -b ../xc3sprog/trunk/bscan_spi/bscan_spi_xc3s500e_papilio.bit -sa -r
Using built-in device list
JTAG chainpos: 0 Device IDCODE = 0x41c22093     Desc: XC3S500E

Uploading "../xc3sprog/trunk/bscan_spi/bscan_spi_xc3s500e_papilio.bit". Done.
Programming time 444.9 ms

Programming External Flash Memory with "/home/joostje/VHDL/LEDTest/LEDtest.bit".
Uknown Flash Manufacturer (0x00)
Error: SPI Status Register [0x00] mismatch (Wrong device or device not ready)..
Error occured.
USB transactions: Write 148 read 8 retries 8


This seems similar to http://forum.gadgetfactory.net/index.php?/topic/1451-loading-the-spi-flash-on-the-papilio-pro/

But `git pull` (repository: git://github.com/GadgetFactory/Papilio-Loader.git) reports that I'm up-to-date.

How do I check the version of papilio-prog that I have (If I do indeed need the v2.3)?


(The above command uses a .bit file that xc3sprog can send to the papilio flash without any problems)

Link to comment
Share on other sites

One more note:
* I hacked xc3sprog to detect the location where the missing 2 bytes will occur, and to addd two zero bytes in the stream (see below)

  yeah, a really bad hack, but it does work

* The 2 bytes before the 0x6c33 are 0x9a, 0x65, that happens to be half of the bit-reverse of the 'magic' 0x59, 0xa6,

  defined in progalgspiflash.cpp and bscan*.vhd -- is that a coincidence?


So around the ProgAlgSPIFlash::program() function, this line:


  spi_xfer_user1(NULL,0,0,&AAIP_Cmd[0], 0, inAAImode ? 3 :  6);


now has been replaced by:


      uint8_t buf[6];
      memcpy(buf, AAIP_Cmd, 6);
      printf("* * * * * prepending zero's! * * * * * \n");
      spi_xfer_user1(NULL,0,0,buf, 0, inAAImode ? 3 : 6);
    spi_xfer_user1(NULL,0,0,&AAIP_Cmd[0], 0, inAAImode ? 3 : 6);


    //If we see the 'magic', the next send will fail:


(and a declaration of the willfail variable).
I know this is a bad hack, but maybe someone else now notices the real problem.



* Can anyone else with a Papilio One try the design_top.bit file I attached at the top of this thread with xc3sprog? I really would like to know if it is just my setup.

Link to comment
Share on other sites

I just verified that I can program that bit file using the Papilio Loader and papilio-prog. If those methods are not working for you then there must be something wrong with your SPI Flash and we should replace the board. If you want to get a replacement board then please just send an email to support@gadgetfactory.net with a link to this forum thread and your shipping address and we will get a new board sent out to you.


Thank you,


Link to comment
Share on other sites

Thanks for verifying it!


Could you write the parameters you gave papilio-prog to do it?

For me, this works (not sending to flash):


sudo ./papilio-prog -v -f ~/VHDL/ClkTrig/design_top.bit   -sa


but this doesn't:


sudo ./papilio-prog -v -f ~/VHDL/ClkTrig/design_top.bit -b ../xc3sprog/trunk/bscan_spi/bscan_spi_xc3s500e_papilio.bit -sa -r


and reports the error:

Programming External Flash Memory with "/home/joostje/VHDL/ClkTrig/design_top.bit".
Uknown Flash Manufacturer (0x00)


However, I can program it the flash with the 'hacked' (as described above) xc3sprog, so it is at least somewhat functional.

Maybe my computer is slower than yours, whatever.

Link to comment
Share on other sites

  • 2 weeks later...

Ah, I now see I papilio-prog uses the bscan from Java-GUI, not the ones from xc3sprog, so that was the reason programming failed for me.

If anyone else encounters this problem, this works for me:


From the Papilio-Loader/papilio-prog directory, this does work:


sudo ./papilio-prog -v -f ~/VHDL/ClkTrig/design_top.bit -b ../Java-GUI/programmer/bscan_spi_xc3s500e.bit -sa -r



As I showed above in my postings, using the bscan_spi_xc3s500e.bit from xc3sprog doesn't work, and gives the messages:


Uknown Flash Manufacturer (0x00)
Error: SPI Status Register [0x00] mismatch (Wrong device or device not ready)..
Error occured.


BTW, even now I cannot find documentation on what bitfile to use for xc3500e, at least not here


Only by looking at the papilio-prog source I realised papilio-prog uses a different 'magic' code than

xc3sprog, so the bscan binaries must be different.


Thanks for the help!

Link to comment
Share on other sites

Thank you for the update, papilio-prog is a fork of xc3sprog so there is divergence. I would expect that you need to use the bscan file that ships with each version to be successful. I included xc3sprog as a backup option, maybe I should remove it from the source tree to avoid future confusion about which tool is best to use. At the very least it looks like I should update the Papilio Loader projects readme to better explain and I also need to include the bscan bit files in the papilio-prog directory instead of just in the Java-Gui directory. I just made a task to make those changes for the next release of Papilio Loader. Girish is working on some improvements as we speak so there will need to be a new release soon.


Thank you,


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.