Setting Up UART and Quectel Modem with Python on Colibri iMX7D Using VS Code and Docker

Hello everyone,

I am currently working on a project using a Colibri iMX7D module and I’m facing some challenges in setting up the environment to access UART ports and a Quectel modem using Python. Here is a summary of my setup and the issues I am encountering:


  • I am using VS Code with Torizon IDE.
  • I am working with a Python 3 template.
  • I am trying to access UART ports on the Colibri iMX7D.

Problem 1: Accessing UART Ports

  • I have attempted to run the script provided in the Torizon samples.
  • I ran the Docker command: docker run -it --rm --device=/dev/colibri-uartb gps
  • However, I received the following error:
    docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: “/usr/bin/”: permission denied: unknown.
    Problem 2: Adding Quectel Modem
  • In addition to accessing UART ports, I need to set up a Quectel modem.
  • I plan to implement the functionality for both UART and the modem using Python.
  1. Can someone guide me on how to properly set up my project in VS Code to access UART ports on the Colibri iMX7D?
  2. What steps should I follow to resolve the Docker error mentioned above?
  3. How can I set up the environment to integrate and communicate with a Quectel modem using Python?

Any detailed guidance, examples, or resources would be greatly appreciated. Thank you in advance for your help!

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 your challenges with setting up UART ports and integrating a Quectel modem on a Colibri iMX7D module using Python in VS Code with Torizon, let’s tackle your problems step by step.

Accessing UART Ports

  1. Project Setup in VS Code: Ensure your project is correctly set up for Python development with the Torizon IDE extension. This involves selecting the correct Python interpreter provided by the Torizon Docker image and configuring your devcontainer.json to include the necessary device permissions for UART access.

  2. Docker Command Issue: The error you encountered when running the docker run command suggests a permissions issue with the script. Ensure the script is executable by running chmod +x on your host machine before building your Docker image. Additionally, verify that your Dockerfile correctly copies the script into the container and sets the appropriate execution permissions.

Adding Quectel Modem

  1. Device Integration: To integrate the Quectel modem, first ensure that the modem is recognized by the Colibri iMX7D module at the hardware level. You can check this by accessing the module’s serial interface and using commands like lsusb or dmesg to verify the modem’s presence.

  2. Python Environment Setup: In your Docker container, you may need to install specific Python libraries or SDKs provided by Quectel for modem communication. Ensure these are included in your Dockerfile and accessible within your Python environment.

  3. Communication with Modem: For UART communication with the modem, you will likely use the pyserial library. Ensure you have correctly identified the UART port connected to the modem and configure pyserial to use this port. You may also need to configure specific AT commands for initializing and communicating with the modem, depending on your application’s requirements.

General Recommendations

  • Debugging Docker Permissions: If you continue to face permission issues with Docker, consider using the --privileged flag as a temporary measure to diagnose the problem. However, be cautious with this approach as it grants the container full access to the host devices, which might not be suitable for production environments.

  • Modem and UART Configuration: For both the UART and modem setup, ensure you are referring to the Colibri iMX7D datasheet and the Quectel modem’s documentation for the correct configuration parameters, including baud rate, data bits, stop bits, and parity settings.

  • **Testing and Validation

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

How to Use UART on Torizon OS | Toradex Developer Center.

Hi @trainyinfi,

Let me respond to Problem 2: Adding Quectel Modem first, we have not tested any python based modem manager. May be this is possible but this is something you need to take care.
We have modem manager and network manager to take care of setting up modem and we recommend same. Please check below article for more details:

For problem 1 accessing UART from docker container, we will need to check your docker-compose.yml and dockerfile.

Best regards
Ritesh Kumar