AM2632-Q1: AM263x, SDK 26.00.00, Sysconfig 1.28.0+4712 generates incorrect code for multi-channel MCSPI configuration.

Part Number: AM2632-Q1
Other Parts Discussed in Thread: SYSCONFIG

Hello,

As noted here (+) MCU-PLUS-SDK-AM263X: MCSPI CS issue/workaround for Multi-channel mode (SDK version 9.02) - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums about 2 years ago and observed with SDK 26.00.00, Sysconfig 1.28.0+4712 the incorrect code generation is still present.

For multi-channel MCSPI configuration the code generated for channel data is still incorrect in ti_drivers_open_close.c:

MCSPI_ChConfig gMcspiPmicCanChCfg[MCSPI_PMIC_CAN_NUM_CH] =
{
    {
        .chNum              = MCSPI_CHANNEL_0,
        .frameFormat        = MCSPI_FF_POL0_PHA0,
        .bitRate            = 1000000,
        .csPolarity         = MCSPI_CS_POL_LOW,
        .trMode             = MCSPI_TR_MODE_TX_RX,
        .inputSelect        = MCSPI_IS_D1,
        .dpe0               = MCSPI_DPE_ENABLE,
        .dpe1               = MCSPI_DPE_DISABLE,
        .slvCsSelect        = MCSPI_SLV_CS_SELECT_0,
        .startBitEnable     = FALSE,
        .startBitPolarity   = MCSPI_SB_POL_LOW,
        .csIdleTime         = MCSPI_TCS0_0_CLK,
        .turboEnable        = FALSE,
        .defaultTxData      = 0x0U,
        .txFifoTrigLvl      = 16U,
        .rxFifoTrigLvl      = 16U,
    },
    {
        .chNum              = MCSPI_CHANNEL_0,
        .frameFormat        = MCSPI_FF_POL0_PHA1,
        .bitRate            = 2000000,
        .csPolarity         = MCSPI_CS_POL_HIGH,
        .trMode             = MCSPI_TR_MODE_TX_RX,
        .inputSelect        = MCSPI_IS_D1,
        .dpe0               = MCSPI_DPE_ENABLE,
        .dpe1               = MCSPI_DPE_DISABLE,
        .slvCsSelect        = MCSPI_SLV_CS_SELECT_0,
        .startBitEnable     = FALSE,
        .startBitPolarity   = MCSPI_SB_POL_LOW,
        .csIdleTime         = MCSPI_TCS0_0_CLK,
        .turboEnable        = FALSE,
        .defaultTxData      = 0x0U,
        .txFifoTrigLvl      = 16U,
        .rxFifoTrigLvl      = 16U,
    },
};
Shouldn't the second entry for .chNum be MCSPI_CHANNEL_1?
 
Sysconfig configuration file is attached.
 
Regards,
Eugene
  • Hi Eugene,
    Let me check.
    I will get back to you.

  • Hi Eugene,
    You are correct.
    I have raised jira internally to fix this issue.

  • Hi Lakshya,

    I would really need a solution ASAP. This issue has been known for 2 years. Could you please provide a workaround or patch, so we do not have to manually edit generated files?

  • Hi Eugene,

    When I see the backend of the implementation, the channel number is based on the cs selected.

    and the macro determines which CS to use.

    For eg. if you choose SPI0, there are 2 CS selected, which results in 2 chNum.

    I see that you have selected SPI1, which has 1 CS. May I know your usecase here? Is the other instance using GPIO as CS?

    Thanks and Regards,

    Nikhil Dasan

  • Hi Nikhil,

    I use multi-channel mode with manual CS control. I send multi-word messages to two different peripheral devices. MCSPI dedicated CS is disabled (unchecked in Sysconfig) for all channels. Most of the peripheral devices (which are TI devices) we work with use multi-word messages and auto CS toggle between words that MCSPI IP implements in multi-channel mode cannot be used.

    Not sure that channel number should be based on CS selection. It should be based on Sysconfig entry and provided in the generated files. The latter is another issue with the generated files. User doesn't have an option to name a channel and no symbol to address it.

    Regards,

    Eugene

  • Hi Eugene, 


    Can you please allow me some time to check this issue in detail internally. 
    Will keep you posted on any new development. 


    Regards, 
    Pranav Siddappa

  • Hi Eugene, 


    Would your issue be resolved if the .chNum param has unique identifiers instead of relying on CS values? 
    In this case, the .chNum value would be populated with MCSPI_CHANNEL_0 and MCSPI_CHANNEL_1. 


    Regards, 
    Pranav Siddappa

  • Hi Pranav,

    Better solution is to give the user an option to name channels and generate unique identifier for each channel. Identifiers can be mapped to MCSPI_CHANNEL_x. The user doesn't really know from Sysconfig GUI what channel is for what configuration without a unique identifier. The ordering of channel in gMcspiPmicCanChCfg can then be arbitrary.

    However I would need a solution ASAP.

    Regards,

    Eugene

  • Hi Eugene, 


    That's a valid suggestion, I will check internally if we can accommodate having custom identifiers. 
    Will report back once i confirm. Thank you for your patience. 


    Regards, 
    Pranav Siddappa