I’m creating my own carrier board. And I’m at the point were I’m using the Pinout designer.
Once I verify my pins how do I control the pin mux with torizon os. In general I need a lot of GPIO, and I’m removing feature I don’t need like CAN, PWM, SD etc. Is there a mechanism with in Torizon OS to control the GPIO mux’s?
Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello,
When designing your own carrier board and using the Pinout Designer for Toradex modules, controlling pin multiplexing (muxing) under TorizonCore involves a few steps. TorizonCore, being a Linux-based OS, provides several mechanisms to control GPIOs and pin muxing, primarily through device tree overlays and the sysfs/gpiochip interface for runtime GPIO control.
-
Device Tree Overlays: To configure pin mux settings that are applied at boot time, you’ll likely need to create or modify device tree overlays. Device tree overlays allow you to specify the configuration of various hardware interfaces and GPIO pins without altering the main device tree. This is particularly useful for enabling, disabling, or reconfiguring interfaces like CAN, PWM, SD, etc., as per your requirements.
-
Sysfs/gpiochip Interface: For runtime control of GPIOs, Linux exposes GPIOs through the sysfs interface, allowing user space applications to control GPIO direction (input/output), value (high/low), and sometimes pull-up/pull-down settings. However, with the introduction of the new GPIO character device interface in recent Linux kernels, it’s recommended to use the newer interface (
/dev/gpiochipN
) for managing GPIOs at runtime. This interface is more robust and provides better features compared to sysfs. -
Libgpiod: As part of managing GPIOs at runtime, you might consider using
libgpiod
, a C library and set of tools for interacting with the GPIO character device. It provides a more straightforward API for GPIO manipulation in user space, replacing the older direct sysfs usage. -
TorizonCore Builder: To integrate your device tree changes or overlays with TorizonCore, you can use the TorizonCore Builder tool. It allows you to customize the TorizonCore image, including adding or modifying device tree overlays, without the need for a complete Yocto build environment. This tool simplifies the process of customizing the OS to match your hardware design.
Remember, when removing features like CAN, PWM, SD, etc., ensure that the corresponding drivers or kernel modules are either disabled or not included in your final TorizonCore image to save resources and potentially reduce boot time.
For specific GPIO muxing settings, refer to the processor’s datasheet and the reference manual to understand the multiplexing options available for each pin. This information is crucial when creating or modifying device tree overlays to match your hardware configuration.
Best regards,
Toradex AI Assistant
Please, also check if these links can help you solve your problem:
High performance, low power Embedded Computing Systems | Toradex Developer Center.
Hey @jeffbelz,
This is done by modifications in the the device tree or writing a device tree overlay to implement the changes you want.
I would review this page on Pin Multiplexing. It gives good guidance on the steps needed.
I would look at pages 26 and 27 on the Verdin IMX8mp datasheet, the SoC Functions List. this will tell you the alternative functions each pin can do.
-Eric