amalawi Posted February 4, 2016 Report Share Posted February 4, 2016 Hi, I have a papilio pro board and going through IntroToSpartanFPGABook. I notice that while using Papilio Loader 2.7, I can test the examples using the 'FPGA' write to: option, but the 'SPI Flash' will not persist if i disconnected the usb cable. The terminal shows the following: : sudo papilio-prog -b chapter7.bit -s e -v Using built-in device listJTAG chainpos: 0 Device IDCODE = 0x24001093 Desc: XC6SLX9 Uploading "chapter7.bit". DNA is 0x39ea4e6060d673ffDone.Programming time 541.9 msErasing External Flash Memory.Uknown Flash Manufacturer (0x00)Error: SPI Status Register [0x00] mismatch (Wrong device or device not ready)..Error occured.USB transactions: Write 178 read 10 retries 9 I'm running Linux Mint 17.1 - x86_64 (3.13.0-37-generic #64-Ubuntu SMP) Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 4, 2016 Report Share Posted February 4, 2016 Try this cmd line:sudo papilio-prog -f chapter7.bit -b bscan_spi_lx9.bit -v -sa -r Magnus Quote Link to comment Share on other sites More sharing options...
amalawi Posted February 4, 2016 Author Report Share Posted February 4, 2016 Thanks for the prompt response. I tried the command line which gave the following output that says everything is ok (erasure, verification, programming and final verification) , however, the fpga is not programmed (meaning the example is not working as expected) : sudo papilio-prog -f chapter7.bit -b ~/Downloads/Papilio-Loader-master/Fpga/bscan_spi_lx9.bit -v -sa -rUsing built-in device listJTAG chainpos: 0 Device IDCODE = 0x24001093 Desc: XC6SLX9 Uploading "/home/alaa/Downloads/Papilio-Loader-master/Fpga/bscan_spi_lx9.bit". DNA is 0x39ea4e6060d673ffDone.Programming time 540.1 ms Programming External Flash Memory with "chapter7.bit".Found Macronix Flash (Pages=32768, Page Size=256 bytes, 67108864 bits).Erasing :Doing Partial Erase......OkVerifying :......PassProgramming :......OkVerifying :......PassDone.SPI execution time 17319.6 msUSB transactions: Write 6851 read 6682 retries 6492 Quote Link to comment Share on other sites More sharing options...
amalawi Posted February 4, 2016 Author Report Share Posted February 4, 2016 After playing again, it will work after I disconnect the device and reconnect it. Is this the correct way? that it will not run after programming and I need to unplug-plug the usb cable? Thanks in advance Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 5, 2016 Report Share Posted February 5, 2016 Yeah, this is a known bug (-r not working).See http://forum.gadgetfactory.net/index.php?/topic/2515-papilio-prog-reconfig-bug-workaround/ Magnus Quote Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 5, 2016 Report Share Posted February 5, 2016 You can do a sudo papilio-prog -C That should cause it to restart. Quote Link to comment Share on other sites More sharing options...
amalawi Posted February 5, 2016 Author Report Share Posted February 5, 2016 nither -vc nor -C caused the gadget to show the example code. I needed to power cycle it. here is the terminal output : sudo papilio-prog -vCUsing built-in device listJTAG chainpos: 0 Device IDCODE = 0x24001093 Desc: XC6SLX9 STAT RegisterID_ERROR = 0 IDCODE not validated.DONE = 0 Input from the DONE pin.INIT = 0 Input from the INIT pin.MODE = 000b Input from the MODE pins (M2:M0).GHIGH_B = 0 0 = asserted.GWE = 0 0 = all FFs and Block RAMs are write-disabled.GTS_CFG = 0 0 = all I/Os are 3-stated.IN_ERROR = 0 Legacy input error.DCI_MATCH = 0 DCI is matched.DCM_LOCK = 0 DCMs are locked.CRC_ERROR = 0 CRC error.USB transactions: Write 6 read 4 retries 1 In the moment power cycling should not be a big issue. Any way thanks for the support! Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 5, 2016 Report Share Posted February 5, 2016 As I said in the other thread (http://forum.gadgetfactory.net/index.php?/topic/2515-papilio-prog-reconfig-bug-workaround/) the fix for this is simple - just update the Reconfigure() routine in progalgxc3s.cpp like the way the current xc3sprog code does it and recompile. If you want to try it, here is a link to a version with this fix implemented (windows version) : http://www.saanlima.com/download/papilio-prog.exe Magnus Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 5, 2016 Report Share Posted February 5, 2016 Thanks for the prompt response. I tried the command line which gave the following output that says everything is ok (erasure, verification, programming and final verification) , however, the fpga is not programmed (meaning the example is not working as expected) : sudo papilio-prog -f chapter7.bit -b ~/Downloads/Papilio-Loader-master/Fpga/bscan_spi_lx9.bit -v -sa -rUsing built-in device listJTAG chainpos: 0 Device IDCODE = 0x24001093 Desc: XC6SLX9 Uploading "/home/alaa/Downloads/Papilio-Loader-master/Fpga/bscan_spi_lx9.bit". DNA is 0x39ea4e6060d673ffDone.Programming time 540.1 ms Programming External Flash Memory with "chapter7.bit".Found Macronix Flash (Pages=32768, Page Size=256 bytes, 67108864 bits).Erasing :Doing Partial Erase......OkVerifying :......PassProgramming :......OkVerifying :......PassDone.SPI execution time 17319.6 msUSB transactions: Write 6851 read 6682 retries 6492 BTW, I would be concerned about the last line above, the high number of retries indicates that there is an issue with your USB link (bad cable etc.). This is what I see when I program a Papilio Pro:Using built-in device listJTAG chainpos: 0 Device IDCODE = 0x24001093 Desc: XC6SLX9Uploading "tools/bscan_spi_lx9_qfp144.bit". DNA is 0xf9e7a182038fb0ffDone.Programming time 553.0 msProgramming External Flash Memory with "ISE/plustoo_top.bit".Found Macronix Flash (Pages=32768, Page Size=256 bytes, 67108864 bits).Erasing :......OkVerifying :......PassProgramming :......OkVerifying :......PassDone.SPI execution time 15932.9 msUSB transactions: Write 6851 read 6682 retries 0 Magnus Quote Link to comment Share on other sites More sharing options...
amalawi Posted February 5, 2016 Author Report Share Posted February 5, 2016 Magnus, this is strange as both of the front 2 USBs as well as some of the back ones (3 USBs) are giving this high number of retries ~32000, however, there is also another 2 back USBs which gave ~4000 retries !? maybe its the PC or the power line or another thing, I'll keep investigating, but thanks for indicating that this number should be normally 0. Using the -C or -c trick with the lower retries ports (the 2 back USBs) does the trick but should be on a separate terminal line. Another thing is that after batching progalgxc3s.cpp with your code snippet, I'm me able to use the -r option, though, this should be on a separate invocation (2 steps, program cmd line, reconfiguration cmd line). I had looked through the source code of butterfly.cpp and noticed that reconfiguration does not happen when the user wants spiflash (which is my case), thus I had also make a kludge and copied the "if (reconfigure)" from the else branch of "if (spiflash)" into the positive branch (after line 347). After compiling I can now specify the -r option in the same command line and get it also reconfigured after programming (Great!) I'll continue with the tutorial and at the same time check if I can pin down the issue of high number of retries. Thanks! Ala'a Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 5, 2016 Report Share Posted February 5, 2016 Great! Yeah, I did the same fix in butterfly.cpp to make it work on the same cmd line. I also fixed another thing that confuses a lot of people - if there is a problem with the JTAG connection between the FTDI chip and the FPGA (bad board or opening the wrong FTDI device) then one of the most cryptic error message will shop up: Invalid chain position 0, position must be less than 0 (but not less than 0). So I patched get_id at top of butterfly.cpp to look like this (the added code in italic) so it's more clear what the problem is: unsigned int get_id(Jtag &jtag, DeviceDB &db, int chainpos, bool verbose){ int num=jtag.getChain(); unsigned int id; if (num == 0) { fprintf(stderr, "No JTAG device found, aborting.\n"); return 0; } // Synchronise database with chain of devices. for(int i=0; i<num; i++) { int length=db.loadDevice(jtag.getDeviceID(i)); if(length>0) jtag.setDeviceIRLength(i,length); else { id=jtag.getDeviceID(i); fprintf(stderr, "Cannot find device having IDCODE=%08x\n",id); return 0; } } if(jtag.selectDevice(chainpos)<0) { fprintf(stderr, "Invalid chain position %d, position must be less than %d (but not less than 0).\n",chainpos,num); return 0; } const char *dd=db.getDeviceDescription(chainpos); id = jtag.getDeviceID(chainpos); if (verbose) { printf("JTAG chainpos: %d Device IDCODE = 0x%08x\tDesc: %s\n", chainpos,id, dd); fflush(stdout); } return id;} Magnus Quote Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 5, 2016 Report Share Posted February 5, 2016 Thank you for the tips guys, do you mind making a pull request for these changes on Github and I will get them included in the next release?https://github.com/GadgetFactory/Papilio-Loader Thanks!Jack. Quote Link to comment Share on other sites More sharing options...
offroad Posted February 9, 2016 Report Share Posted February 9, 2016 >> Invalid chain position 0, position must be less than 0 (but not less than 0). Epic. Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 10, 2016 Report Share Posted February 10, 2016 Thank you for the tips guys, do you mind making a pull request for these changes on Github and I will get them included in the next release?https://github.com/GadgetFactory/Papilio-Loader Thanks!Jack. Pull request issued. Cheers,Magnus Quote Link to comment Share on other sites More sharing options...
mkarlsson Posted February 10, 2016 Report Share Posted February 10, 2016 BTW, I also added two files - Makefile.msys and README.msysThe make file will allow you to compile papilio-prog on a windows machine with msys installed, and the README file tells you how. Magnus Quote Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 11, 2016 Report Share Posted February 11, 2016 Thank you very much Magnus! I merged the changes and am putting an item on my task list to make a new release. Thank you!Jack. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.