I’m trying to setup the SPI bus on Colibri Evaluation Board v3.2B. I was assuming the SPI was enabled by default but I don’t see the module under /dev/
Can someone tell me how to go about getting the SPI enabled if its not already - and if it is where is it listed?
it looks like the default configuration for the eval board is the SPI is configured to MC2515 CAN bus
do i need to update the device tree to remove this?
In order to activate SPI, you need to apply the
colibri-imx8x-eval_spidev_overlay.dtbo overlay which is already inside your module. This overlay will disable MC2515 and activate SPI:
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
* Copyright 2020-2021 Toradex
// SPI generic spidev device for Colibri iMX8X.
compatible = "toradex,colibri-imx8x-eval-v3";
status = "okay";
status = "disabled";
status = "okay";
Here are our articles about device tree overlays:
Happy to help!
hey thanks for reply…and i had already remembered that. Sorry.
but i’m still having issues - do you guys know anything about using the
libraries in C# to control SPI - running into exceptions when trying to write to the SPI device
What exact errors are you seeing?
here are some console messages that i am printing out that includes settings and also the exception i’m getting when trying to write to SPI…also i notice on the scope that my CS line is not going low
i’m using the SSP pins on X11-A connector
Spi ClockFrequency = 400000
Spi ChipSelectLine = 0
Spi DataBitLength = 16
Spi BusId = 0
Spi ChipSelectLineActiveState = Low
Spi DataFlow = MsbFirst
Spi Mode = Mode0
SpiDevice write byte error: System.IO.IOException: Error 22 performing SPI data transfer.
at System.Device.Spi.UnixSpiDevice.Transfer (System.Byte* writeBufferPtr, System.Byte* readBufferPtr, System.Int32 buffersLength) [0x00080] in :0
at System.Device.Spi.UnixSpiDevice.Write (System.ReadOnlySpan`1[T] buffer) [0x0008f] in :0
at UIC_Winform.GPIO.GpioManager.ConfigureSpi () [0x001a8] in :0
The best practice would be to check if SPI is working first and then try your code. The kernel already provides some examples of how to run SPI, please check this guide: SPI (Linux) | Toradex Developer Center.
Let me know if you need anything else.
yeah my SPI is working…i figured out i had to use a different “Write” method from the library…now i can see on my scope the CS, MOSI, and CLK behaving normally. The only problem i have now is my MISO signal is “distorted” and rather noisy - doesn’t swing cleanly from 0 to 3.3V…so working through that now
Great it is working now. Feel free to ask any questions that you might have.