This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Beaglebone spidev problem

Other Parts Discussed in Thread: TPS65217

Hi all, I'm using beagle bone rev A3 with Sitara sdk (version: ti-sdk-am335x-evm-05.05.00.00).

I need to uso the spi1 with my AD peripheral and I would like to access it at user level. As far I understood from the previous post ( http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/791/p/168122/699213.aspx#699213 ) I've to do it in two step:

1) modify the file board-am335xemv.c file I've added:

static struct spi_board_info am335x_spi1_slave_info[] = {
    {
//        .modalias      = "m25p80",
        .modalias      = "spidev",            //brt
        .platform_data = &am335x_spi_flash,
        .irq           = -1,
        .max_speed_hz  = 1000000,
        .bus_num       = 2,
        .chip_select   = 0,
        .mode = SPI_MODE_0,
    },
};

/* Module pin mux for SPI flash */
static struct pinmux_config spi1_pin_mux[] = {
    {"mcasp0_aclkx.spi1_sclk", OMAP_MUX_MODE3 | AM33XX_PULL_ENBL
        |  AM33XX_PIN_OUTPUT },
    {"mcasp0_fsx.spi1_d0", OMAP_MUX_MODE3 | AM33XX_PULL_ENBL
        | AM33XX_PULL_UP |  AM33XX_PIN_OUTPUT },
    {"mcasp0_axr0.spi1_d1", OMAP_MUX_MODE3 | AM33XX_PULL_ENBL
        | AM33XX_INPUT_EN},
    {"mcasp0_ahclkr.spi1_cs0", OMAP_MUX_MODE3 | AM33XX_PULL_ENBL
        | AM33XX_PULL_UP |  AM33XX_PIN_OUTPUT },
    {NULL, 0},
};

/* setup bone spi1 */
static void bone_spi1_init(int evm_id, int profile)
{
        pr_info("BRT:Beagle bone SPI init\n");
    setup_pin_mux(spi1_pin_mux);
    spi_register_board_info(am335x_spi1_slave_info,
            ARRAY_SIZE(am335x_spi1_slave_info));
    return;
}

/* Beaglebone Rev A3 and after */
static struct evm_dev_cfg beaglebone_dev_cfg[] = {
    {tps65217_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
//    {mii1_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
    {usb0_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
    {usb1_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
    {mmc0_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
    {i2c2_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
    {bone_spi1_init,DEV_ON_BASEBOARD, PROFILE_NONE},        //brt
    {NULL, 0, 0},
};

2) reconfigure the kernel to:

 -enabling ==> User mode SPI device driver support (SPI_SPIDEV)

-disabling ==> McSPI driver for OMAP (SPI_OMAP24XX)

-disabling ==> Memory Technology Device (MTD) support (MTD)

I have successusfully recompiled the kernel and  I was able to see sys files:

root@am335x-evm:~# find /sys -name "*spi*"
/sys/bus/spi
/sys/bus/spi/drivers/spidev
/sys/class/spi_master
/sys/class/spidev
/sys/module/spidev

But I cannot still found the /dev/spidev* devices...

Am I missing something? Where am I wrong?

Many thanks in advance

But still we ca

  • Hi Bert,

    Can you try by

    Enabling ==> McSPI driver for OMAP (SPI_OMAP24XX)

    Thanks Avinash

  • Hi Philip,

    I've already tried that option, but it didn't solve my problem. Anyway thanks for the hint!

    Are there other ways to use the spi? Is spidev the only one option?

    Thoughts?

    Best regards,

    Francesco Berti

  • Hi,

    On enabling "McSPI driver for OMAP (SPI_OMAP24XX)" you should see

    # find /sys -name "*spi*"
    /sys/devices/platform/omap/omap2_mcspi.1
    /sys/devices/platform/omap/omap2_mcspi.1/spi_master
    /sys/devices/platform/omap/omap2_mcspi.1/spi_master/spi1
    /sys/devices/platform/omap/omap2_mcspi.2
    /sys/devices/platform/omap/omap2_mcspi.2/spi_master
    /sys/devices/platform/omap/omap2_mcspi.2/spi_master/spi2
    /sys/devices/platform/omap/omap2_mcspi.2/spi2.0
    /sys/devices/platform/omap/omap2_mcspi.2/spi2.0/spidev
    /sys/devices/platform/omap/omap2_mcspi.2/spi2.0/spidev/spidev2.0
    /sys/bus/platform/devices/omap2_mcspi.1
    /sys/bus/platform/devices/omap2_mcspi.2
    /sys/bus/platform/drivers/omap2_mcspi
    /sys/bus/platform/drivers/omap2_mcspi/omap2_mcspi.1
    /sys/bus/platform/drivers/omap2_mcspi/omap2_mcspi.2
    /sys/bus/spi
    /sys/bus/spi/devices/spi2.0
    /sys/bus/spi/drivers/spidev
    /sys/bus/spi/drivers/spidev/spi2.0
    /sys/class/spi_master
    /sys/class/spi_master/spi1
    /sys/class/spi_master/spi2
    /sys/class/spidev
    /sys/class/spidev/spidev2.0
    /sys/module/spidev

    Thanks Avinash


  • Hi Philip,

    I tried that option before writing on this forum without success, but now, following your help, is working flawlessly!

    So... thank you!

    Moreover now I'm able to communicate with a slave device, which is a key step for my project.

    Best regards,

    Francesco Berti