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.

TDA4VM: MCU_MCSPI debug issue for mcusw's MCAL

Part Number: TDA4VM

Hi team,

Two peripherals are externally connected using MCU_MCSPI0 and MCU_MCSPI1. Use EB to configure for asynchronous interrupt mode.

Use the mcal-spi driver code from mcsw (ti-processor-sdk-rtos-j721e-evm-07_03_00_07).

The two SPI configurations are as follows:

MCU_MCSPI0 - seq0 - Job0 - Channel0 - Peripheral 0

MCU_MCSPI1 - seq1 - Job1 - Channel1 - Peripheral 1

Issues:

1. MCU_MCSPI0 communication with peripheral 0 is OK; (logic analyzer captures data and interrupts reads RAM data both are OK).

2. MCU_MCSPI1 sent separately, logic analyzer intercept found no data was sent.

3. sent one packet SPI0 followed by one packet SPI1, and SPI0 data is OK, but SPI1 sends data for SPI0, and RAM reads are 0.

Then the customer tried another way for testing:

MCU_MCSPI1 - seq0 - Job0 - Channel0 - Peripheral 0

MCU_MCSPI0 - seq1 - Job1 - Channel1 - Peripheral 1

SPI1 transmit and receive is normal, but SPI0 has the issue described above again.

Only if all parameters of the peripheral configuration are configured in position 0,  the result is normal. The customer suspected there is some thing wrong of MCAL source code.

The customer would like to ask if TI have debugged the overpass SPI with the SPI code from the McAL and encountered the above questions.

NOTE: 1. The above related test code refers to the McSpiApp.c initialization and transmission process in the McCall examples, but the official test code in the examples only tests one SPI0 for one chan0.

2. The autostar configuration file is modified using EB based on the basis in demo.

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hi,

    May I know is there any updates? Thanks.

    Best Regards,

    Cherry

  • Hi,

    It seems that something is wrong with the configuration of the second sequence/peripheral. Swapping the SPI0/SPI1 instances shows that the SPI modules and their initialization is fine, but there is something wrong with the seq1 programming.

    According to our documentation, we have not tested multiple MCSPI instances configuration:

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/07_03_00_07/exports/docs/mcusw/mcal_drv/docs/drv_docs/ug_spi_top.html#ug_spi_eg_top

    Would you be able to provide the code you are using to test the two SPI modules?

    Regards,

    Erick

  • Hi Erick,

    Thanks for your support!

    The SPI connects three peripherals, SPI0 uses CS1 and CS2 to connect two peripherals, SPI1 uses CS0 to connect to a peripheral. Currently only debug peripheral 0 for CS1 of SPI0, and peripheral 2 for CS0 of SPI1. Peripheral 0 is sent at the same time as Peripheral 2.

    Transmit Interface:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    Std_ReturnType SpiWrapper_Xfer(Spi_ChanIdType channelId,
    Spi_DataBufferType* SrcDataBufferPtr,
    Spi_DataBufferType* DesDataBufferPtr,
    Spi_NumberOfDataType Length)
    {
    Spi_StatusType status;
    uint32 index;
    Spi_SequenceType seqId;
    Std_ReturnType retVal;
    const Spi_ConfigType *cfgPtr = &SpiDriver;
    #if (SPI_HW_STATUS_API == STD_ON)
    /* SPI HW unit should be free now - check */
    for (index = 0U; index < cfgPtr->maxHwUnit; index++)
    {
    status = Spi_GetHWUnitStatus(cfgPtr->hwUnitCfg[index].hwUnitId);
    if(status != SPI_IDLE)
    {
    return status;
    DRV_SPI_DBG("\x1b[1;31m[%s:%d]%d: HWUnitStatus is not idle!!\x1b[0m\n", __func__,__LINE__,OsWrapper_GetTimeMs());
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Files generated by the autostar configuration:

    Spi_PBcfg.c:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    CONST(struct Spi_ConfigType_s, SPI_CONFIG_DATA) SpiDriver =
    {
    .maxChannels = 3U,
    .maxJobs = 3U,
    .maxSeq = 3U,
    .maxHwUnit = 2U,
    .maxExtDevCfg = 3U,
    .udmaInstId = (uint32)UDMA_INST_ID_MCU_0,
    .cacheWbInv = (Spi_CacheWbInv)SpiApp_wbInvCache,
    .cacheWb = (Spi_CacheWb)SpiApp_wbCache,
    .cacheInv = (Spi_CacheInv)SpiApp_invCache,
    .channelCfg =
    {
    [0] =
    {
    .channelBufType = SPI_EB,
    .dataWidth = 8U,
    .defaultTxData = 255U,
    .maxBufLength = 256U,
    .transferType = SPI_MSB,
    },
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Spi_Cfg.c:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    CONST(Spi_ChannelConfigType_PC, SPI_CONFIG_DATA) Spi_ChannelConfig_PC[3] =
    {
    [0] =
    {
    .channelId = SpiConf_SpiChannel_SpiChannel_0,
    },
    [1] =
    {
    .channelId = SpiConf_SpiChannel_SpiChannel_1,
    },
    [2] =
    {
    .channelId = SpiConf_SpiChannel_SpiChannel_2,
    },
    };
    CONST(Spi_JobConfigType_PC, SPI_CONFIG_DATA) Spi_JobConfig_PC[3] =
    {
    [0] =
    {
    .jobId = SpiConf_SpiJob_SpiJob_0,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Spi_Cfg.h:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #define SPI_VARIANT_POST_BUILD (STD_ON)
    /**
    * \brief Pre Compile config macro name.
    */
    /** \brief Buffer mode - Internal or External or Both */
    #define SPI_CHANNELBUFFERS (SPI_EB)
    /** \brief Internal Buffer length in bytes - applicable only for SPI_IB */
    #define SPI_IB_MAX_LENGTH (0U)
    /** \brief Enable/disable SPI dev detect error */
    #define SPI_DEV_ERROR_DETECT (STD_ON)
    /** \brief Enable/disable SPI job log */
    #define SPI_JOB_LOG (STD_ON)
    /** \brief Maximum job log entries when logging is ON */
    #define SPI_MAX_JOB_LOG (100U)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The two SPI modules are tested by calling the SpiWrapper_Xfer interface above to define the global TX and RX buffer, then pass into the channel, just as follows:

    SpiWrapper_Xfer(0, TxBuffer0, RxBuffer0, 8);

    SpiWrapper_Xfer(2, TxBuffer2, RxBuffer2, 8);

    The logic analyzer captures SPI bus data, TxBUFFER0, RxBUFFER0 are OK, and the data read in SpiApp_McuMcspiSeq0EndNotification is also OK.

    The point is TxBUFFER2 sends TxBUFFER0's data.  The data read for RxBuffer2 in SpiApp_McpuMcspiSeq2EndNotification is 0. But the logic analyzer did can capture the data.

    It seems that something is wrong with the configuration of the second sequence/peripheral.

    Could you specify this? is there anything wrong with the configuration?

    The detailed configuration is as follows:

    MCU_MCSPI0 - CS1 - seq0 - job0 - channel0 - Peripheral 0

    MCU_MCSPI0 - CS2 - seq1 - job1 - channel1 - Peripheral 1

    MCU_MCSPI1 - CS0 - seq2 - job2 - channel2 - Peripheral 2

     Thanks and Best Regards,

    Cherry

  • Hi,

    May I know is there any updates? There are also some new info:

    Chan2 is working. Changed SPI0-CS2 to DIO control and csmode to SINGLE. SPI0-CS1 for chan0 does not use DIO and csmode is set to CONTINOUS. However, it can only start Chan0 and then Chan2, otherwise it will fail.

    Thanks and Best Regards,

    Cherry