Yocto Enable SPI and I2C iMX6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Yocto Enable SPI and I2C iMX6

2,275 Views
MichaelBMiner
Contributor IV

Hello,

I am build a Linux image using Yocto. I will need to use CAN, SPI and I2C on my device. Using the commands 

 

 

bitbake -c menuconfig virtual/kernel 

 

 

and

 

 

bitbake -c menuconfig busybox

 

 

I have enabled the peripherals. In /usr/sbin I can see I2C commands just as i2cdetect and i2cdump. In /usr/bin I can see CAN commands like cansend or candump. 

The CAN interface works well, there was no additional setup required. I started an eclipse project and just went on. I assume it will be the same with I2C. It seems the bitbake process adds CAN and I2C to the device tree. 

When it comes to SPI I do not see any SPI commands and I believe I need to setup a custom device tree. My question is, do I need a custom device tree? Can I do all of the initialization in my C code without editing my Yocto build further?

 

Edit: Looking through my folders I found some dts files. One is attached. There are many references to SPI. I assume this means it is enabled? Do I need to do anything else?

Labels (3)
Tags (5)
0 Kudos
3 Replies

982 Views
davehitchman1
Contributor I

Can you give a little more insight? Thats not really very helpful to me, where in the 'device tree' is this? Where do I find the files, how do I override this in a recipe - not just a board specific dts but a file name and directory path example would help.

 

0 Kudos

977 Views
ceggers
Contributor V
Please look in you kernel sources under /arch/arm/boot/dts/imx6ul*
0 Kudos

2,263 Views
ceggers
Contributor V
ecspi1: spi@2008000 {
     ...
     status = "disabled";
    };

 In your device tree, all ECSPI peripherals are disabled. You have to set status = "okay" in order to use them. The only way to do this is in a custom dts file. But you don't have to copy everything. You can include an existing file in your board specific dts and override individual properties (like the status).

0 Kudos