Apalis iMX8 SPI can't open device

Hi,
My hardware: Apalis iMX8 on Ixora Carrier Board.
OS: TorizonCore with Evaluation containers - via Easy Installer

From SSH:

torizon@apalis-imx8-07029330:~$ ls /dev |grep spidev
spidev0.0
spidev1.0

From Visual Code, Toradex: Create new C/C++ application, I copy paste the spidev from: spidev_test.c « spi « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
I point: device = “/dev/spidev0.0”;

From debug:

fd = open(device, O_RDWR);
if (fd < 0)
pabort(“can’t open device”);
It always returns fd = -1

Please advise!

Hi @ducnn ,

I assume you’re following our article on how to use SPI on TorizonCore: How to use SPI on Torizon | Toradex Developer Center

And it looks like you’ve added /dev/spidev0.0 in devices in our extension configuration options.

Did you add the appargs custom property as instructed by the article? You have to add it by clicking on the ‘+’ icon on the right of Custom Properties (user defined).

Your configuration options should be similar to this:

spi_test_config

Note that I’ve used an Apalis iMX6, but the highlighted options should be identical for your case.

Try running the test code after this and let me know if it helps you.

Best regards,
Lucas Akira

Great. Yes it works!
I did not follow this article as I never see that before. I will share it with my colleague.
Thank you.

Glad I was able to help!

Best regards,
Lucas Akira