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.

AM3354: McSPI control in U-boot

Part Number: AM3354

Hi,

Main chip: AM3354BZCZ100 

SDK: RT 3.3 

Hardware connection : 

The OLED screen (ssd1106) needs to be controlled by the SPI bus in the uboot phase.

How should the SPI program in the am3354 uboot phase be written?

For example, how to write data on the SPI bus, set the clock speed of the SPI and the mode of SPI ?

Can we make some suggestions or give some SPI operation routines for the am335x uboot phase  ?

Hope for your help,Thank you.

BR

  • The software team have been notified. They will respond here.
  • Hi Andre,

    You should describe your external SPI device in the AM335x u-boot DTS file. Then you can use the SPI commands from the u-boot prompt to communicate with that external SPI device.

    By default we have the "sf" commands in u-boot (see link below), but these seems to be used only for SPI flash device.

    processors.wiki.ti.com/.../Linux_Core_U-Boot_User's_Guide

    For generic SPI device, you can try with "sspi" commands, see below links for more info:

    e2e.ti.com/.../289817
    e2e.ti.com/.../573024

    Regards,
    Pavel
  • Hi Pavel,

    Thank you for your reply.
    I want to implement the am3354 SPI driver in the uboot phase to control the peripherals (ssd1106).

    Whether there is a SPI driver for am3354 for reference ?
    Or how to register a corresponding SPI driver with U_BOOT_DRIVER () on the am3354 ?
    Or there are other methods in the uboot stage, ? hoping to get your advice.

    BR
  • Andre,

    The u-boot SPI driver is located at:

    u-boot-2017.01/drivers/spi/omap3_spi.c

    You can also refer to the below DTS files:

    u-boot-2017.01/arch/arm/dts/am33xx.dtsi
    u-boot-2017.01/arch/arm/dts/am335x-rut.dts

    u-boot-2017.01/board/ti/am335x/mux.c

    Regards,
    Pavel

  • Hi Pavel,

    Thanks for your advice, I now use the sspi command to control SPI peripherals.

    Main chip: AM3354BZCZ100

    SDK: RT 3.3

    SPI1 pin configuration is as follows:

    Hardware connection :

    As can be seen from the schematic diagram,the bus is 1 chip Select is 0.    

    In the uboot phase execute  sspi 1: 0.3 32 A  command, board error restart, as shown below:

    uboot compiled as :

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_boneblack_defconfig all
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

    Did not use the device tree.   We use the MLO and u-boot.img to start the am3354 board. 

    Test the SPI0 bus command, as follows:

    I need to control the peripherals on the SPI1 bus. 

    How can I solve the SPI1 error board restart problem ?

    Hope to get your help, thanks.

    BR

  • Hi Pavel,

    When I execute the SSPI 1:0.0 32 A command, I add print to spi.c and omap3_spi.c, as shown in the following figure:

    The spi_reset () function times is wrong when executing to the omap3_spi.c file, as shown in the following figure:

    How should I solve this problem ?

    How to use the SSPI command to control the peripherals on the SPI 1 bus ?

    I hope you can help me, thank you.

    BR

  • Hi Andre,

    Make sure that McSPI1 (0x481A0000) is enabled in the device PRCM. You can use the u-boot md/mw commands to check/modify the related registers:

    CM_PER_SPI1_CLKCTRL

    Regards,
    Pavel