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.

AM572x McSPI clock enable

Other Parts Discussed in Thread: AM5728

AM5728, PDK 1.0.2, Compiler V8.1.0, BIOS 6.45.1.29, XDC 3.32.0.06

Hello,

I am using MCSPI1 on the 5728 under control of a DSP core.  The 5728 is first booted by Linux on the ARM core then my DSP code is loaded and the DSP uses the MCSPI.  Thus, the DSP is not doing Board Init functions.

My code calls, SPI_Init(), SPI_Params_init() and SPI_open() to setup the SPI for Master mode, CALLBACK.  At that point I am not able to use the SPI, no data is transferred. 

I discovered that CM_L4PER_MCSPI1_CLKCTRL register was set to 0x00030000.  I wrote a 0x00000002 to the register (direct register write in my C code) and it started working.

I've discovered in the file "C:\ti\pdk_am57xx_1_0_2\packages\ti\drv\spi\example\mcspiMasterTxApp\src\mcspiMasterTxApp.c" the following code:

#if (defined (SOC_TDA3XX))
    /*MCSPI1 prcm*/
    HW_WR_REG32(SOC_L4PER_CM_CORE_BASE + CM_L4PER_MCSPI1_CLKCTRL, 0x02);
    while (HW_RD_REG32(SOC_L4PER_CM_CORE_BASE + CM_L4PER_MCSPI1_CLKCTRL) !=
            0x02U)
        {
            ;
        }

....

#endif

However, that setting of CM_L4PER_MCSPI1_CLKCTRL is not in SOC_AM572x.  Is this a bug or is the clock enabled some other way for the AM5728?  What do I need to do in my code to enable this clock correctly, I don't like directing modifying SOC registers in my C code.

  • The RTOS team have been notified. They will respond here.
  • Christopher,

    This is slightly strange as I would imagine that the u-boot code that initializes the SPI driver would enable that clock but it may be disabled when the kernel is boots up or may be a function of the power management features enabled in the kernel. On the Linux side the clocks may be enabled when the McSPI driver is invoked.

    In order to work around this, you can add the following code back into DSP code.

    Board_initCfg boardCfg;
    boardCfg = BOARD_INIT_MODULE_CLOCK
    Board_init(boardCfg);

    This will only enable the module clocks without changing the PLL , PINMUX or other initialization done by the Linux code.

    However note that when you select this option all module clocks are enabled as you can see from the Board_moduleClockInit in evmAM572x_clock.c. This is one place where if the board library module clock setting messes with your setup, you may need to add just the McSPI clock enable code using CSL to have more granular control over module clock enabled in the DSP side code.

    Regards,
    Rahul