By Adam Taylor

The design solutions we create using Zynq SoC and Zynq UltraScale+ MPSoC devices are complex embedded systems. This blog post about embedded system design will address the application challenges using both the Processing System (PS) and the Programmable Logic (PL) found in the Zynq SoC and MPSoC devices.

When it comes to commissioning these systems, we need to be able to debug interactions between the PS and PL at run time. We can use breakpoints to halt the software so that we can examine values in memory and registers. We can also use Integrated Logic Analyzers (ILA) to examine designs within the PL. What we need is a method to allow software break points and PL ILAs to work together to provide maximum information about the system’s behavior.

Cross triggering allows us to do just this. Cross triggering can:

Trigger an ILA when a software break point is hit Halt the software when an ILA is triggered

Before we can use this debugging technique, we need to enable cross triggering between the PS and PL during debug it within the customization dialog of the processing system (for either the Zynq SoC or Zynq UltraScale+ MPSoC) within Vivado.

Enabling Cross Triggering in the Zynq SoC

Enabling Cross Triggering in the Zynq UltraScale+ MPSoC

We can have as many as four cross triggers in each direction. However for this example, I am only using one trigger in each direction.

Once enabled, the Zynq SoC/Zynq UltraScale+ MPSoC PS block within our block diagram will include additional ports named TRIGGER_IN_x and TRIGGER_OUT_x. We connect these ports to the ILAs within our PL design to create cross triggers.

Note: We do not need to connect the TRIGGER_IN and TRIGGER_OUT ports to the same ILA as I do in this example. Also, the trigger input and output actually consist of two signals, the trigger signal and a trigger acknowledge.

For this example, I am using one ILA in conjunction with a Zynq SoC PS to cross trigger in both directions:

Cross triggering between an ILA and a Zynq SoC’s PS

Enabling ILA Triggers

Once we have the hardware design completed within Vivado, the next step is to build the design and then export the hardware definition and bit file to the SDK. It is within SDK that we create the application and enable cross triggering within our debug configuration.

To enable cross triggering, we need to update the debug configuration using the debug configuration dialog where we select the “enable cross triggering” option. Once this has been selected, we also need to define the connections between the input and output triggers by creating new cross-trigger breakpoints. We do this by clicking on the button to the right of the “enable cross triggering” option.

Enabling cross triggering

This will open a dialog that allow you to connect the trigger input and outputs. For this example, I need to create two cross trigger breakpoints for the one input and one output. One trigger goes from the PS to the PL and the other goes from the PL to the PS. To create these, we simply click on the create button.

Cross Trigger Breakpoint Definition

Defining the connection between the PS and PL

This will open a dialog box that enables the connections between the trigger input and outputs to be defined. For this example, I have connected:

PS to PL trigger: CPU Debug output to Fabric Trace Monitor (FTM) Inputs. This will assert triggers to all four cross-trigger signals in the PL when the CPU hits a breakpoint. PL to PS trigger: FTM outputs to CPU Debug input. This will stop the software application when any of the four PL FTM triggers asserts.

Both the Input and output triggers within the PL from the PS are connected to the ILA in this example. As such, we can use these triggers within the ILA to determine what action we wish to take.

We also must have a Vivado hardware manager open and connected to the ILAs within the device to successfully execute cross triggering along with SDK.

If we wish the software to trigger the ILA when code execution hits a breakpoint, we configure the ILA’s trigger mode to trigger from TRIG_IN_ONLY or BASIC/ADV_OR_TRIG_IN. Depending upon which is selected, the ILA will trigger if the external trigger occurs or if an ILA internal trigger occurs. Running the application software with a breakpoint defined will result in the ILA waveform being available for inspection when the breakpoint is reached.

Should we wish for a logic transaction in the PL to halt the software, we can use the ILA’s trigger output. The ILA can be configured to output a trigger when either a user-defined internal ILA trigger occurs (e.g. when a rising edge occurs) or when a value on a bus is detected, or to propagate the ILA’s input trigger to the output.

Setting the ILA to trigger when a software breakpoint is hit

Setting the ILA to stop software execution when the ILA triggers

This simple example allowed me to perform cross triggering in both directions, with ease.

Cross triggering is a useful technique that helps get to the bottom of troublesome PL/PS interaction issues and can also be of use when we wish to gather evidence for verification in critical applications.

You can find the example source code on GitHub.

Adam Taylor’s Web site is http://adiuvoengineering.com/.

If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.

First Year E Book here

First Year Hardback here.

Second Year E Book here

Second Year Hardback here