Colbri T20 spi accessibility with spidev_test

Hello dear Toradex-Dev-Team,

I am currently facing a situation where I use a gcc compiled binary called “spidev_test -D /dev/spi3.0 -A”
to just evaluate the output to test the spi functionality.

When I apply the above spidev_test I encounter the following error:

can’t set spi mode: Inappropriate ioctl for device

The variable that I have assigned the output of “chk=$(spidev_test -D /dev/spi3.0 -A)” contains an empty string.

Searching for a solution on that point, I have found a lot of information around the topic spi online
which gives me the feeling to got lost in the variety of probabilities.

Hence I would ask you for help to the right direction where to start looking at?

Previously this test step which was inplemented in the testsystem worked with earlier programmed T20 modules.
Since the modules on side are borken now, I have the task to bring the testsystem to run again.
However there is no documentation on how my previous colleagues who has left the company have approached the configuration (in the device tree, kernel etc.) if any.

Colibri T20 512MB V1.2A
Colibri Carrier Board
Linux BSP 2.8.7

Hi Armin

I am looking into it. :+1:

Best Regards

1 Like

Hi Kevin,

I will wait for your answer :+1:t3:

Thank a lot

Hi @CoQuarksde ,

would it be possible that you send the binary you used ?

I will try to reproduce the issue.

Best Regards

Hi @CoQuarksde,

sure, the binary spidev_test attached:
spidev_test (13.5 KB) :four_leaf_clover:

Best Regards & Thank you

Hi @CoQuarksde,

Thank you for the binary. In the meantime I have some information for you.

We’ve seen this behaviour in the past if users used the third SPI interface instead of the default one. Would it be possible for you to use another SPI interface?

We created an internal issue for the behaviour with the third SPI interface.

Best Regards

Hi @kevin.tx,

thank you for your information regarding the SPI how they are available in the current image build.

As you mention with the default configuration of the SODIMM pins (86, 88, 90, 92) of the Colibri T20 based on the Toradex Colibri Compatibility Guide & the Colibri Evaluation Boars V3.2A Schematics (Page 19 >> Section B 1-2) these pins seem to be designed (Software / device tree) as CAN.

Now the Carrier Board eDM-CB-Colibri which Data Modul provides to be applied with the Toradex Colibri T20 modules together has the definition respectively specification of the mentioned pins to act as an SPI3 interface.

SODIMM Connector X16
Pin 86 → SSPFRM
Pin 88 → SSPSCLK
Pin 90 → SSPRXD
Pin 92 → SSPTXD

Now on my search to find the entries for these pins within the device tree on the installed Embedded Linux Colibri-T20_LXDE-Image_2.8b7.-20200610, I was not successful to detect any config files nor being sure where to embedd an own customed overlay for the SPI3 purpose?

Or some hints where I could approach changes within the running BSP 2.8b7 to declare sysfs to load a the SPI driver for the needed SPI3 interface?

I am not familiar yet in complete with the Toradex image to setup and bake a customized manufacturer image for the test system Data Modul has running in the field which is blocked at the moment because of this issue right now.

Therefore my very first request to Toradex would be to help me / Data Modul with an Embedded Linux Image (maybe 2.8.7.XXX) where the SPI3 is exposed at the listed pins.

May I ask you for your support in this regard, probably the internal issue that you have created aims exactly in this direction?

This is very important for Data Modul to flash the T20 modules to ensure that the test system runs again.

Many many Thanks in advance

Hello @CoQuarksde ,

You are already in the right direction with the pin definition and looking into Device tree for changes.
As explain in detail in this article, our our BSPs use the MCP2515 SPI CAN controller by default and hence one must disable it to use CAN. Have you already perhaps taken a look at the article? That would be a good starting point.

You can download the reference image from Toradex here . And still, as the default is CAN interface, you might have to disable it in the device tree in order to use CAN. Can you try these and let me know if it worked?

Best Regards,

1 Like

Hello @saijanani.tx , @kevin.tx ,

first of all thank you for your support.

I have now an image, build from the source codes (5.x.y Latest Poky based dunfell 3.1 LTS) available:

After compilation the following outputs resp. artifacts are given:

I have chosen the following zipped wic image to program the kernel and the device tree to the target Colibri T20:


Unpacking this package provides to me the following content:

Now relating to the article:

I have copied the zImage from the wic package to the colibri-t20_bin folder of the unpacked Colibri-T20_LXDE-Image_2.8.7 reference image from Toradex.

The folder in the reference image from Toradex is named colibri-t20_bin and not how it is described in the article colibri-t20.
So is that an issue why it is not working?

Why I have chosen to use the reference image from Toradex to replace its zImage is because there among other things the script which I can use to update / flash the target.

When I apply this procedure, described on the article above, the target does not boot the kernel indicating

Could not find a valid device tree

However to solve the missing device tree I followed the suggestion described in the next article:

It seems I am missing something here because my kernel does not boot to be able to modify / extend the overlay.txt within a running system.

Or do I have to just copy the overlay.txt and overlay folder from the wic image to the rootfs/boot/ folder of the Toradex reference image.
But in the rootfs/boot/ folder of the Toradex reference image there is a zImage with a symlink inside.

Why are there images with the same file size in /rootfs/boot folder and colibri-t20_bin folder of the Toradex reference image?
Which one is relevant to replace with that one from the wic image?
And do the overlays folder and overlay.txt belong also into the /rootfs/boot/ folder of the reference image of Toradex?

Would you recommend the procedure that I have decided for or is there another way that Toradex suggests?

The same question applies to the format (wic image) that I have picked up for the custom modifications?

In my disscussions with @kevin.tx we have considered a phone call to solve the spi topic.
I would like to ask you if Toradex could support me with a direct phone call in this regard please.

Best Regards & Thank you in advance

Hello @CoQuarksde ,

I happened to notice now that the Spidev_test file you may be using is not the correct Spidev test for Colibri T20.
I tested the spidev_test from here in my T20 and it works out-of-the-box without any changes needed, as the spi3.0 is enabled by default in the T20.

Could you try this and check if the SPI works now?

Best Regards,

Hello @CoQuarksde ,

So, as you can see from the link here, under Adjust the local.conf, you see T20 in the list of supported machine for only;y BSP 2.8, but not for BSP 5. So, the out-of-box procedure might not work right away for you thelatest BSP, which doesn’t support t20.

Could you also please explain why you have chosen to build a iMX6 image for T20. Because only images build for T20, will work on T20.

And I think , it is because of the above reasons that you see this error.

So, in short I would build my image following this link, specifically for T20 and then flash into the module like this. After this when you run the correct Spidev_test from here, it should work out-of-box.
I tested it myself and it works for me.

I hope my explanations help!

Best Regards,

1 Like

Hello @saijanani.tx ,

after consulting my colleauge who I am currently setting up a feasible plan for Data Modul’s Colibri Basebord Project, we have decided to just follow your recommendation with building a reference image.

In order to do that the Building a reference image was the first place we have started.

At the point of starting bitbake after the parsing of the source an error has occured which we could not solve even after trying to sourcing the GNU deb m4_1.4.18 dependency.

Since you offered to me in our friendly phone call of today to contact you with the details we could face,
the following would be the output of our build progress:

Compile_error.txt (6.4 KB)

Any idea straight away how to solve this dependency Mrs. Janani?

BR & Thank you

Hello @CoQuarksde ,

Seems like a GNU issue with pending updates. But I found this thread that might be helpful to you .

I would try the patch and method suggested here as a workaround.
In your issue here persists, I would suggest to kindly open up an other thread to confine this thread to just discuss about the SPI issue :slight_smile:

Best Regards,

1 Like

Hello @saijanani.tx ,

I just started a build with ubuntu 18.04 which is meant to support (link) the version of m4-native in order to build the Toradex reference image 2.8b7.
Just to be able to have an image quickly available.

The procsess passed the point of m4-native build, so it looks good for now :wink:

I will keep you updated, also with the config of the spi3 interface as for the usage of the Data Modul Colibri base board.

Thank you very much

Hello @CoQuarksde

Thank you for your update. Sounds good :+1: :smiley:


1 Like

Hello @saijanani.tx , @kevin.tx ,

so here I am back with some progresses.

I was now able to build an image with the Toradex reference sources based on the BSP 2.8b8.

After flashing the targets NAND, the Colibri NVIDIA tegra T20 is booting into Linux.

At this point I have not applied any changes to the spi3 config to firsty ensure a proper image build.

Now going into the initial issue context having the spi3 cusomized for our carrier board and running,
I would consider two options as possible workarounds:

  1. Updating the Kernel to be able then to configure / mux the spi3 node within the device tree
    (this seems not to be available with the current Kernel 3.1.10 which is build with BSP 2.8b8)

    Where could I find the KERNEL_VERSION entry that I would reference to a newer Kernel than the 3.1.10?
    Which additional steps would also be neccessary going with this option, if possible at all with the Colibri NVIDIA tegra T20 and BSP 2.8b8?

  2. With the usage of the Kernel 3.1.10 I have searched for the Kernel Config source file(s) in order to apply the needed changes to SPI3.
    Would you please provide to me some hints which sources would be essential to make the chages in:

    • CAN disable (if needed)
    • SPI3 pin muxing and other needed changes / steps

I did not find any information to this procedure neither in the Toradex articles nor in the Developer Community.

Would be very thankful for your support

Hello @CoQuarksde ,

So glad to hear the progress that you made. Quick question though, did the SPI3 not work out-of-the-box for you?
Because when I run the spidev_test from here, it worked for me.

Best regards,

Hello @saijanani.tx ,


I have run the spidev_test which is compiled available to me, that did not work.

To be honest I do not know how to cross coompile the spidev_test.c version that might solve the issue.
To be more precise where the /path/to/cross-kernel/include is?
Of course I would like to try out your idea even though for me it seems really that the pins have to be reconfigured:

This screenshot is from the colibri_compatiblitiy_guide.xlsx which I got obtained from Toradex:

The marked row is the Primary (default) configuration, fitting for Toradex Evalboard V3.X.
colibri_compatibility_guide.xlsx (331.2 KB)

My approach is really to have a customized image on the basis of Toradex reference sources,
to be more flexible in using Toradex modules in combination to partner products.

However the article recommended from your side does not cover the given source structure.
I have been even following the ralated T20 section.
The kernel 3.1.10 seems to be different managed, some backports to be maintained meanwhile.

So I really need your help regarding the spi3 config for our Data Modul carrier board which we use with the Colibri T20 from Toradex dear Mrs. Janani.

BR & Thanks

Hello @CoQuarksde ,

Thank you for your message.

In order to understand how the SPI is configured please have a look in here. You can patch your changes here, as per your application. In short, for all kinds of source changes to Tegra, you would have to be looking into this

I will also attach some Community threads discussing diff patches made to the T20 so that you get an idea of how it is done.

  1. Colibri T20 SPI
  2. UART
  3. Compiling Kernel Step-by-step

I hope this helps. But do not hesitate to contact us, in case if something is still unclear.

All the best !

Best Regards,

Hello @saijanani.tx ,

thanks for the articles that you have provided to me.

To change the SODIMM pins (86, 88, 90, 92) configuration of the tegra T20 module for straight use of SPI we would have to change many configs in the source file(s) where I honestly am not familiar or even brave enough to touch in the Kernel environment 3.1.10.

Which options do I have to work with a newer Kernel (independent the version number) in combination with the NVIDIA tegra T20 which supports the device tree structure to customize for different projects?
Is there a newer Kernel supported from Toradex suitable for T20?

BR & Thank you