新手入门
- 积分
- 7
- 金钱
- 7
- 注册时间
- 2021-11-2
- 在线时间
- 3 小时
|
4金钱
使用的板子为imx6ull-mini
使用的固件均为正点原子出厂固件(包括uboot、kernel、dtb、rootfs)
设备树ecspi3如下
&ecspi3 {
fsl,spi-num-chipselects = <1>;
cs-gpio = <&gpio1 20 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3>;
status = "okay";
spidev: icm20608@0 {
compatible = "alientek,icm20608";
spi-max-frequency = <8000000>;
reg = <0>;
};
};
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_1>;
imx6ul-evk {
inctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX6UL_PAD_UART2_RTS_B__ECSPI3_MISO 0x100b1 /* MISO*/
MX6UL_PAD_UART2_CTS_B__ECSPI3_MOSI 0x100b1 /* MOSI*/
MX6UL_PAD_UART2_RX_DATA__ECSPI3_SCLK 0x100b1 /* CLK*/
MX6UL_PAD_UART2_TX_DATA__GPIO1_IO20 0x100b0 /* CS*/
>;
};
};
};
例程为正点原子提供的icm20608程序
开发板上电后
root@ATK-IMX6U:~# ls /dev
apm_bios loop-control pps0 snd tty31 tty59
autofs mem pps1 stderr tty32 tty6
block memory_bandwidth ptmx stdin tty33 tty60
bus mmcblk0 ptp0 stdout tty34 tty61
char mmcblk0p1 ptp1 tty tty35 tty62
console mmcblk0p2 pts tty0 tty36 tty63
cpu_dma_latency mtab pxp_device tty1 tty37 tty7
disk mtd0 ram0 tty10 tty38 tty8
dri mtd0ro ram1 tty11 tty39 tty9
fb mtd1 ram10 tty12 tty4 ttymxc0
fb0 mtd1ro ram11 tty13 tty40 ttymxc2
fd mtd2 ram12 tty14 tty41 ubi0
full mtd2ro ram13 tty15 tty42 ubi0_0
fuse mtd3 ram14 tty16 tty43 ubi_ctrl
hwrng mtd3ro ram15 tty17 tty44 udev_network_queue
i2c-0 mtd4 ram2 tty18 tty45 urandom
i2c-1 mtd4ro ram3 tty19 tty46 v4l
icm20608 mtd5 ram4 tty2 tty47 vcs
initctl mtd5ro ram5 tty20 tty48 vcs1
input mtdblock0 ram6 tty21 tty49 vcs2
kmsg mtdblock1 ram7 tty22 tty5 vcsa
log mtdblock2 ram8 tty23 tty50 vcsa1
loop0 mtdblock3 ram9 tty24 tty51 vcsa2
loop1 mtdblock4 random tty25 tty52 video0
loop2 mtdblock5 rfkill tty26 tty53 video1
loop3 mxc_asrc rtc tty27 tty54 watchdog
loop4 network_latency rtc0 tty28 tty55 watchdog0
loop5 network_throughput sda tty29 tty56 xconsole
loop6 null sda1 tty3 tty57 zero
loop7 ppp shm tty30 tty58
root@ATK-IMX6U:~# lsmod
Module Size Used by
icm20608 4019 0
mx6s_capture 14940 0
ov5640_camera 23934 0
例程使用正点原子提供的toolchain交叉编译
root@ATK-IMX6U:~# file icm20608APP
spitest: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=fb468c3b198f5f8fa426695b9bb3a4d06c2ee473, not stripped
运行例程
root@ATK-IMX6U:~# ./icm20608APP /dev/icm20608
原始值:
gx = 0, gy = 0, gz = 0
ax = 0, ay = 0, az = 0
temp = 0
实际值:act gx = 0.00°/S, act gy = 0.00°/S, act gz = 0.00°/S
act ax = 0.00g, act ay = 0.00g, act az = 0.00g
act temp = 24.92°C
原始值:
gx = 0, gy = 0, gz = 0
ax = 0, ay = 0, az = 0
temp = 0
实际值:act gx = 0.00°/S, act gy = 0.00°/S, act gz = 0.00°/S
act ax = 0.00g, act ay = 0.00g, act az = 0.00g
act temp = 24.92°C
使用示波器测试管脚电平
CLK为稳定的3.3V
CS为稳定的0V
MOSI为稳定的3.3V
MISO为稳定的3.3V
|
|