Issue with SPI and MCP251x CAN Controller on Colibri iMX7D, Seeking Guidance for ADS8866 ADC Integration and Visual Studio IDE Setup

Hello everyone,

I’m encountering challenges with setting up SPI communication with an MCP251x CAN controller on a Colibri iMX7D device, integrating an ADS8866 ADC chip, and configuring this setup in Visual Studio IDE using Python Console template. Here’s a detailed summary of the issue and steps taken so far:
Problem Description:
MCP251x CAN Controller:Attempting to initialize the SPI (spi2.0) over MCP251x CAN controller results in errors:
[ 11.291036] mcp251x spi2.0: MCP251x didn’t enter in conf mode after reset
[ 11.316212] mcp251x spi2.0: Probe failed, err=110
[ 11.320955] mcp251x: probe of spi2.0 failed with error -110

ADS8866 ADC Chip:Additionally, I need guidance on integrating and communicating with the ADS8866 ADC chip over SPI to read ADC data using Python.

  1. seeking advice or suggestions on integrating and communicating with the ADS8866 ADC chip over SPI using Python.
    Looking for guidance on configuring this setup in Visual Studio IDE using Python Console template to create a visual representation (image) of the operation.
    Any assistance, insights, or references to relevant documentation would be greatly appreciated. Thank you for your support!

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,

For the issues you’re encountering with the MCP251x CAN controller on the Colibri iMX7D, it appears the device is not properly entering configuration mode, which is a common initialization problem. This could be due to several factors including incorrect device tree configuration, SPI bus issues, or power supply problems to the MCP251x. Here are some steps to troubleshoot and resolve the issue:

  1. Device Tree Configuration: Ensure that the device tree properly configures the SPI bus (spi2) and the MCP251x CAN controller. Verify that the correct SPI bus is being used and that the chip select, interrupt line, and other necessary properties are correctly defined. For the Colibri iMX7D, you’ll need to modify the device tree to enable the SPI interface and define the MCP251x settings correctly.

  2. SPI Communication: Test the SPI communication independently of the MCP251x to ensure that the SPI bus is functioning correctly. You can use tools like spidev_test to verify basic SPI communication.

  3. Power and Hardware Connections: Double-check the hardware connections, including power supply to the MCP251x, grounding, and SPI connections (MOSI, MISO, SCK, CS). Ensure that the MCP251x is powered correctly and that all connections are secure.

For integrating and communicating with the ADS8866 ADC chip over SPI using Python, you can follow these general steps:

  1. SPI Interface: Make sure the SPI interface for the ADS8866 is enabled in the device tree and accessible through the Linux SPI subsystem. You’ll likely need to create or modify a device tree entry for the ADS8866 similar to what you’ve done for the MCP251x.

  2. Python SPI Access: Use the spidev Python module to communicate with the ADS8866. The spidev module allows you to open the SPI device, configure its settings (like speed and mode), and perform read/write operations. Here’s a basic example of how to read data from an SPI device in Python:

import spidev
import time

spi = spidev.SpiDev()
spi.open(2, 0)  # Open SPI bus 2, device 0 (e.g., spi2.0)
spi.max_speed_hz = 1000000  # Set SPI speed
spi.mode = 0  # SPI mode

try:
    # Read data (example command, adjust according to ADS8866 datasheet
		

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

https://developer.toradex.com/linux-bsp/application-development/peripheral-access/can-linux.

want to disables the mcp251x driver and enables the spidev driver on SPI bus 2.

Hi @trainyinfi ,
It would be better if you could split the questions into three parts and create three different post.

  1. SPI, CAN and MCP251x
  2. ADC
  3. Visual Studio IDE setup.

Also requesting you to use your company email so that we can provide you better support