说明文档中描述:
光盘DEMO:
static const char *device = "/dev/spidev1.3";
static uint8_t mode = 3;
static uint8_t bits = 8;
static uint32_t speed = 3000000;
static uint16_t delay;
实际模块上:
实际上把test_spi的代码改成
//static const char *device = "/dev/spidev1.3";
static const char *device = "/dev/spidev1.0";
编译运行的结果如下:
root@esm6800h:/mnt/nfs/test/test_spi/Debug# ./test_spi
spi mode: 3[ 1528.367021] Unable to handle kernel paging request at virtual address 316e 619f
[ 1528.375022] pgd = 80004000
[ 1528.377735] [316e619f] *pgd=00000000
[ 1528.381334] Internal error: Oops: 5 [#1] SMP ARM
[ 1528.385954] Modules linked in: mx6s_capture
[ 1528.390174] CPU: 0 PID: 61 Comm: spi1 Not tainted 4.1.15+gd5d7c02 #1027
[ 1528.396791] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[ 1528.402977] task: 882a17c0 ti: 88386000 task.ti: 88386000
[ 1528.408391] PC is at clk_core_enable+0xc/0xa0
[ 1528.412757] LR is at clk_enable+0x20/0x34
[ 1528.416773] pc : [<805b0cd4>] lr : [<805b1308>] psr: 200f0093
[ 1528.416773] sp : 88387ee8 ip : 00000000 fp : 00000000
[ 1528.428258] r10: 80b6e0d8 r9 : 00000000 r8 : 00000000
[ 1528.433490] r7 : 00000001 r6 : a00f0013 r5 : a00f0013 r4 : 316e6163
[ 1528.440021] r3 : 882a17c0 r2 : 00000001 r1 : 0b4d0b4c r0 : 316e6163
[ 1528.446555] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
[ 1528.453955] Control: 10c53c7d Table: 889dc06a DAC: 00000015
[ 1528.459705] Process spi1 (pid: 61, stack limit = 0x88386210)
[ 1528.465369] Stack: (0x88387ee8 to 0x88388000)
[ 1528.469737] 7ee0: 882a17c0 88382c00 a00f0013 805b1308 8043fdbc 8832 5650
[ 1528.477924] 7f00: 883255ec 8043fdcc 8043fdbc 88325400 883255ec 8043ba70 88387f5c 8832 55c4
[ 1528.486111] 7f20: 80b6e0d8 883255c4 80b6e0d8 00000001 883255c8 00000000 00000000 80b6 e0d8
[ 1528.494297] 7f40: 00000000 8004c418 882a17c0 88382dc0 00000000 883255c4 8004c3c0 0000 0000
[ 1528.502483] 7f60: 00000000 8004c774 fced9c4c 00000000 6f7fff9f 883255c4 00000000 0000 0000
[ 1528.510672] 7f80: 88387f80 88387f80 00000000 00000000 88387f90 88387f90 88387fac 8838 2dc0
[ 1528.518858] 7fa0: 8004c68c 00000000 00000000 8000f528 00000000 00000000 00000000 0000 0000
[ 1528.527044] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000 0000
[ 1528.535230] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 18e5f2be fdff fffd
[ 1528.543431] [<805b0cd4>] (clk_core_enable) from [<805b1308>] (clk_enable+0x20/0x34)
[ 1528.551108] [<805b1308>] (clk_enable) from [<8043fdcc>] (spi_imx_prepare_message+0x10 /0x40)
[ 1528.559475] [<8043fdcc>] (spi_imx_prepare_message) from [<8043ba70>] (__spi_pump_mess ages+0x1c4/0x4d0)
[ 1528.568797] [<8043ba70>] (__spi_pump_messages) from [<8004c418>] (kthread_worker_fn+0 x58/0x1b8)
[ 1528.577508] [<8004c418>] (kthread_worker_fn) from [<8004c774>] (kthread+0xe8/0xfc)
[ 1528.585091] [<8004c774>] (kthread) from [<8000f528>] (ret_from_fork+0x14/0x2c)
[ 1528.592324] Code: eaea0e96 e92d4038 e2504000 0a000018 (e594303c)
[ 1528.598427] ---[ end trace e6092cd3f19c373a ]---
bits per word: 8
max speed: 3000000 Hz (3000 KHz)
transfer
Message from syslogd@esm6800h at Tue May 1 23:16:48 2018 ...
esm6800h kernel: [ 1528.459705] Process spi1 (pid: 61, stack limit = 0x88386210)