Another SDK project converted and extended: a demo what XBAR is and how to use it
(I tried to get familiar with XBAR, features and looking for more features to support on my project).
What is XBAR?
XBAR is a programmable "cross-connect matrix", used to route signals from - to.
It is used, for instances, as:
- route an internal trigger/event signal to another trigger/event
- route an internal trigger/event signal to a pin as output:
Example: the demo shows how to setup a PIT (as 1 sec. interval timer) and to see the pulses generated every second on an output pin:
get out an internal signal on a pin - use an input pin (not really as a GPIO, but an external signal on a pad/pin) and route this to a trigger/event input:
you could do as: a GPIO pin starts a DMA
use input pin as internal trigger - Even possible:
route a GPIO pin as input to another as GPIO output:
The XBAR works like a "cross connect", a "wire" to connect two pins. Yes, it works, even it is a "stupid" idea (an external wire would do the same and does
not generate so much heat inside the chip). Yes, the chip can act like a "wire connect between two pins" (but just for pins which have an ALT function for ...XBAR_INOUTxx)
What does the demo project demonstrate?
- it sets up a PIT with 1 sec. period
- this generates a SW INT (see on Debug UART)
- this signal is also an output on J1, pin 5 (see the pulses with a scope there) - an option to set in source code
- it takes J1, pin 3 as an input and forwards it to J1, pin 5 as an output - see the same signal is "mirrored" - default, optional in source code
- it takes J1, pin 3 as an input and forwards it to generate an internal INT (instead of the PIT) - an option to set in source code
What you CANNOT do
It is NOT possible to reroute functional signals, let's say LPSPIx_SCLK, LPSPIx_SDI, to other pins, e.g. SCLK should come out somewhere else or
SDI should be taken from another pin - NOT possible.
This assignment is done by the IOMUX (with the ALT settings). It is not possible reroute such signals (done via ALT settings on IOMUX, not related to XBAR).
So, you cannot "monitor" internal signals from peripherals or bring out a peripheral signal on another pin (or in parallel, e.g. for debugging/monitoring).
What is it used for?
It is mainly related to route events/triggers, to generate such ones. A SPI DMA finished could be such an event/trigger, but not the SPI signals itself.
It is useful for:
- debugging: "was there an internal event/trigger generated?" (e.g. a DMA finished):
monitor internal events/triggers with a scope - synchronize internal logic with external one: e.g. a DMA completed could be an output pulse, to stay in sync with MCU,
or GPIO input starts a DMA... - as I understand: when it comes to use PWM signals - this XBAR block seems to be very important to use (to route PWM events as signals)
- use GPIO pins to kick off a DMA, trigger other internal signals
(GPIO INTs are possible with regular means, even it would be a second approach how to generate INTs from GPIO inputs)
The XBAR is a little bit for experts and for special features and needs.
Usually, there is no need to deal with the XBAR.
Project on GitHub
tjaekel/MaaxBoard-RT_xbara_cm7: MaaxBoard-RT using XBAR to route signals from/to pins (github.com)