SPI issue on IMX8M

I’m facing a problem with SPI communication on an IMX8M. When running the spidev_test command, it doesn’t receive any data (RX). The SPI mode, bits per word, and speed are configured correctly. Here is the output:
root@imx8mminvsom:~# spidev_test -D /dev/spidev1.0 -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |…@…|
RX | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |…|

Even when nothing is connected on ixm8m it receives RX | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF.

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:


Hello,

When you’re experiencing issues with SPI communication on an IMX8M, especially when the spidev_test command shows no data being received (RX), despite the transmission (TX) appearing to work, there are several steps you can take to diagnose and potentially resolve the issue:

  1. Check Connections: Ensure that all physical connections to the SPI device are secure. This includes checking the MOSI, MISO, SCK, and CS lines for proper contact and absence of physical damage.

  2. Verify SPI Device Configuration: Double-check that the SPI device you are trying to communicate with is configured to operate in the same SPI mode, bits per word, and speed as specified in your spidev_test command. Mismatches in configuration can lead to communication failures.

  3. Loopback Test: Perform a loopback test by connecting the MOSI and MISO pins together on the IMX8M board. Running the spidev_test in this setup should result in the TX data being echoed back as RX data. If this test fails, it could indicate a problem with the SPI driver or hardware setup.

  4. Check Device Tree Configuration: Ensure that the SPI interface is correctly configured in the device tree. This includes verifying that the correct SPI port is enabled and that the pins are correctly assigned to their SPI functions. Incorrect device tree configurations can prevent SPI communications from functioning correctly.

  5. Review SPI Driver and Kernel Logs: Check the kernel logs for any messages related to SPI. Use the dmesg command to review the logs for any errors or warnings that could indicate what might be going wrong with the SPI communication.

  6. Software Configuration: Ensure that the SPI kernel module (spidev) is loaded and that the /dev/spidev1.0 device file exists and has the correct permissions. You can use lsmod to check if the module is loaded and ls -l /dev/spidev1.0 to verify the device file’s existence and permissions.

  7. External SPI Device Check: If you’re communicating with an external SPI device, ensure that the device is powered on and correctly initialized to communicate. Some devices require specific initialization sequences before they can communicate over SPI.

  8. Interference and Signal Integrity: Check for any potential sources of electrical interference that could be affecting the SPI signals. Also, ensure that the SPI signal lines are not too long, as this can degrade signal integrity and lead to communication issues.

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

How to use SPI on Torizon | Toradex Developer Center.

Thanks for your reply!.
I have checked all of the above and it is correct but I am still facing same issue.

Dear @Mahtabazam,

Welcome to our community!
From your initial message I could gather that you are using a non-Toradex module for your setup. Is that correct?
If this is the case we unfortunately do not have insight into the product you are using.
I can however provide this developer webpage for Toradex modules, which shows the handling on our modules. Potentially you could also acquire further information here.

Best regards
Collin