UBOOT SPI configuration and usage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UBOOT SPI configuration and usage

4,078 Views
nexy_sm
Contributor II

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.

Labels (1)
Tags (2)
1 Reply

2,691 Views
igorpadykov
NXP Employee
NXP Employee

Hi Nemanja

what uboot used in the case, seems uboot definitions like:

CONFIG_CMD_SPI,CONFIG_DEFAULT_SPI_BUS were used for

older i.mx parts like i.MX51,53 but not for i.MX6 products.

In general this may be posted on uboot mail list

U-Boot Info Page 

NXP uboot, link below

uboot-imx.git - Freescale i.MX u-boot Tree 

uses standard spi-nor commands like: sf probe, sf write/read

spi related "define"s can be found in uboot/include/configs/mx6_common.h

uboot-imx.git - Freescale i.MX u-boot Tree 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos