Hi,
currently i'm using the Beaglebone (AM335x) Rev A3 with Arago image, how to enable and control the SPI 1 module from user space?
Thanks in advance.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
enable spidev in the kernel (remember the make in the sdk uses /arch/arm/configs/tisdk_am335x-evm-defconfig when built in the sdk root) and modify linuxkernelpsp/arch/arm/mach-omap2/board-am335xevm.c:
search for vm_dev_cfg beaglebone_dev_cfg and add {spi1_init, DEV_ON_BASEBOARD, PROFILE_ALL}, to the struct.
search for spi_board_info am335x_spi1_slave_info and replace the default "m25p80" protocol manager, have it point to spidev instead.
static struct spi_board_info am335x_spi1_slave_info[] = {
{
.modalias = "spidev",
.platform_data = &am335x_spi_flash,
.irq = -1,
.max_speed_hz = 10000000,
.bus_num = 2,
.chip_select = 0,
.mode = SPI_MODE_0,
},
};
compile the kernel and when you boot up on it you should see /dev/spidev2.0
There's a few examples using this in user mode....
http://www.haifux.org/lectures/258/gpio_spi_i2c_userspace.pdf
That has a pretty short example in it. There are some pretty good ones right in the kernel/Documents/spi/ folder.
Hi,
How to enable the spidev in kernel ?
i use command "make menuconfig" in linux kernel path, then i go to "spi support", and enable "User mode SPI device driver support" , then i type "make" to build uImage. but i found that the "User mode SPI device driver support" will disable itself after i build uImage. did i miss something?
Thanks.
In the root of the sdk (not the linux psp), the make file hides a lot of whats going on; it'll use the config file "tisdk_am335x-evm-defconfig". you can manually edit that file or copy your config file back to where that file is stored after you menuconfig it (in linuxpsp)... (its stored in linuxkernelpsp/arch/arm/configs/tisdk_am335x-evm-defconfig ) --or just go to the SPI module directory and edit the make file there (add it with a config option already defined).
I had successfully made these changes using the 5.03.02 version of the SDK.
After migrating to the 5.04 version, this no longer works.
Any suggestions?
I haven't upgraded the SDK yet, was thinking of waiting until 5.04.01 (apr 16?).
Thanks dal.
I'm confused. Was there a change to the v5.04 SDK that makes the previously described changes ineffective?
I believe I have re-incorporated those changes to the new SDK and the spidev-2.0 device is not instantiated after booting.
Update,
Not sure why (make clean, maybe) but now I'm able to re-create the previously described update and spidev-2.0 is available and working.
Thanks again.
good news.
BTW, just so if there's any question about this in future (I know the write up is pretty terse above) -- I came across this on the beagle list a couple of days ago.
http://communistcode.co.uk/blog/blogPost.php?blogPostID=1
This is a pretty decent write up on how to get SPIDEV to work.
-Dal
Hi everyone,
How to make the spi0 work on beaglebone?
My kernel is 'linux-3.1.0-psp04.06.00.03.sdk', The SPI driver is from the kernel .The config of the SPI is according to http://processors.wiki.ti.com/index.php/AM335x_McSPI_Driver%27s_Guide 。
According to the links provided by Dal http://communistcode.co.uk/blog/blogPost.php?blogPostID=1 ,I modify the kernel ,but I have troubles below:
root@am335x-evm:/# ls /dev/spidev*
ls: /dev/spidev*: No such file or directory
……
I found the document of Dal provided is different from my system. My system should be the same with Keldy, and did somebody spi0 can work? How?
Hi dal :
I do everything as you mentioned but I can not see /dev/spidev2.0 in my file system.
I use am335x evm and kernel version is 3.2.0, I do not know if it is device tree issue.
Could you give me some suggestions?
Best regards,
Marcus
Some possible errors:
1) spidev not enabled in kernel. view .config and verify that the spidev option has =y
2) In board___.c, struct spi_board_info modalias should only be "spidev", not "spidev1" or "spidev2.0"
3) In board___.c, struct spi_board_info is not initialized via spi_register_board_info()
4) In board___.c, spi pin mux not configured
Hi Sinisa :
I do not remember the reason, but I sure it should be related with the link below.
http://e2e.ti.com/support/arm/sitara_arm/f/791/t/168122
Best regards
Marcus