How are PRU GPIO signals different from regular GPIOs?#
TI’s PRU is designed for ultra-low-latency and perfectly deterministic GPIO reads & writes.
This page explains high-level concepts about PRU GPIO. For further technical details, refer to PRU GPIO.
PRU GPIO connection#
The PRU has thirty two 32-bit registers inside the core, like many other CPU cores. However, two of these registers are dedicated for general purpose input/output (GPIO) functionality. Register R30 is directly connected to up to 20 general purpose output (GPO) signals. GPO signals are toggled by writing to the register. Register R31 is directly connected to up to 20 general purpose input (GPI) signals. GPI signals are read by reading the register.
Because these registers are mapped directly to the IO, PRU GPIO access occurs in a single clock cycle, without involving any Network on Chip (NoC) circuitry or a peripheral bus. This enables zero-jitter GPIO control and perfectly deterministic timing, which is critical for waveform generation, handshake protocols, and closed-loop control.
GPIO connection for non-PRU cores#
Traditional MCU cores without flexible external logic use software to interact with GPIO pins. However, CPU cores like an Arm Cortex M or RISC-V have fundamental limitations when manipulating GPIO pins:
No direct connection to the GPIOs: Chip infrastructure like a Network On Chip (NOC) exists between the CPU cores and the GPIO pins
Pipelined execution: The CPU core may have a pipeline
These and other factors mean that compared to an FPGA or a PRU, a standard MCU core has increased latency and lower determinism (that is, higher signal jitter) when interacting with a GPIO.
Examples#
Let’s look at two common usecases for a custom interface:
Output a precise waveform
Acknowledge an external request
Non-PRU core#
In order to output a specific waveform, software performs back to back writes to create the desired pattern on the SOC pins. The pattern is written from the CPU’s internal registers, through the NOC infrastructure, to reach the GPIO. The NOC can add tens to hundreds of nanoseconds of latency and jitter to the GPIO write commands. As a result, the system may not meet the external peripheral’s timing requirements for the output signal duty cycle, the time between high and low signal transitions, etc.
In a “request and acknowledge” usecase, an external peripheral sends a message to the SoC. The CPU must read the input from the GPIO. After a specific input is detected, the CPU must write output data to the GPIO. CPU read / write interactions have twice the latency, because of the round trip delay to read the input from the GPIO, process the input, and then write an output back to the GPIO.
Cores running nondeterministic OSes (such as Linux or RT Linux) have additional signal jitter due to software initiating reads and writes at varying times.
PRU core#
Since there is no NOC circuitry between the registers and the pins, signal latency from the core to the processor pins is dramatically reduced. Output signal jitter due to the signal path is 100% removed. This allows the PRU to give best in class performance for jitter and latency without losing flexibility.
Input signal performance is improved as well. The PRU has commands to stall the program until a GPI event occurs. This gives best case latency to produce an output response after observing a trigger on an input. The PRU has ultra-fast response times because the GPI/GPO are embedded within the PRU. Timing relationships between signal inputs & outputs, multiple input signals, or multiple output signals are all perfectly deterministic.
Finally, PRU firmware is 100% deterministic. PRU code can be written to execute a read or a write on exactly the same clock cycle, every single time.