SPI2 on Apalis TK1 under L4T

Hello,

I can successfully use SPI1 (/dev/spidev0.0) on Apalis TK1 under L4T. SPI1 signals are connected to X27 connector, where I put my SPI slave device.

I noticed, there are two more SPI devices on the module (let´s say SPI2 at /dev/spidev1.2 and SPI3 at /dev/spidev3.0). SPI2 should be accessible on cap. touch connector X24 on IXORA, where I would like to use it for other purposes.

But I cannot even open SPI2 or SPI3 port with simple code, which is working for SPI1.

little code here:

int fd_spi = open(“/dev/spidev0.0”, O_RDWR); //fd_spi gets positive value

int fd_spi = open(“/dev/spidev1.2”, O_RDWR); //fd_spi gets -1

int fd_spi = open(“/dev/spidev3.0”, O_RDWR); //fd_spi gets -1

So, are the SPI2 and SPI3 not usable I my HW/SW configuration, or am I missing something?

May be SPI2 could be blocked by working driver for K20 Companion MCU.

thank you for any advice

What exact hardware and software versions of things are you talking about?

According to the following article on our developer website spidev3.0 is what you want to be using.

Thank you for the article. Now I see, that spidev1.2 cannot be used.

As stated in Environment section, I am using Apalis TK1 with IXORA V1.1A carrier board.

I followed installation procedure a installed Jetpack 3.1 (ubuntu 14.04.5).

I wrote simple function to run SPI1 (spidev0.0), I can open a send some bytes. I can see it running by watching HW pins (SPI1_CLK pin = pin 221 on X1 connector of Apalis TK1).

But SPI2 (TK1 port name = SPI4C ) (spidev3.0) I cannot even open. Open function returns -1. SPI2 CLK pin is on pin 235 of X1 connector on TK1.

Originally I was only curious, if there is some incompatibility because of ubuntu/JetPack.

I will probably use just one SPI bus, because I get no luck with the second one.

thank you

Thank you for the article.

You are very welcome.

Now I see, that spidev1.2 cannot be used.

It can be used very well but it just connects to the on-module K20 companion MCU.

As stated in Environment section, I am using Apalis TK1 with IXORA V1.1A carrier board.

Nothing speaks against doing so. However, what exact hardware and software versions of things are you talking about?

I followed installation procedure a installed Jetpack 3.1 (ubuntu 14.04.5).

You mean this article?

BTW: You may now simply install JetPack using the Toradex Easy Installer.

I wrote simple function to run SPI1 (spidev0.0), I can open a send some bytes. I can see it running by watching HW pins (SPI1_CLK pin = pin 221 on X1 connector of Apalis TK1).

But SPI2 (TK1 port name = SPI4C ) (spidev3.0) I cannot even open. Open function returns -1. SPI2 CLK pin is on pin 235 of X1 connector on TK1.

For me, that works just fine. This using an Apalis TK1 V1.2A running BSP 2.8b3 with JetPack 3.1.

Originally I was only curious if there is some incompatibility because of ubuntu/JetPack.

Not that we are aware of.

I will probably use just one SPI bus, because I get no luck with the second one.

Both should really be working just fine.

I assume you did start your user space spidev application with proper root privileges (e.g. using sudo)?

thank you

You are very welcome.

Thank you. I get it working now.

For a long time, I am avoiding to use sudo every time, so I set my own rules in /etc/udev/rules.d/local.rules, where I had this:

ACTION==“add”, KERNEL==“spidev0.0”, MODE=“0666”
ACTION==“add”, KERNEL==“ttyTHS1”, MODE=“0666”

When I started to play with other SPI channels, I accidentally set rules for THS2 and THS3 instead of SPI2 and SPI3. But until now, I was rock solid convinced It was correct.

It was your remind about the privileges, which made me do this check, than turn pale and do easy fix.

So sorry for wasted time.

Thank you so much Marcel.

No problem, glad you figured it out.