SPI example for Apalis i.MX8 / Ixora Carrier using VS Code Torizon IDE

Please help us with how to enable/access SPI for Apalis i.MX8 / Ixora Carrier using VS Code Torizon IDE.

Apalis i.MX8 WB IT v1.1A
Ixora v1.3A
Torizen OS
VS Code Torizon IDE

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! I’d be happy to guide you through enabling and accessing SPI on your Apalis i.MX8 with Torizon OS using the VS Code Torizon IDE.

Here are the steps you should follow:

1. Check If SPI Devices Are Enabled

First, open a terminal on your module (either via SSH or the Torizon VS Code extension). Run:

ls /dev/apalis-spi*

You should see something like /dev/apalis-spi1-cs0 or /dev/apalis-spi2-cs0. If you do, the SPI interfaces are enabled.

2. Enable SPI Devices if Not Already Present

If you do not see the SPI device nodes, you may need to enable them:

  • Make sure the device tree overlays for SPI are enabled in your device configuration. For Torizon OS, you can add overlays using the TorizonCore Builder tool or via the Torizon VS Code extension’s “Device Configuration” area.

  • Typical overlays are named like apalis-imx8_spidev.dtbo. You can refer to the SPI on Torizon instructions.

3. Make SPI Accessible Inside Your Container

If you want your VS Code Torizon IDE project (container) to access SPI:

  • In your .devcontainer/devcontainer.json, add the following section:
"runArgs": [
  "--device=/dev/apalis-spi1-cs0",
  "--device=/dev/apalis-spi2-cs0"
]

Or, adapt depending on which devices you need.

Tip: Always use the absolute device node (not symlink) to avoid read-only filesystem issues.

4. Test Access to SPI

You may now use Python, C, or another language in your container to open /dev/apalis-spi1-cs0 or /dev/apalis-spi2-cs0 for SPI communications.

5. Verify Permissions

Generally, containers started like above will have access. If needed, you might also need to add your application’s user to the spi group, or run as root (for quick tests).

References

If you need to unbind another driver or manually bind spidev, see the detailed instructions in the links above.

Let me know if you need further clarification on any step!

Best regards,
Toradex AI Assistant.

The file .devcontainer/devcontainer.json is not available in my workspace. Where do I find it.

Hi @kushal.dalsania

So have you checked these pages?


You can also find some samples in our samples github repository.


Is there something specific that you need help with?