Assistance Needed for Connecting Verdin iMX8MP Device in VS Code and Developing Test Application

Dear Toradex Support Team,

I am currently using a Verdin iMX8MP device and have completed the display connection test and successfully set the IP address. However, when I connect the display, the device only shows the Torizon OS logo, after which the screen goes black with no further progression.

To proceed, I need to create a basic test application. I am using Visual Studio Code with the Torizon extension but am encountering issues in adding the device to VS Code. As a result, I am unable to connect the device to begin writing code for the test application.

Could you please guide me on how to:

  1. Properly add my Verdin iMX8MP device in Visual Studio Code?
  2. Write and deploy a basic test application for the device?
  3. View the output of the test application on the device’s display?

Thank you in advance for your assistance.

Best regards,
Ravi Vanand

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Dear Ravi Vanand,

Thank you for reaching out. Let’s address your concerns step-by-step:

1. Properly Add Your Verdin iMX8MP Device in Visual Studio Code

To add your Verdin iMX8MP device in Visual Studio Code using the Torizon extension, follow these steps:

  1. Ensure Prerequisites: Make sure your device is connected to the same network as your development machine and that you have the Torizon extension installed in Visual Studio Code.

  2. Scan Your Network:

    • Open Visual Studio Code.
    • Go to the Torizon extension panel.
    • Click on the “Devices” tab.
    • Click on the “Scan for Devices” button. This will scan your local network for Torizon devices.
  3. Manually Add Device:

    • If your device is not detected automatically, you can manually add it.
    • Click the “+” icon in the “Devices” tab.
    • Enter the IP address of your Verdin iMX8MP device. If you do not know the IP address, you can find it by scanning your local network.
  4. Set Device as Default:

    • Once your device is added, right-click on it and select “Set as Default Device”. This will configure your project’s settings.json file to use this device for deployment and debugging.

2. Write and Deploy a Basic Test Application for the Device

To create and deploy a basic test application, follow these steps:

  1. Create a New Project:

    • Open Visual Studio Code.
    • Go to the Torizon extension panel.
    • Click on “Create New Project”.
    • Select the .NET 6 C# Console Application template (or any other template you prefer).
  2. Install .NET SDK:

    • When prompted, click “Yes” to check for dependencies.
    • Confirm the installation and enter your sudo password if required.
  3. Write Your Application:

    • Open the Program.cs file in your project.

    • Write your test application code. For example, you can use the following code to toggle a GPIO pin:

      using System;
      using System.Device.Gpio;
      
      class Program
      {
          static void Main(string[] args)
          {
              int pin = 18; // GPIO pin number
              using (GpioController controller = new GpioController())
              {
                  controller.OpenPin(pin, PinMode.Output);
                  while (true)
                  {
                      controller.Write(pin, PinValue.High);
                      System.Threading.Thread.Sleep(1000);
                      controller.Write(pin, PinValue.Low);
                      System.Threading.Thread.Sleep(1000);
                  }
              }
          }
      }
      
  4. Deploy and Debug:

    • Click on the “Deploy and Debug” button in the Torizon extension panel.
    • This will build your application, create a Docker container, and deploy it to your Verdin iMX8MP device.

3. View the Output of the Test Application on the Device’s Display

To view the output of your test application on the device’s display:

  1. Ensure Display Configuration:

    • Make sure your display is properly connected and configured.
    • If the display only shows the Torizon OS logo and then goes black, there might be an issue with the display configuration. You can check the display settings in the TorizonCore configuration files.
  2. Run the Application:

    • Once the application is deployed, it should run automatically.
    • If your application outputs to the console, you can view the logs in Visual Studio Code’s terminal or the Torizon extension’s output panel.
  3. Debugging:

    • If you encounter issues, you can use the debugging features in Visual Studio Code to set breakpoints and inspect variables.

If you need further assistance, please refer to the detailed documentation and videos available on the Toradex website or reach out to our support team.

Best regards,
[Your Name]
Toradex Support Team

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

Can't seem to add additional files to VS code to get them to compile in Torizon container.

By following the above steps I have still facing the problem of add device in VS code. I was try with ‘+’ icon also but whenever I was click on ‘+’ icon no process is run

Hi @Ravi1

You also asked the same question by email. We can answer faster on community, so I’m going to answer here.

Which Torizon OS version are you using, how did you install it?
Are you following the Quickstart tutorial?

Some OS versions don’t have any app running, so it is expected to not show anything.

About the VSCode extension.

Are you on windows or linux?
Are you following this tutorial?

Hello @allan.tx ,
i Have Following Quick start guide from that using Easy Installer and Tight VNC I have install Torizon OS than Set Static IP to board but now i want to create basic application but i am not able to add my device in VS code

@Ravi1

ok, but you know which version of Torizon OS are you using?

can you run connect to the device with ssh? you can find the device information with:

sudo tdx-info

@allan.tx
Bootloader: U-Boot
Kernel version: 5.15.148-6.7.0-devel+git.8c5c2dcbf6ba #1-TorizonCore SMP PREEMPT Wed Aug 21 06:38:22 UTC 2024
Kernel command line: root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/ace22d76c2ae8ec7bd113140f6f8cf2db721ecba378b6d3523075386ccdbda50/0
Distro name: NAME=“TorizonCore”
Distro version: VERSION_ID=6.7.0-devel-20240821064044-build.0
Distro variant: VARIANT=“Docker”
Hostname: verdin-imx8mp-15132884

Hardware info

HW model: Toradex Verdin iMX8M Plus WB on ATDM Board
Toradex version: 0058 V1.1A
Serial number: 15132884
Processor arch: aarch64

@allan.tx
I am still waiting for your answer can you help me regarding how can i add my device in Visual studio

Hi @Ravi1

It would be faster if you could give me the full details of your setup and which steps you did take.

Also, we have this new installer for windows users that maybe you could try.

@allan.tx

I am Working on Windows

@allan.tx

While I am Installing Torizon IDE it will install but after that it will Show Error While I have Install WSL2. The Error will be mentioned in Screenshot

@allan.tx

My Windows system configuration is Windows 10 Pro and Version is 22H2 and hardware I am Using Verdin IMX8MP

Hi @Ravi1

I think this may be due to a conflict with the previous installation.

Could you try to clean the WSL install environment.
On the VS Code Window

  1. Press F1
  2. Copy the command Torizon: Uninstall and Clean Torizon for WSL
  3. Press Enter

Then you can try to install it again.

@allan.tx ,

Hi good morning @allan.tx I have tried the command for uninstall and clean that given by you. but it will shows the same error that I mentioned in above message

Hi @Ravi1

Can you try

  1. run this and confirm that you have version 2 and that it is updated,
    please attach the output of this command.
wsl --status
  1. run this and confirm if you have a installed distro in WSL,
    please attach the output of this command.
wsl --list

If the installation is correct, you should be able to connect to WSL.

  1. Press F1

@allan.tx ,
If I have Run the Command wsl --status and wsl --list than it will show op that I will share ScreenShot
PowerShell
and after that i have open the visual studio code and press F1 than

@allan.tx

I Have create sample application in qt C++ but i am facing the error
[main] Building folder: /home/RaviVanand/Sample/build all

[build] Starting build

[proc] Executing command: /usr/bin/cmake --build /home/RaviVanand/Sample/build --config Debug --target all -j 6 –

[build] [ 4%] Generating Sample/QML/main.qml

[build] [ 8%] Running qmlimportscanner for Sample

[build] [ 13%] Generating Sample/QML/assets/torizon-logo.png

[build] [ 17%] Generating Sample/QML/Scene.ui.qml

[build] [ 17%] Built target Sample_tooling

[build] [ 17%] Built target Sample_qmlimportscan

[build] [ 21%] Generating .rcc/qmlcache/Sample_qmlcache_loader.cpp

[build] [ 26%] Automatic MOC for target Sample

[build] [ 26%] Built target Sample_autogen

[build] [ 30%] Running AUTOMOC file extraction for target Sample

[build] [ 30%] Built target Sample_automoc_json_extraction

[build] [ 34%] Running moc --collect-json for target Sample

[build] [ 43%] Running rcc for resource qmake_Sample

[build] [ 43%] Running rcc for resource Sample_raw_qml_0

[build] [ 47%] Automatic QML type registration for target Sample

[build] [ 56%] Generating .rcc/qmlcache/Sample_QML/main_qml.cpp

[build] [ 56%] Generating .rcc/qmlcache/Sample_QML/Scene.ui_qml.cpp

[build] [ 60%] Building CXX object CMakeFiles/Sample.dir/sample_qmltyperegistrations.cpp.o

[build] [ 65%] Building CXX object CMakeFiles/Sample.dir/build/.rcc/qrc_qmake_Sample.cpp.o

[build] [ 69%] Building CXX object CMakeFiles/Sample.dir/main.cpp.o

[build] [ 73%] Building CXX object CMakeFiles/Sample.dir/Sample_autogen/mocs_compilation.cpp.o

[build] [ 78%] Building CXX object CMakeFiles/Sample.dir/build/.rcc/qmlcache/Sample_qmlcache_loader.cpp.o

[build] /home/RaviVanand/Sample/main.cpp:1:10: fatal error: QApplication: No such file or directory

[build] 1 | #include // Use QApplication for Qt Widgets applications

[build] | ^~~~~~~~~~~~~~

[build] compilation terminated.

[build] gmake[2]: *** [CMakeFiles/Sample.dir/build.make:158: CMakeFiles/Sample.dir/main.cpp.o] Error 1

[build] gmake[2]: *** Waiting for unfinished jobs…

[build] [ 82%] Building CXX object CMakeFiles/Sample.dir/build/.rcc/qmlcache/Sample_QML/main_qml.cpp.o

[build] gmake[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/Sample.dir/all] Error 2

[build] gmake: *** [Makefile:91: all] Error 2

[proc] The command: /usr/bin/cmake --build /home/RaviVanand/Sample/build --config Debug --target all -j 6 – exited with code: 2

[driver] Build completed: 00:00:02.873

[build] Build finished with exit code 2

[cpptools] The build configurations generated do not contain the active build configuration. Using “” for CMAKE_BUILD_TYPE instead of “Debug” to ensure that IntelliSense configurations can be found
so How can I resolve above error because i have no idea how to tackle it

Hi @Ravi1

Please check this tutorial from Microsoft on how to enable the Virtual Machine Platform for Windows