Onboard Flash works how ?


Shanjit Singh

Recommended Posts

Hi

 

I have used the Papilio and have implemented a few basic digital designs on it. I am planning to make a FPGA shield (XC3S250E) for an arduino footprint (based on an ARM Stellaris Cortex M3 processor).

 

I have a doubt on how the onboard Flash of the Papilio is programmed. The FT2232 (USB-Serial/JTAG) is connected directly to the FPGA pins and unless there is some sort of a bootloader already burned onto the board, there shouldn't be anyway the SPI Flash gets initialized and stores any value. Am i correct on this ? How is the onboard flash implemented ? 

 

Thanks

Link to comment
Share on other sites

I have a doubt on how the onboard Flash of the Papilio is programmed. The FT2232 (USB-Serial/JTAG) is connected directly to the FPGA pins and unless there is some sort of a bootloader already burned onto the board, there shouldn't be anyway the SPI Flash gets initialized and stores any value. Am i correct on this ? How is the onboard flash implemented ? 

 

Thanks

 

When PapilioProg is run it downloads a predefined ".bit" file to the FPGA (e.g. bscan_spi_xc3s250e). The design in the bit-file wires up the SPI flash so it can be programmed. Pretty cunning!

Link to comment
Share on other sites

Thanks i think i understand. The Papilio prog command

papilio-prog.exe -v -f final.bit -b bscan_spi_xc3s250e.bit -sa -r will both initialize the SPI Flash and then burn the corresponding bit file onto the board as well. I tried this on my board and this works fine under linux also, which is pretty awesome! Thanks!

 

Can i achieve the same thing by using the JTAG connectors directly ? As in suppose i use this http://www.digilentinc.com/Products/Detail.cfm?Prod=ADEPT2 , can i program the SPI flash using this ? I did try it out in the morning and i wasn't able to program the Flash but could program the XC3S250E directly. Anyway to program the flash ? 

 

Where can i find the bscan_spi_xc3s250e.bit source code ? I reckon i should take a look at it once. 

Link to comment
Share on other sites

I am grateful for such quick replies! 

 

I actually want to make my own board using only the JTAG connector (minus the USB and FT2232) and program both the SPI Flash and the FPGA, now since the SPI Flash is connected to the the FPGA directly how do i write my .bit file into the flash ? Papilio prog does all this using the bscan file in the background. 

 

Thanks for your link. I am working with the Papilio One. In my final design i would be removing the USB and FT2232. 

 

I found http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/pim_c_introduction_indirect_programming.htm maybe this can sort things out. Just going through this..

Link to comment
Share on other sites

Shanjit,

 

The ft2232 is a critical part of the solution, I don't know of any way to do what you want without the ft2232.

 

Jack.

 

Oh! 

 

But is it possible if i use something like http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/pim_c_introduction_indirect_programming.htm with my XC3s250E (and SPI) and lose the FT2232 ? 

 

I shall be testing it out anyway. I only have a different flash than the ones pointed out in the above link..

Link to comment
Share on other sites

Shanjit you will notice in the link you posted that on the very first page in the picture there is a box between the laptop and the FPGA board being programmed. It is a JTAG adapter.

This is exactly what the FT2232 does on the Papillo boards, essentially every Papilio board has its own JTAG adapter built in. If you want to design your own board without a FT2232 you will need to just bring the FPGA JTAG pins tow header and use an external JTAG adapter to do the programming. A lot of JTAG programmers you can buy commercially are already based on the FT2232 chip, for example the Amontech one.

Since you're rolling your own hardware programming solution you'll have to come up with your own software to do the programming since that will depend specifically on the hardware you decide to use.

So in conclusion what you want can be done, but its a lot easier to use a tried and tested solution like the Papilio that comes with ready to use software than rolling your own, unless you really know what you're doing.

Link to comment
Share on other sites

I'm sure you can figure out some method, but it will take some work, the ft2232 makes it easy. :)

 

Jack.

I hope i am able to! :)

 

 

 

Shanjit you will notice in the link you posted that on the very first page in the picture there is a box between the laptop and the FPGA board being programmed. It is a JTAG adapter.

This is exactly what the FT2232 does on the Papillo boards, essentially every Papilio board has its own JTAG adapter built in. If you want to design your own board without a FT2232 you will need to just bring the FPGA JTAG pins tow header and use an external JTAG adapter to do the programming. A lot of JTAG programmers you can buy commercially are already based on the FT2232 chip, for example the Amontech one.

Since you're rolling your own hardware programming solution you'll have to come up with your own software to do the programming since that will depend specifically on the hardware you decide to use.

So in conclusion what you want can be done, but its a lot easier to use a tried and tested solution like the Papilio that comes with ready to use software than rolling your own, unless you really know what you're doing.

I follow you completely. Thank you :) 

 

Yep! I have a Digilent Adept (http://www.digilentinc.com/Products/Detail.cfm?Prod=ADEPT2) JTAG programmer and intend to use that. I also found out XC3sprog (http://sourceforge.net/projects/xc3sprog)and Digilent's Adept falls into their Cable list (fortunately!). I will try getting the SST Series Flash devices to work or else would jump onto a  different supported Flash device.

Link to comment
Share on other sites

Can there be one more way, 

 

Using the FT232 (has only the USB-Serial link unlike the FT2232, which has a USB-JTAG&Serial link). SO first i program the bscan_xc3s250e.bit file using the JTAG into the FPGA. Now the FPGA would have setup a proper RX-TX to SPI Flash interface on itself. I can then use the FT232 with the RX-TX pins to program the flash.

 

Am i wrong anywhere conceptually ? I will have to practically try it out to confirm the working of everything. 

 

My propensity towards the FT232 being because of the package (easier to lab-manufacture and test) rather than the FT2232 (48 LQFP) not to mention the EEPROM..

 

Edit: 

I just had a look at http://forum.gadgetfactory.net/index.php?/topic/1224-programming-the-flash-using-jtag/ 

About the bscan and papilio

"It uses the same method Impact does which is to load a special bitstream to the FPGA first. The bitstream uses the bscan primitive to make a connection from the jtag pins to the SPI flash. Then JTAG is used to load the data onto the SPI flash."

So the bscan bitstream isn't actually connected the USB Rx/Tx to the SPI Flash but instead the JTAG interacts with the SPI Flash. So, what i said can't be done. I better change my SST based SPI Flash and use the Impact tool itself. 

 

Correct me if i am wrong. I am going through the source code at XC3sprog to be doubly sure..Thanks.

Link to comment
Share on other sites

If you connect one of the FTDI chips that can be used by xc3sprog then you should be able to program the SPI flash with it, the bitstream used allows the FTDI chip connected to the JTAG port to influence the signals on the SPI port to program the Flash chip.  This needs an FTDI chip which can use the universal serial protocol engine they have that is used by xc3sprog to implement JTAG.  

 

Additionally what makes the 48 pin LQFP package so hard to use?

Link to comment
Share on other sites

If you connect one of the FTDI chips that can be used by xc3sprog then you should be able to program the SPI flash with it, the bitstream used allows the FTDI chip connected to the JTAG port to influence the signals on the SPI port to program the Flash chip.  This needs an FTDI chip which can use the universal serial protocol engine they have that is used by xc3sprog to implement JTAG.  

 

Additionally what makes the 48 pin LQFP package so hard to use?

I will look into this! Thanks! 

 

Actually the in-house method we folllow to make PCBs in our lab does not get the 48 LQFP pitch right and i would need to even send the prototype outside for manufacture. 

 

One more thing, can i take the FTDI into Optoisolator mode and then use the JTAG for programming the SPI flash on the papilio ? (say using the xc3sprog or papilio loader ?) Somehow this doesn't work for me..

Link to comment
Share on other sites

Thanks i think i understand. The Papilio prog command

papilio-prog.exe -v -f final.bit -b bscan_spi_xc3s250e.bit -sa -r will both initialize the SPI Flash and then burn the corresponding bit file onto the board as well. I tried this on my board and this works fine under linux also, which is pretty awesome! Thanks!

 

Can i achieve the same thing by using the JTAG connectors directly ? As in suppose i use this http://www.digilentinc.com/Products/Detail.cfm?Prod=ADEPT2 , can i program the SPI flash using this ? I did try it out in the morning and i wasn't able to program the Flash but could program the XC3S250E directly. Anyway to program the flash ? 

 

Where can i find the bscan_spi_xc3s250e.bit source code ? I reckon i should take a look at it once. 

If you want to use xc3sprog or papilio loader to program the flash then you must use a JTAG programmmer based on FT2232D or FT2232H.  There are many such programmers out there, just do a search for "jtag ft2232" and you will see many, even open-source projects.  If you want to stick with Digilent then you can use JTAG-HS1 which is based on FT2232H. 

 

I think the cheapest solution (which I have used and works great) is to get a FT2232H development board from Dangerous Prototypes (http://www.seeedstudio.com/depot/ft2232h-usb-20-hispeed-breakout-board-p-737.html?cPath=175_177) and hook up the port-A JTAG pins (ADBUS0-3) to the JTAG connector on your board.

Link to comment
Share on other sites

  • 1 month later...

Okay, so as per my initial plan. I was able to make my own custom FPGA shield for an ARM Cortex M3 board (arduino footprint ofcourse!). I used the PapilioOne as reference for basic board design. There is no FT2232 on the board. 

I have been able to program the SRAM of the XC3S250E without any problem with my Digilent Adept Tool (JTAG-SPI Full Speed Cable). But unfortunately for me, my Serial Flash SPI based isn't working. I am using a M25P40 device which is supposed to be Xilinx Impact Compatible. Any Solutions ? 

 

I have been trying to generate a PROM file for the SPI using Impact and then create a SVF file using my generated bit file. But nothing happens. Any clues on what might i be doing wrong ? 

Thank you

Link to comment
Share on other sites

I am attaching the board sch and brd files. I have divided my FPGA shield into two boards Top and Bottom, the top has the Break-out-board of the XC3s250E and some peripherals. The bottom does all the power supply and provides frequency to the top board and ofcourse attaches to the arduino footprint at the bottom. All this because i made all these PCBs (except the break-out-board) using the toner transfer method. I am attaching the sch and brd files of the top board and also a couple of images of the whole thing. 

 

http://db.tt/LHqQEv8U

 

http://db.tt/gUiOOgcO

 

http://db.tt/mmUkVWAW

 

http://db.tt/BU8Rbic5

Link to comment
Share on other sites

Archived

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