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

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.