I have tried ALL MY BEST in searching google and TI support documents to get SPI communication in the TI’s AM335x General Purpose EVM Board (GPEVM). The debug terminal finally only show up the “/dev/spidev1.0” for spi driver to open. It seems everything is ok in the debug terminal when I trigger the SPI driver. HOWEVER, I still can’t see anything from the oscilloscope. Only AM335X_SPI0_CS0 pin goes down when I trigger the spi driver.
I measured 4 singles:
- (Expension Connector - EXP2) J5, Pin13 => AM335X_SPI0_SCLK => Nothing!
- (Expension Connector - EXP2) J5, Pin15 => AM335X_SPI0_D0 => Nothing!
- (Expension Connector – EXP0) J3, Pin23 => AM335X_SPI0_D1 => Nothing!
- (Expension Connector – EXP0) J3, Pin24 => AM335X_SPI0_CS0 => goes low when trigger.
Please anyone can help me?? PLEASE!!!
The following is what I have done so far:
1st step:
edit arch/arm/config/tisdk_am335x-evm_defconfig
Enable: CONFIG_SPI_SPIDEV=y
Then, all following steps I edited to enable spidev for TI's AM335x General Purpose EVM occur is in this file:
SDK/board-support/linux-3.2-psp04.06.00.07.sdk/arch/arm/mach-omap2/board-am335xevm.c
2nd Step:
edit this struct: "gen_purp_evm_dev_cfg[]"
static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
.....
// take this out
// {spi0_init, DEV_ON_DGHTR_BRD, PROFILE_2},
.....
// put this in
{spi0_init, DEV_ON_BASEBOARD, PROFILE_0},
...
};
3rd Step: Revise the following struct
static struct spi_board_info am335x_spi0_slave_info[] = {
{
.modalias = "spidev",
.max_speed_hz = 1000000,
.irq = -1,
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_1
},
};
4th Step: Revise the following struct
static void spi0_init(int evm_id, int profile)
{
setup_pin_mux(spi0_pin_mux);
spi_register_board_info(am335x_spi0_slave_info,
ARRAY_SIZE(am335x_spi0_slave_info));
return;
}
5th Step:Revise the following struct
static struct pinmux_config spi0_pin_mux[] = {
{"spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_UP | AM33XX_PULL_ENBL},
{"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},
};
6th Step:
Re-compile Kernel and flash it to target board
7th Step:
Compiler SDK/board-support/linux-3.2-psp04.06.00.07.sdk/Documentation/spi/spidev_test.c and put it into NFS filesystem. Then, connect MOSI and MISO.
8th Step:
Power the EVM and type in:
#./spidev_test -D /dev/spidev1.0
It shows:
root@am335x-evm:~# ./spidev_test -D /dev/spidev1.0
mode = 0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00
9th Step:
Obviously, there is something wrong. So, I disconnect MOSI and MISO and measure all these four singles with oscillscope. Only AM335X_SPI0_CS0 goes down when I trigger the driver.
Please anyone can help me?? PLEASE!!!