AnsweredAssumed Answered

UBOOT SPI configuration and usage

Question asked by Nemanja Savic on Jun 6, 2018
Latest reply on Jun 10, 2018 by igorpadykov

Hi all,

 

I would like to use SPI in uboot, and only from command line for reading certain peripherals during the boot. So, I do not use any SPI flash or so, I just need raw SPI access to the bus. We have a similar board to the sabreauto based on i.MX6Q. I have the following pin configuration:

iomux_v3_cfg_t const ecspi1_pads[] = {
    MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
    MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
    MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
    MX6_PAD_DISP0_DAT23__ECSPI1_SS0  | MUX_PAD_CTRL(SPI_PAD_CTRL),
};

void setup_spi(void)
{
    imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
                     ARRAY_SIZE(ecspi1_pads));
}

In sabresd board file, they introduce GPIO as a SS. My question is, what is the proper way in my case. My slave is connected to the SS0 pin.

In configuration, UI have the following:

/* SPI Configs */
#define CONFIG_CMD_SPI
#define CONFIG_MXC_SPI
#define CONFIG_DEFAULT_SPI_BUS    1
#define CONFIG_DEFAULT_SPI_MODE    (SPI_MODE_0 | SPI_CS_HIGH)

I could also not find the proper example within the existing source code. When I run sspi 0:0 ... I get only zeros as a response. When run sspi 1:0 the timeout is returned. In the first case I do not see any activity on the SPI bus. Do I have to use GPIO for SS or not an what would be the proper way. I use uboot 2015.04.

Outcomes