Path: EDN Asia >> Design Ideas >> IC/Board/Systems Design >> Debug MCU-to-FPGA interface from FPGA side
IC/Board/Systems Design Share print

Debug MCU-to-FPGA interface from FPGA side

01 Sep 2015  | Bibo Yang

Share this page with your friends

Microcontrollers and FPGAs usually work together in embedded systems. As more functions move into the FPGA, however, debugging the interface between the two devices becomes more difficult. The traditional debugging approach comes from the microcontroller side, which relies on a serial-port printout. This approach adds overhead and may cause timing problems. Furthermore, this approach cannot guarantee uninterrupted and exclusive access to certain addresses because of operating-system multi-tasking. Thus, a serial-port printout doesn't accurately describe the actions on the microcontroller/FPGA interface.

Instead, you can approach the problem from the FPGA side using a JTAG (Joint Test Action Group) interface as a communication port. This approach uses the internal logic of the FPGA to capture the read/write transactions on the microcontroller/FPGA interface. This method is nonintrusive because the circuit that captures transactions sits between the microcontroller and the FPGA's functioning logic and monitors the data without interfering with it. It stores the captured transaction in the FPGA's RAM resources in real time. You can transfer the data to a PC through the JTAG port's download cable.

The debugging tool comprises the data-capture circuit, the JTAG communication circuit, and the GUI (graphical user interface). The data-capture circuit uses standard HDL (hardware-description language) and instantiates a FIFO (first-in/first-out) buffer in the FPGA. Whenever you read or write to a register, the debugging tool records the corresponding value of the address and data on the bus and stores it in the FIFO buffer. You can retrieve the data through the JTAG's download cable to the PC.

Because the FPGA has limited on-chip RAM resources, you must keep the FIFO buffer shallow. To efficiently use the FIFO buffer, the design includes filter and trigger circuits. With inclusive address filtering, the circuit monitors only several discontinuous spans of addresses instead of the whole address space. Exclusive-address filters can filter out several smaller address spans from the inclusive-address spans, enabling finer control of the filter settings.


Figure: The JTAG's vendor-supplied, customizable communication circuit has two interfaces.


With transaction triggering, the circuit starts when you read from or write to a certain address. You can add certain data values to the triggering condition. You can dynamically reconfigure the settings of address filters and transaction triggers through the JTAG's vendor-supplied, customisable communication circuit without recompilation of the FPGA design (figure). The circuit has two interfaces, one of which is written in HDL to form a customised JTAG chain. It communicates with the user logic. The circuit is accessible through specific programming interfaces on the PC and communicates with the user program or GUI.

The FPGA-based circuit facilitates writing and reading functions from PC to FPGA logic, and it promotes the JTAG interface to a general communication port attached to the FPGA. FPGA manufacturers, including Actel, Altera, Lattice Semiconductor, and Xilinx, respectively, call this circuit UJTAG (user JTAG), Virtual JTAG, ORCAstra, and BScan (references 1 through 4).

The GUI for this circuit uses Tcl/Tk (tool-command-language tool kit). FPGA manufacturers provide vendor-specific APIs (application-programming interfaces) in Tcl for the PC side of the JTAG-communication circuit. The APIs include basic functions, such as JTAG-chain initialisation, selection, and data reading and writing. With the data-read function, you can check the capturing status and get the transaction data from the FIFO buffer. With the data-writing function, you can send the filter and trigger configuration data to the capturing circuit in the FPGA. The JTAG-based debugging method provides dynamic visibility and controllability into the microcontroller-to-FPGA interface and the FPGA's internal logic without the need to recompile and download FPGA code.


References
1. "How to Use UJTAG," Application Note AC227, Actel Corp, 2005.
2. "Virtual JTAG (sld_virtual_jtag) Megafunction User Guide," Altera, December 2008.
3. "ORCAstra FPGA Control Center," Lattice Semiconductor.
4. Wallace, Derek, "Using the JTAG Interface as a General-Purpose Communication Port," Xilinx, 2009.


About the author
Bibo Yang is with Sunrise Telecom in Beijing, China.


This article is a Design Idea selected for re-publication by the editors. It was first published on December 15, 2009 in EDN.com.




Want to more of this to be delivered to you for FREE?

Subscribe to EDN Asia alerts and receive the latest design ideas and product news in your inbox.

Got to make sure you're not a robot. Please enter the code displayed on the right.

Time to activate your subscription - it's easy!

We have sent an activate request to your registerd e-email. Simply click on the link to activate your subscription.

We're doing this to protect your privacy and ensure you successfully receive your e-mail alerts.


Add New Comment
Visitor (To avoid code verification, simply login or register with us. It is fast and free!)
*Verify code:
Tech Impact

Regional Roundup
Control this smart glass with the blink of an eye
K-Glass 2 detects users' eye movements to point the cursor to recognise computer icons or objects in the Internet, and uses winks for commands. The researchers call this interface the "i-Mouse."

GlobalFoundries extends grants to Singapore students
ARM, Tencent Games team up to improve mobile gaming


News | Products | Design Features | Regional Roundup | Tech Impact