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.

AM3358: Two SPI instances

Part Number: AM3358

I can open SPI_open(BOARD_MCSPI_MASTER_INSTANCE - 1, &spiParams) here BOARD_MCSPI_MASTER_INSTANCE = 2U. Can I open SPI_open(0, &spiParams)? AM335x has two spi. If yes, do I need to enable spi serial port like uart serial port? Thanks

  • Hi Anping,

    Yes, it should be possible to open two McSPI instances on AM335x using the SPI LLD APIs.

    SPI open APIs are documented here: software-dl.ti.com/.../index_device_drv.html
    More details API documentation can be located here: pdk_am437x_1_0_16/packages/ti/drv/spi/docs/doxygen/html/index.html.

    Also please see the SPI_TestApplication (main source file main_mcspi_test.c) documented here: software-dl.ti.com/.../index_device_drv.html

    Two open two SPI instances:

    SPI_init(): called once to initialize SPI driver
    SPI_socGetInitCfg() / SPI_socSetInitCfg(): called for each SPI instance if required to change default HW settings
    SPI_open(): called for each SPI instance with instance ID
    SPI_transfer(): called SPI instance using handle returned by SPI_open()

    Multi-channel API functions are provided for McSPI. In this case:

    SPI_init(): called once to initialize SPI driver
    SPI_socGetInitCfg() / SPI_socSetInitCfg(): called for each SPI instance if required to change default HW settings
    MCSPI_open(): called for each McSPI instance & channel with instance ID and channel ID
    MCSPI_transfer(): called for MCSPI instance using handle returned by MCSPI_open()

    The number of supported SPI instances is defined by:

    packages/ti/drv/spi/soc/am335x/SPI_soc.c:51:#define CSL_MCSPI_PER_CNT (2U)

    The number of supported channels is defined by:

    packages/ti/drv/spi/MCSPI.h:70:#define MCSPI_MAX_NUM_CHANNELS (4U)

    Note you may need to update pinmux settings from the defaults provided in the board library to route SPI signals to external device pins. This is described in PRSDK documentation here: http://software-dl.ti.com/processor-sdk-rtos/esd/docs/06_01_00_08/rtos/index_device_drv.html#id44.

    Regards,
    Frank