Re: Accessing SPI

Merrill Harriman <[email protected]>
Newsgroups gmane.linux.uclinux.devel
Message-ID <[email protected]>
cc:NSA - LOL ...

What platform? 

I have very recently been through a long process of getting the spidev working on an Emcraft STM-SOM with STM32F4.  The documentation was lacking but once I got the right hint from emcraft support I was able to get it going.  I am using SPI1 and SPI2 as built in kernel modules.  I am then using ioctl ops on the /dev/spidev0.0 and /dev/spidev1.0.   The supported ioctl accesses are defined in .../A2F/root/usr/include/linux/spi/spidev.h.

Here is a brief overview of the process:

make kmenuconfig =>  enable spis 
make bmenuconfig =>  enable mdev

In .../linux/arch/arm/mach-stm32/...
iomux.c - configure required port.pins for alternate functions
spi.c - add board info structs for each spidev 

In .../linux/drivers/spi/...
spi_stm32.c - configure spi_cr1 for correct format
spidev.c - instrument as necessary with debug printk's to see progress

I am sure there is some stuff I left out here.  I have a demo spidev project from emcraft that uses spi2 and spi5 - if you would like that I can forward it to your private email ... I think some of the key ingredients are the configurations they used in initramfs, busybox, kernel config, and rc.  These are in the demo project also ...

Good luck ...








Date: Tue, 28 Jan 2014 15:45:04 -0800
From: [email protected]
To: [email protected]
Subject: [uClinux-dev] Accessing SPI

I have an Emcraft distro with a SPI device at /dev/spi. I wish to access the device for (for instance) controlling the chip select pin, read, write, etc. 
I have seen a document on controlling a SPI driver on ucLinux from user space (http://www.uclinux.org/pub/uClinux/ports/blackfin/docs/pdf-docs/SPI_device_driver.pdf) , but it references IOCTLs that are not in my source tree. 

I did find a file, linux/spi/spidev.h, that has a struct defined that seems to be used by user mode SPI code, but it is not clear how I am to use it, in particular, which IOCTLs are available, and how I can get access to the interface at low levels. 

How in general do ucLinux app developers access SPI devices?
Eric
-- 
cc:NSA



_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.