<?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 Re: S32K144 LPSPI Framesize in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1155537#M8204</link>
    <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;When changing the Code to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/* reset framesize: set bit 11-0 to 0!*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LPSPI1-&amp;gt;TCR &amp;amp;= 0xFFFFF007; /* set first 12 bit (0-11) of 32 bit word to zero*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;//LPSPI1-&amp;gt;TCR |= LPSPI_TCR_FRAMESZ(LPSPI1_TCR_FRMSZE_1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LPSPI1-&amp;gt;TCR |= LPSPI_TCR_FRAMESZ(framesize-1);&lt;/FONT&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;it will change the framesize.&lt;/P&gt;&lt;P&gt;But now i run into the problem of sending 10 Bytes of data, but TDR size is 32Bit. I tried several possibilities, as found in the NXP community:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// for loop: //for ( index = 0; index &amp;lt; sequence_length; ++index) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// for loop: //LPSPI1-&amp;gt;TDR = &amp;amp;txbuffer[index]; /* Transmit data */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// for loop: //}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// cast to 32Bit words&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// LPSPI1-&amp;gt;TDR = ((uint32_t)txbuffer[index] &amp;lt;&amp;lt; 24)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+1] &amp;lt;&amp;lt; 16)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+2] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; /* Transmit data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+3] ) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// LPSPI1-&amp;gt;TDR = ((uint32_t)txbuffer[index+4] &amp;lt;&amp;lt; 24)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+5] &amp;lt;&amp;lt; 16)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+6] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; /* Transmit data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+7] ) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// LPSPI1-&amp;gt;TDR = ((uint32_t)txbuffer[index+8] &amp;lt;&amp;lt; 24)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+9] &amp;lt;&amp;lt; 16);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Nothing is working, also receiving more than 32 Bits is not working!&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;How should the sending and receiving of data greater than 32Bit word file be implemented?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Sep 2020 12:11:03 GMT</pubDate>
    <dc:creator>maurice_mueller</dc:creator>
    <dc:date>2020-09-18T12:11:03Z</dc:date>
    <item>
      <title>S32K144 LPSPI Framesize</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1153362#M8158</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I´m using S32K144 Evalboard and the LPSPI communication. I want to change the framesize from 3Bytes&lt;/P&gt;&lt;P&gt;(framesize -1 = 23) to 10 Bytes (framesize - 1 =79) cause I need to read a whole block (8Bytes) of several registers of the SPI device.&lt;/P&gt;&lt;P&gt;When I change the Framsize from 23 to 79 the LPSPI-&amp;gt;TCR doesn´t take the new value&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;void LPSPI1_setFrameSize(const uint8_t framesize)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;/* check if framesize change is neccessary*/&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;if( ((LPSPI1-&amp;gt;TCR &amp;amp; LPSPI_TCR_FRAMESZ_MASK)&amp;gt;&amp;gt;LPSPI_TCR_FRAMESZ_SHIFT) != (framesize-1) )&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;/* framesize can only be changed if TXMSK bit is cleared by hardware*/&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;/* wait till TXMSK is cleared to set new TCR Framesize*/&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;while((LPSPI1-&amp;gt;TCR &amp;amp; LPSPI_TCR_TXMSK_MASK)&amp;gt;&amp;gt;LPSPI_TCR_TXMSK_SHIFT==1);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;if(framesize &amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;// set minimum framsize to 8Bit&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//LPSPI1-&amp;gt;TCR &amp;amp;= 0xFFFFF000; /* set first 12 bit (0-11) of 32 bit word to zero*/&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;LPSPI1-&amp;gt;TCR |= LPSPI_TCR_FRAMESZ(8-1);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;else&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;/* reset framesize: set bit 11-0 to 0!*/&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;LPSPI1-&amp;gt;TCR &amp;amp;= 0xFFFFF000; /* set first 12 bit (0-11) of 32 bit word to zero*/&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;LPSPI1-&amp;gt;TCR |= LPSPI_TCR_FRAMESZ(framesize-1);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Setting the last 12 Bits to Zero does not work! Could someone please tell me how to change the framesize?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;kind regards &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Maurice&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:56:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1153362#M8158</guid>
      <dc:creator>maurice_mueller</dc:creator>
      <dc:date>2020-09-15T08:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 LPSPI Framesize</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1153544#M8165</link>
      <description>&lt;P&gt;Hello Maurice,&lt;/P&gt;
&lt;P&gt;The TCR register is a FIFO, there might be problems reading it as it is described in the RM, Section 51.4.2.1 Transmit and Command FIFO commands&lt;/P&gt;
&lt;P&gt;And your code performs some read-modify-write operations on the TCR register.&lt;/P&gt;
&lt;P&gt;Instead of masking the register, you can have commands stored as 32b constants and write the TCR register with the constants when you need to change the command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 14:40:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1153544#M8165</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2020-09-15T14:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 LPSPI Framesize</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1155537#M8204</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;When changing the Code to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/* reset framesize: set bit 11-0 to 0!*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LPSPI1-&amp;gt;TCR &amp;amp;= 0xFFFFF007; /* set first 12 bit (0-11) of 32 bit word to zero*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;//LPSPI1-&amp;gt;TCR |= LPSPI_TCR_FRAMESZ(LPSPI1_TCR_FRMSZE_1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LPSPI1-&amp;gt;TCR |= LPSPI_TCR_FRAMESZ(framesize-1);&lt;/FONT&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;it will change the framesize.&lt;/P&gt;&lt;P&gt;But now i run into the problem of sending 10 Bytes of data, but TDR size is 32Bit. I tried several possibilities, as found in the NXP community:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// for loop: //for ( index = 0; index &amp;lt; sequence_length; ++index) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// for loop: //LPSPI1-&amp;gt;TDR = &amp;amp;txbuffer[index]; /* Transmit data */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// for loop: //}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// cast to 32Bit words&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// LPSPI1-&amp;gt;TDR = ((uint32_t)txbuffer[index] &amp;lt;&amp;lt; 24)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+1] &amp;lt;&amp;lt; 16)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+2] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; /* Transmit data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+3] ) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// LPSPI1-&amp;gt;TDR = ((uint32_t)txbuffer[index+4] &amp;lt;&amp;lt; 24)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+5] &amp;lt;&amp;lt; 16)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+6] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; /* Transmit data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+7] ) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// LPSPI1-&amp;gt;TDR = ((uint32_t)txbuffer[index+8] &amp;lt;&amp;lt; 24)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// |((uint32_t)txbuffer[index+9] &amp;lt;&amp;lt; 16);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Nothing is working, also receiving more than 32 Bits is not working!&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;How should the sending and receiving of data greater than 32Bit word file be implemented?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 12:11:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-LPSPI-Framesize/m-p/1155537#M8204</guid>
      <dc:creator>maurice_mueller</dc:creator>
      <dc:date>2020-09-18T12:11:03Z</dc:date>
    </item>
  </channel>
</rss>

