Yocto Enable SPI and I2C iMX6

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Yocto Enable SPI and I2C iMX6

2,967 次查看
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?

标签 (3)
标记 (5)
0 项奖励
回复
3 回复数

1,674 次查看
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 项奖励
回复

1,669 次查看
ceggers
Contributor V
Please look in you kernel sources under /arch/arm/boot/dts/imx6ul*
0 项奖励
回复

2,955 次查看
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 项奖励
回复