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.

TMS570LS0232: AUTOSAR_MCAL_TMS570LSx-05.30.00: SPI - Wrong order in data transmission

Part Number: TMS570LS0232
Other Parts Discussed in Thread: TMS570LS3137

There is an issue in the SPI configuration:

For an SPI job two SPI channels are configured as follows:

                  <SUB-CONTAINERS>
                    <ECUC-CONTAINER-VALUE UUID="592bc7a1-23d9-4937-9cc7-3edf0515e911">
                      <SHORT-NAME>SpiChannelList_FLS_00_Header</SHORT-NAME>
                      <DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/TI_TMS570LSx/Spi/SpiDriver/SpiJob/SpiChannelList</DEFINITION-REF>
                      <PARAMETER-VALUES>
                        <ECUC-NUMERICAL-PARAM-VALUE>
                          <DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/TI_TMS570LSx/Spi/SpiDriver/SpiJob/SpiChannelList/SpiChannelIndex</DEFINITION-REF>
                          <VALUE>0</VALUE>
                        </ECUC-NUMERICAL-PARAM-VALUE>
                      </PARAMETER-VALUES>
                      <REFERENCE-VALUES>
                        <ECUC-REFERENCE-VALUE>
                          <DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/TI_TMS570LSx/Spi/SpiDriver/SpiJob/SpiChannelList/SpiChannelAssignment</DEFINITION-REF>
                          <VALUE-REF DEST="ECUC-CONTAINER-VALUE">/Spi/Spi/SpiDriver_0/SpiChannel_FLS_Header</VALUE-REF>
                        </ECUC-REFERENCE-VALUE>
                      </REFERENCE-VALUES>
                    </ECUC-CONTAINER-VALUE>
                    <ECUC-CONTAINER-VALUE UUID="70ac27c2-21da-405b-a13d-dde0c2351404">
                      <SHORT-NAME>SpiChannelList_FLS_01_Data</SHORT-NAME>
                      <DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/TI_TMS570LSx/Spi/SpiDriver/SpiJob/SpiChannelList</DEFINITION-REF>
                      <PARAMETER-VALUES>
                        <ECUC-NUMERICAL-PARAM-VALUE>
                          <DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/TI_TMS570LSx/Spi/SpiDriver/SpiJob/SpiChannelList/SpiChannelIndex</DEFINITION-REF>
                          <VALUE>1</VALUE>
                        </ECUC-NUMERICAL-PARAM-VALUE>
                      </PARAMETER-VALUES>
                      <REFERENCE-VALUES>
                        <ECUC-REFERENCE-VALUE>
                          <DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/TI_TMS570LSx/Spi/SpiDriver/SpiJob/SpiChannelList/SpiChannelAssignment</DEFINITION-REF>
                          <VALUE-REF DEST="ECUC-CONTAINER-VALUE">/Spi/Spi/SpiDriver_0/SpiChannel_FLS_Data</VALUE-REF>
                        </ECUC-REFERENCE-VALUE>
                      </REFERENCE-VALUES>
                    </ECUC-CONTAINER-VALUE>
                  </SUB-CONTAINERS>

The resulting Spi_PBcfg.h contains

static CONST(Spi_ChannelType, SPI_PBCFG) SpiChannelsToJob14_Assignment_at[] =
{     
     /* Number of Channels in Job */
     2U,  
     /* Channels in Job */
     Spi_SpiChannel_FLS_Header,
     Spi_SpiChannel_FLS_Data
}; 

When recording the SPI communication, the order of header and data is reversed, that means, first the data is sent and afterwards the header.

When switching the parameters in Spi_PBcfg.h like

static CONST(Spi_ChannelType, SPI_PBCFG) SpiChannelsToJob14_Assignment_at[] =
{     
     /* Number of Channels in Job */
     2U,  
     /* Channels in Job */
     Spi_SpiChannel_FLS_Data,
     Spi_SpiChannel_FLS_Header
};

the order is correct.

Can you explain this incomprehensible behavior?
  • Hi Josef,

    I will asks our developer to do a test and correct it if it is wrong. Thank you for pointing this out.
  • Hello Josef,

    Our MCAL doesn't support TMS570LS0322 device. The following devices are supported by MCAL:
    1. TMS570LC43x
    2. TMS570LS3x
    3.TMS570LS1x
    4. TMS570LS07x
    5. TMS570LS09x

    Regards,
    QJ
  • Sorry, this was my fault. The used derivative is TMS570LS3137
  • Thanks Josef. I have forwarded your finding to our MCAL developer.
  • Josef,

    Can you send Spi_PBcfg.c and SPI_Cfg.h files? I need to look at complete SPI configuration data.

  • Hello,

    please find the generated files in the attachment.

    0508.Spi_Cfg.h

    7041.Spi_PBcfg.c

    Best regards.

  • Hello Josef,

    We tried your configuration on our bench but could not reproduce the issue. Ca you let us know if you are using external buffer for these channels? If yes, can you send us the order of setting of buffers for these channels?

  • Hi Vishwanath,

    I will answer on behalf of Josef.

    We have fixed the order of some configuration parameters in the module which uses the SPI Driver. The SPI Job is still configured as already described - first the "Header" Channel and then the "Data" Channel (see picture below, note the Channel Index configuration).

    The generated Spi_PBcfg.c contains the channel-to-job assignment as expected, namely as configured in SpiJob_FLS_HeaderData/SpiChannelLists:

    The data was successfully verified to appear in the correct order on the bus. This means our problem is resolved for now.

    However, just out of curiosity, I switched the order of the channels in the SPI Job configuration by changing the Channel Index values (see below):

    In the newly generated Spi_PBcfg.c, the channel-to-job assignment does not reflect the configuration:

    We have already verified that the configuration is correctly passed to EB Tresos. We can see that the Channel Index is correctly output as configured and passed to Tresos. Please see the Compare Report below - in the version on the left side, the "Header Channel" is assigned Channel Index 0 and the "Data Channel" is assigned Channel Index 1, in the version on the right side it's the other way around.

    0572.SpiConfig_DaVinciOutput_CompareReport.zip

    UPDATE: I have found out that changing the Channel Index configuration is not sufficient to change the order in the generated channel-to-job assignment. You have to completely remove the channels from the SpiChannelsList and re-add them in the new, intended order. This means that Tresos completely ignores the Channel Index parameter and only uses the order of the <ECUC-CONTAINER-VALUE>s in the ARXML file. This seems obscure to me. Maybe this should be fixed in upcoming releases.

    Best regards,

    Reinhard

  • Hello Reinhard,

    We verified the channel assignment in EBTresos and did not find any issue. You can see below screenshots. The generated structure was as expected.

    Yes, for changing the order of channels, you need to reconfigure the channels in GUI. SpiChannelIndex is not used.