版主,请教一下beaglebone中spi时钟的问题?
我的spi自测已经通过了~现在与28335通信总是没有时钟信号,详细情况如下:
spi相关的部分设置如下:内核是 'Linux-3.1.0-psp04.06.00.03. SDK'
在board-am335xevm.c中
static structspi_board_info bone_spi0_info[] = {
{
.modalias = "spidev",
.max_speed_hz = 48000000, //48 Mbps
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_0,(自己根据时钟信号改的,看到寄存器MCSPI_CHCONF0的值为0X2c,也就是POL=0,PHA=0?这样对吗?)},
};
在
static void spi0_init(intevm_id, int profile)
{
setup_pin_mux(spi0_pin_mux);
spi_register_board_info(bone_spi0_info,
ARRAY_SIZE(bone_spi0_info));
return;
}
在 beaglebone_dev_cfg[] 中:
{spi0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
在终端显示如下:
./dev/spidev1.0
./dev/.udev/names/spidev1.0
./sys/devices/platform/omap/omap2_mcspi.1/spi1.0/spidev
./sys/devices/platform/omap/omap2_mcspi.1/spi1.0/spidev/spidev1.0
./sys/bus/spi/drivers/spidev
./sys/class/spidev
./sys/class/spidev/spidev1.0
用spidev_test.c测试通信正常:
root@am335x-evm:/mnt# ./spidev_test -D /dev/spidev1.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FFFFFFFFFF
40 00 00 00 00 95
FF FFFFFFFFFF
FF FFFFFFFFFF
FF FFFFFFFFFF
DE AD BE EF BA AD
F0 0D
内核中的其他地方我没有进行更改,采用的是默认的设置,用spidev_fdx.c测试的时候没有时钟信号?(保持低电平)
spi相关地方的默认设置是:
/* Module pin mux for SPI fash */
/*static struct pinmux_config spi0_pin_mux[] = {
{"spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL
| AM33XX_INPUT_EN},
{"spi0_d0.spi0_d0", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL | AM33XX_PULL_UP
| AM33XX_INPUT_EN},
{"spi0_d1.spi0_d1", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL
| AM33XX_INPUT_EN},
{"spi0_cs0.spi0_cs0", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL | AM33XX_PULL_UP
| AM33XX_INPUT_EN},
{NULL, 0},
};
我觉得设置应该有问题,但找不到原因,请版主指点! |