|
Fireprime的spi使用loop模式读出来的都是FF
发表于 2016-8-17 17:01:20
浏览:5806
|
回复:1
打印
只看该作者
[复制链接]
楼主
1. 编译自带的spidev.c驱动添加dts与驱动匹配,我使用spi0.0
我使用的ubuntu镜像,在kernel/drivers/spi/Makefile 中spidev编译设置为obj-m,然后make modules生成spidev.ko
2. 加载spidev.ko模块
生成spidev0.0节点
root@linaro-gnome:/home/linaro/Downloads# ls -l /dev/spidev0.0
crw------- 1 root root 153, 0 Apr 13 15:44 /dev/spidev0.0
root@linaro-gnome:/home/linaro/Downloads#
3. 修改测试代码Documentation/spi/spidev_test.c
static const char *device = "/dev/spidev1.1";
改为
static const char *device = "/dev/spidev0.0";
4. 编译测试代码
gcc -o test spidev_test.c
5. 测试程序
root@linaro-gnome:/home/linaro/Downloads# ./test -l
spi mode: 32
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF |
|