How to use MachXO2 breakout board to configure an FPGA on a custom board? - Page 1
Forum section: electronics / general

author: matbob
author_rank: Contributor
timestamp: January 06, 2019, 05:40:12 am
content: Hello All,I have a Lattice MachXO2-7000HE breakout board with me. I would like to know whether anyone has tried to configure a Lattice FPGA on a custom board using the MachXO2 breakout board. I want to use the FT2232H USB-JTAG interface on the breakout board to configure an FPGA on a board designed myself.I see that the JTAG pins from the FT2232H chip are hard-wired to the on-board FPGA. I can desolder the resistors R5 to R8 from the board and solder wires from the output of the FT2232H chip to my board and configure it, but I do not want to modify the breakout board.I am thinking of grounding the INITn (pin 110) of the on-baord FPGA so that it never comes out of the initialization process after power-up. I hope that the JTAG pins of the on-board FPGA will be floating or weakly pulled-up down in this condition. Then I can use the JTAG header J1 on the board directly as a JTAG programming port for my custom board.Any suggestions on this? I am not able to try this out yet because my custom board is under development. I do not want to spend money on another JTAG programming cable.Thank you.

author: ale500
author_rank: Frequent Contributor
timestamp: January 06, 2019, 01:38:11 pm
content: I regularly use a breakout board with a MachXO2-1200 (the previous version of the one you have) to program some of my custom boards (with either a MachXO2-1200 or a -7000). I did cut two of traces going to to the header J1 (TDI and TDO). And then use all the signals from the header (J1) to program the other FPGA. I did put two jumpers on the prototyping area which are to be closed when I want to use the on board FPGA, so TDI and TDO are routed to/from the FT2232 to the FPGA. Haven't used those yet, I populated some of the headers with pins in a very silly way and thus I cannot really use the board for much test.A while ago I ordered (via aliexpress) a FT2232H breakout board, reprogrammed it to act as a HW-USBN-2B and used it for some other lattice FPGAs. It is relatively cheap and works without a hiccup.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 06, 2019, 02:04:07 pm
content: Why not to install FT232H on the FPGA board you're making?

author: Berni
author_rank: Super Contributor
timestamp: January 06, 2019, 02:56:25 pm
content: Yep i also modified one of these boards into a Lattice JTAG programmer for programing any prototype boards using Lattice chips. Works greatI don't have it here right now to see what exactly i did, but you can get the schematic for it to easily find out yourself. From memory i think i had to remove a few resistors to disconnect the FPGA on the dev board and run a few wires to make the JTAG header on this board work in reverse (Its normally used for having an external JTAG programmer access the onboard FPGA, but with a few mod wires can be made to connect a external FPGA to the onboard FTDI programmer chip)You could also build your own using the FTDI chip but you must also strip off the configuration image so that it presents itself to the PC in a way that the Lattice software recognizes it, a blank unprogrammed FTDI chip wont work.But given how cheep these boards are its just easier to do a 5 minute mod to this board. It might be worth making your own if you are building a production setup and need to program 20 boards simultaneously. If you are going to spend so much time on designing the test jigs and everything you might as well also design in the simple little programmer rather than buying 20 of these boards and modding them only to connect everything with a giant mess of cables in the end.

author: matbob
author_rank: Contributor
timestamp: January 06, 2019, 07:50:05 pm
content: Hi ale500, NorthGuy and Berni,Thanks for your comments.@ale500: I did consider this option but I do not want to cut any tracks. I think only the TDO track needs to be cut because this is an output pin of the FPGA. Just curious, can we cut the TDI track alone and form a daisy chained connection of two FPGAs? Will Diamond Programmer detect both the FPGAs?@NorthGuy: I want to make a low cost board. I will be making a few hundreds of these boards.@Berni: As I mentioned before, I do not want to modify the breakout board. About making a FT2232 programmer, I think buying a FT2232 module and reconfiguring the EEPROM would be easy and cheap.I am presently in Canada, and I rely mainly on Digikey and Mouser. The cheapest FT232H (not FT2232H) board I could find is the one from Adafruit for about $24 (CAD). I am not sure whether I would be successful in using FT232H rather than FT2232H. Based on my limited search in various forums, I am not able to find any success stories using FT232H. The MachXO2 board is about $47 (CAD). I already own one and I would buy one more of this if I can use this to configure an FPGA outside the board. Then I will have a backup board as well.I would like to know the status of the JTAG pins when the INITn pin is grounded upon power up. If all of them are high-impedance (at least the TDO pin), then I need not do any modification on the breakout board. The INITn pin is available directly on the J2 header and I can ground it very easily.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: January 06, 2019, 08:03:59 pm
content: Quote from: matbob on January 06, 2019, 05:40:12 amWorks as you expect.ie Isolate the breakout FPGA, and keep the leads short, and a 100R or similar series R can help reduce ringing, and reduce any contention effects.

author: Berni
author_rank: Super Contributor
timestamp: January 06, 2019, 08:13:58 pm
content: I turned mine into a programmer by removing resistors and i tend to leave resistors on one of the pads but rotated 180° so i keep the resistor on the board. If i want to turn it back into a dev board i simply remove the bodge wires and turn the few resistors back around 180 and solder down the other pin. But i instead just ordered another board to use as a devboard since i always need a JTAG programmer around for flashing boards i made using Lattice FPGAs.As far as i know you can chain program them just fine from Lattice Diamond.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 06, 2019, 08:40:39 pm
content: Yeah, frankly, using an FT232H or FT2232H breakout board will be simpler and you won't have to butcher a MachXO2 dev board.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 06, 2019, 08:53:05 pm
content: Quote from: matbob on January 06, 2019, 07:50:05 pmI used FT232H with Xilinx FPGA. It is practically 1/2 of FT2232H. FT chips doesn't have any internal storage, so they requires external EEPROM. In Xilinx's case, it so happened that you Xilinx's tools will only work if there's a secret Key in the EEPROM. Looks like you can buy the key for $10 US per chip, but nobody knows how. Huh? You can certainly copy the EEPROM, but I'm sure in Xilinx case this would be illegal. So, it took me the whole two days to write my own bitstream uploader and programmer for the configuration PROM. But in the end, it works fine. I'm putting it on the board. In addition to EEPROM, the FT chip requires oscillator, few descrete elements and USB connector. Overall it's about $7-8 CAD if I recall correctly. Since PCBs are very cheap, you can build your own FT232H board for not much more than this. If you want to save every last cent, this is the way to go.

author: ale500
author_rank: Frequent Contributor
timestamp: January 08, 2019, 05:22:13 am
content: Daisy chaining the fpgas should also work.I bought one of this boards:https://de.aliexpress.com/item/EYEWINK-FT2232HL-development-board-learning-board-FT2232H-MINI-FT4232H-UM232H-development-board/32806818411.html?spm=a2g0x.search0104.3.2.49f7499ctLsuFf&ws_ab_test=searchweb0_0,searchweb201602_1_10065_10068_319_317_10548_10696_453_10084_454_10083_10618_431_10307_10821_537_10302_536_10059_10884_10887_100031_10319_321_322_10103,searchweb201603_51,ppcSwitch_0&algo_expid=9080e41d-c8dc-439b-8cec-296e56297841-0&algo_pvid=9080e41d-c8dc-439b-8cec-296e56297841&transAbTest=ae803_4for like 12 €

author: matbob
author_rank: Contributor
timestamp: January 08, 2019, 05:01:41 pm
content: QuoteI will try this and post the result. I have ordered a new breakout board and the FPGA chips. Waiting for them to arrive.

author: Bassman59
author_rank: Super Contributor
timestamp: January 08, 2019, 05:16:50 pm
content: Quote from: ale500 on January 06, 2019, 01:38:11 pmi have the FT2232H board direct from FTDI. How do you reprogram it to work as the Lattice programmer?

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 08, 2019, 05:28:38 pm
content: Quote from: Bassman59 on January 08, 2019, 05:16:50 pmI uploaded a config file to program the EEPROM there:https://www.eevblog.com/forum/microcontrollers/wich-programmer-for-machxo2-fpgas/msg1395844/#msg1395844

author: matbob
author_rank: Contributor
timestamp: January 09, 2019, 03:24:43 am
content: Hello All,I tired out the method I posted, keeping the INITn pin low from power-up, but it did not work. The Lattice Diamond Programmer was still detecting the on-board FPGA (Mach XO2 7000HE) upon scanning. The FPGA even loaded the configuration from flash memory and started executing which should not happen according to the datasheet (Figure 1. Configuration Flow in the MachXO2 Programming and Configuration Usage Guide). According to the datasheet, if the INITn pin is kept low, the FPGA should not come out of the initialization process. I wonder what is happening.Next I tried my luck by controlling the JTAG port using the JTAGENB pin. It worked! I programmed the on-board FPGA with these settings: JTAG_PORT: DISABLE and MUX_CONFIGURATION_PORTS:ENABLE (settings available in Spreadsheet View->Global Preferences). Once I configured the on-board FPGA with these settings, keeping the JTAGENB pin (pin 120) low made the JTAG pins general purpose I/O. Now when I did the JTAG scan, the on-board FPGA was not detected. But when I pulled JTAGENB pin high and initiated a JTAG scan, the on-board FPGA was detected. With the JTAGENB pin low, I connected my custom board to the breakout board through the JTAG header and I initiated the JTAG scan and guess what, the FPGA on my board was detected! So the idea is to disable the JTAG port of the FPGA in the breakout board by pulling the JTAGENB pin low.You do not need any hardware modification on the breakout board with this method.

author: Berni
author_rank: Super Contributor
timestamp: January 09, 2019, 06:01:38 pm
content: Ah neat trick there.I don't really mind hacking and bodging my dev boards. Its what the boards are made for.

author: Bassman59
author_rank: Super Contributor
timestamp: January 09, 2019, 08:59:06 pm
content: Quote from: SiliconWizard on January 08, 2019, 05:28:38 pmThanks, I will do that. (I have the Lattice programmer, too, but it's nice to have more than one lying around ...)