<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic AUTOSAR MCAL SPI starting bit bug in S32G</title>
    <link>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721252#M4757</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have just noticed a bug inside AUTOSAR MCAL Spi driver when using either Spi_SyncTransmit or Spi_AsyncTransmit. I dont know if it has been fixed yet but everytime, either function is being used (of course after Spi_Init) the first message's starting bit is not right. If I set MSB first the first message is being sent out with LSB and only it is correct after the first message. I also found the potential problem can be in Spi_Ip.c .&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In function Spi_Ip_SyncTransmit() there are these lines:&lt;BR /&gt;&lt;BR /&gt;/* Get Lsb value */&lt;BR /&gt;LsbValue = State-&amp;gt;ExternalDevice-&amp;gt;DeviceParams-&amp;gt;Lsb ? 1UL : 0UL;&lt;BR /&gt;/* Update State structure and internal variables used for timeout */&lt;BR /&gt;State-&amp;gt;Status = SPI_IP_BUSY;&lt;BR /&gt;State-&amp;gt;ExternalDevice = ExternalDevice;&lt;BR /&gt;&lt;BR /&gt;So it checks the starting bit before even the ExternalDevice structure is being assigned.&lt;/P&gt;&lt;P&gt;Used package: SW32_RTD_4_4_3_0_2_D2203/Spi_TS_T40D11M30I2R0&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 13:39:21 GMT</pubDate>
    <dc:creator>pityu</dc:creator>
    <dc:date>2023-09-12T13:39:21Z</dc:date>
    <item>
      <title>AUTOSAR MCAL SPI starting bit bug</title>
      <link>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721252#M4757</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have just noticed a bug inside AUTOSAR MCAL Spi driver when using either Spi_SyncTransmit or Spi_AsyncTransmit. I dont know if it has been fixed yet but everytime, either function is being used (of course after Spi_Init) the first message's starting bit is not right. If I set MSB first the first message is being sent out with LSB and only it is correct after the first message. I also found the potential problem can be in Spi_Ip.c .&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In function Spi_Ip_SyncTransmit() there are these lines:&lt;BR /&gt;&lt;BR /&gt;/* Get Lsb value */&lt;BR /&gt;LsbValue = State-&amp;gt;ExternalDevice-&amp;gt;DeviceParams-&amp;gt;Lsb ? 1UL : 0UL;&lt;BR /&gt;/* Update State structure and internal variables used for timeout */&lt;BR /&gt;State-&amp;gt;Status = SPI_IP_BUSY;&lt;BR /&gt;State-&amp;gt;ExternalDevice = ExternalDevice;&lt;BR /&gt;&lt;BR /&gt;So it checks the starting bit before even the ExternalDevice structure is being assigned.&lt;/P&gt;&lt;P&gt;Used package: SW32_RTD_4_4_3_0_2_D2203/Spi_TS_T40D11M30I2R0&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 13:39:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721252#M4757</guid>
      <dc:creator>pityu</dc:creator>
      <dc:date>2023-09-12T13:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOSAR MCAL SPI starting bit bug</title>
      <link>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721393#M4758</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Are you using any NXP platform? Or is this a custom board?&lt;/P&gt;
&lt;P&gt;Also, are you using any example as a base? If so, which configurations are you changing?&lt;/P&gt;
&lt;P&gt;We are not seeing any erratas that could explain the behavior you are seeing. Can you share a capture of the transactions on the BUS where it shows the signals?&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 19:06:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721393#M4758</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2023-09-12T19:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOSAR MCAL SPI starting bit bug</title>
      <link>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721982#M4771</link>
      <description>&lt;P&gt;I am using the S32DS IDE with S32G2 Goldbox Development board. And just using the&amp;nbsp;&lt;STRONG&gt;Spi_Ip_Transfer_S32G274A_M7&amp;nbsp;&lt;/STRONG&gt;example project. The problem wont be seeing by capturing output SPI frames its more like an implementation problem. If I start debugging the project by running the main.c and that line comes which calls&amp;nbsp;&lt;STRONG&gt;Spi_Ip_AsyncTransmit(..)&lt;/STRONG&gt; function:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="spi_1.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/240791iDE41BE0EF3A30D43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="spi_1.png" alt="spi_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this code part is inside&amp;nbsp;&lt;STRONG&gt;Spi_Ip_AsyncTransmit(..)&amp;nbsp;&lt;/STRONG&gt;function and as you can see it wants to check the &lt;STRONG&gt;starting bit (MSB or LSB)&lt;/STRONG&gt; before even the&amp;nbsp;&lt;STRONG&gt;ExternalDevice&amp;nbsp;&lt;/STRONG&gt;structure is being assign which specifies the &lt;STRONG&gt;starting bit.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="spi_2.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/240793iED58474809C749C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="spi_2.png" alt="spi_2.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This data right now is not correct because these are just default values and not the real values which has been set by the configuration.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="spi_3.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/240795iF621330D68CB6C8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="spi_3.png" alt="spi_3.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="spi_4.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/240796iACADC3633B436349/image-size/medium?v=v2&amp;amp;px=400" role="button" title="spi_4.png" alt="spi_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And a few lines later when the&amp;nbsp;&lt;STRONG&gt;ExternalDevice&amp;nbsp;&lt;/STRONG&gt;has been assigned correctly all the relevant values will be updated and after this point should be that check which ask for the &lt;STRONG&gt;starting bit position (if it should be MSB or LSB)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Because the &lt;STRONG&gt;LsbValue &lt;/STRONG&gt;variable&amp;nbsp;already exists but with fake value, then the first SPI message will be sent with fake &lt;STRONG&gt;starting bit value&amp;nbsp;&lt;/STRONG&gt;and it will be correct only at second frame sending because as the&amp;nbsp;&lt;STRONG&gt;Spi_Ip_apxStateStructureArray&lt;/STRONG&gt; is global structure it saves the correct value for later usage.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 11:02:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1721982#M4771</guid>
      <dc:creator>pityu</dc:creator>
      <dc:date>2023-09-13T11:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOSAR MCAL SPI starting bit bug</title>
      <link>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1722433#M4777</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for the feedback, we could reproduce the issue you are mentioning. It seems this was a bug and was corrected under RTD v4.0.0, the modified code should be the following:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielAguirre_0-1694641087217.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/240891i426550C40E8553C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielAguirre_0-1694641087217.png" alt="DanielAguirre_0-1694641087217.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You should be able to modify the function and be able to see it working from the first transaction.&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 21:51:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/AUTOSAR-MCAL-SPI-starting-bit-bug/m-p/1722433#M4777</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2023-09-13T21:51:20Z</dc:date>
    </item>
  </channel>
</rss>

