Difficulty Accessing colibri-uart* from VS Code Torizon IDE Python 3 Template

Hello everyone,
I’m currently working on a project using the Torizon IDE in VS Code with the Python 3 template on a Colibri iMX7D device. My goal is to access UART ports (/dev/colibri-uartaX) directly from my Python code. When I SSH into the device and list /dev, I can see entries like colibri-uartaa, colibri-uartab, etc., but these entries are not visible within VS Code, making it challenging to configure and access UART ports from the IDE.

Could anyone advise on how to make these colibri-uart* entries visible in dev directory within VS Code or suggest an alternative approach to accessing UART ports from the Torizon IDE setup?

Any help or insights would be greatly appreciated. Thank you!

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?

:+1: :-1:


To address the challenge of accessing UART ports (/dev/colibri-uartaX) directly from your Python code within the Torizon IDE in VS Code, and specifically making these entries visible and configurable, follow these steps:

  1. Ensure Device Connection: Verify that your Colibri iMX7D device is properly connected to your development machine and that the Torizon IDE extension in VS Code successfully recognizes the device. This connection is crucial for direct interaction with the device’s file system and peripherals.

  2. Use the Torizon Extension: The Torizon VS Code extension provides a feature to interact with the device’s file system and peripherals, including UART ports. If the specific UART entries are not visible, it might be due to the extension not refreshing or properly accessing the device’s updated state.

  3. Manual Refresh: Try manually refreshing the devices list in the Torizon extension. This can sometimes prompt the extension to re-evaluate the connected hardware and its peripherals, potentially making the UART entries visible.

  4. Direct SSH Access: As a workaround, you can directly access the UART ports by SSH-ing into the device from VS Code’s integrated terminal. This method bypasses the need for the entries to be visible in the IDE’s device explorer. You can use standard Linux commands to interact with the UART ports once you’re SSH-ed into the device.

  5. Python Serial Library: Ensure you are using a suitable Python library for serial communication, such as pyserial. This library allows you to interact with serial ports in a straightforward manner from your Python code. You can specify the UART device path (/dev/colibri-uartaX) directly in your Python script to open and manage the serial connection.

  6. Permissions: Check the permissions of the UART devices. You might need to adjust the permissions or add your user to a group (typically dialout or tty) that has access to serial devices on the Linux system running on your Colibri iMX7D.

  7. Device Overlay Configuration: Ensure that the device tree overlays for enabling the UART ports are correctly applied. The TorizonCore platform allows you to configure hardware peripherals through device tree overlays, which might be necessary for your UART ports to be functional and visible.

If after following these steps, the UART entries are still not visible or accessible within the VS Code Torizon IDE, it might be a limitation or issue with the current version of the Torizon extension. In such cases, using direct SSH access and command-line tools can be

Please, also check if these links can help you solve your problem:

UART (Linux) | Toradex Developer Center.

Direct access to hardware from a container is usually forbidden. To configure the necessary permissions to access hardware devices and peripherals with Docker containers, please refer to this article.

I am working with the Torizon IDE and trying to run the readgps.py file provided in the Torizon samples on my Colibri iMX7D module. However, I am encountering an issue with accessing the “colibri-uartb” port. When I run the script, I get the following error:
Traceback (most recent call last):
File “/home/smartsys/torizon-samples/.venv/lib/python3.11/site-packages/serial/serialposix.py”, line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/colibri-uartb’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/smartsys/torizon-samples/gps/python/readgps.py”, line 10, in
ser = serial.Serial(serial_port,115200, 8, ‘N’, 1, timeout=1)
File “/home/smartsys/torizon-samples/.venv/lib/python3.11/site-packages/serial/serialutil.py”, line 244, in init
File “/home/smartsys/torizon-samples/.venv/lib/python3.11/site-packages/serial/serialposix.py”, line 325, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/colibri-uartb: [Errno 2] No such file or directory: ‘/dev/colibri-uartb’
I have verified that the device is connected properly. Can anyone guide me on how to properly configure or grant access to the “colibri-uartb” port so that I can successfully run the script?

Any help or pointers would be greatly appreciated!

Thank you!

Hi @trainyinfi,

Have you mapped rescpective uart to your application docker?
If not please modify docker-compose file in your project as below.

Best regards
Ritesh Kumar