mercredi 15 avril 2026

MSX cartridge, it's progressing...

So this time I'm not really making progress in terms of building this MSX cartridge, but I'm tackling all the programming aspects of the future equipped cartridge, which therefore includes an Efinix Trion FPGA.

For now, I've implemented a fairly standard FPGA connector on the MSX cartridge. The problem is that I haven't really experimented with programming Efinix FPGAs using an external JTAG probe. I've simply planned what seems to be the minimum in terms of hardware and am doing all my tests using the JTAG probe on the Efinix development board.

So I got this type of JTAG programming board based on an FTDI 2232H component :

That's about 30 dollars!

Setting up this type of interface involves three steps, after which it will be configured as a JTAG probe by the Efinix programming software:

  1.     Configure the hardware resources of the interface.
  2.     Install the necessary Windows driver so that the 'new' interface is recognized.
  3.     Establish connections with the FPGA's JTAG connector.

For step #1, it is necessary to modify the operating mode of the two ports (A & B) of the FTDI 2232 circuit. To do this, you need to download the FTprog software from the FTDI website, scan for FTDI-type USB interfaces, then configure the two ports as follows:



You just need to configure both ports A & B in 245 FIFO mode. The driver type does not need to be changed. You can also modify the string descriptor to have something more explicit displayed when the interface is detected in the Efinix software. In fact, and after several issues while figuring this out, I copied exactly the same information as that written in the JTAG interface of the development board. The key takeaway, at a minimum, is to configure ports A & B in 245 FIFO mode. 

And that's it. Never modify the VID and PID because after that it may become very complicated to make the FTDI component reachable again by 'standard' software. I had to find a utility on the Internet to perform a 'brute force' erase of the configuration EEPROM, which made it possible to find the interface again using the FTprog software.

For step #2, it is now necessary to modify the drivers for the two interfaces corresponding to ports A & B of the FTDI component. By default, both interfaces are configured with an FTDI driver. To change this configuration, you need to download and install the well-known Zadig utility. You can find documentation on the Internet about its use, which is very simple. At this point, you just need to replace the original drivers of both interfaces with the WinUSB driver. Do this for both interfaces. Because yes, it seems that the Efinix software prefers the JTAG interface to be set up on port B, but doesn't dislike the situation if port A is not also configured like port B. I have no explanation for this, but judging by the messages provided by the Efinix programming interface, I received 'blue' warning messages indicating that a JTAG interface was present on port A but that 'usually' or 'normally' (I'm not really sure), it's better to have it on port B of the 2232 chip. So be it!


I have already done the job, which is why the driver shown is already the WinUSB driver on the left side of the window. Initially, at this location, you will see the FTDI driver.

After these modifications, you will get the two interfaces shown like this in the devices:


'Trion T20 Development Board' is the information I entered into the new FT2232H chip using the FTprog software.

For step #3, All that remains is to connect this new JTAG interface to the Efinix development board. Nothing complicated, except that you still need to be careful about certain points that are not really detailed in the documentation.

The first point concerns the JTAG interface integrated into the development board. I haven't mentioned it until now, but I am using the T20 BGA 256 board. This board has a JTAG connector that is connected on one hand to the FTDI 2232H chip integrated into the board, and on the other hand directly to the FPGA's JTAG port. Since there cannot be two masters on board, you absolutely must disable the internal JTAG interface of the development board. The JTAG connector has a pin labeled 'FRST' which, as its name seems to indicate, stands for FtdiRST. Simply connect this pin to ground by connecting it to the ground pin located right next to it. 

Then, simply connect the classic JTAG signals, namely TMS, TCLK, TDI, and TDO, between the external JTAG probe and the JTAG connector of the development board, not forgetting to connect ground. And... it's almost done.

Yes, almost done, but not quite. In its current state, you will be able to use this external probe, which will be properly recognized by the Efinix programming software. You may even be able to read the FPGA's identification number on your board, but you will not be able to program it.

Because 'the funny thing' is that the Efinix software must temporarily put the FPGA into RESET before starting its programming. I searched through quite a few docs to find out why the Efinix programmer could successfully read the FPGA's ID but was unable to program it, and it took me a little while to find the answer.

Well, in fact, another pin of the FTDI chip is used to reset the FPGA: it's pin ADBUS4 of the 2232H. 

Follow the arrows.


The two points indicated by arrows need to be connected. The goal is to bring the ADBUS4 pin to 'the' available pin on the external JTAG connector. For your information, the JTAG interface I received is version V3.6, and you can find its schematic at this location: GitHub

I simply used a small piece of wire to connect these two points on the solder side. Once the board is put back in its case, this wire is unlikely to move or potentially break a solder joint.

 Simple, isn't it?

Following all these steps, simply summarized here but which actually took me quite some time, I was able to program the FPGA of the development board in JTAG mode without any issues. That was a good start. But you are certainly aware that while this allows the FPGA to be configured, it is a dynamic configuration stored in the FPGA's internal RAM. As soon as the FPGA is reset, it cannot find a configuration file because the external EEPROM has not been programmed. And you are also certainly aware that it is possible to program an external EEPROM connected to the FPGA via the JTAG port of the same FPGA. This is a specific programming mode that the Efinix software allows you to use.

The advantage of this system is that to be able to develop, meaning to quickly modify the FPGA's RAM, the JTAG interface does that, and once development is complete, it is also possible to program the final firmware into the EEPROM using the same JTAG interface. There is no need to provide an additional SPI interface to access the external EEPROM. 

So I programmed the Drumulator firmware, which I am still developing, into the EEPROM of this board using the JTAG port, and here is the result :
 


Better than a long speech: it works!

After these adventures, I now have all the elements to continue working on my MSX cartridge. However, I need to add the RESET pin to the JTAG connector because that is not the case for now.

If you have read this article, I hope you found it useful. Not that everything described here is complicated — and it isn't — but when you don't know about it, it's much less straightforward to grasp.

Aucun commentaire:

Enregistrer un commentaire