<?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: LPC82x mcu spi - slave data reception from master is always 255 / 0xFF in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1789023#M55147</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;This is the spi connection between slave spi of LPC82x and master spi.&lt;/P&gt;
&lt;P&gt;Master&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slave&lt;/P&gt;
&lt;P&gt;MOSI ---------&amp;gt; MISO&lt;/P&gt;
&lt;P&gt;MISO ---------&amp;gt; MOSI&lt;/P&gt;
&lt;P&gt;SCK ---------&amp;gt; SCK&lt;/P&gt;
&lt;P&gt;GPIO&amp;nbsp;&amp;nbsp; --------&amp;gt;any port pin for example PIO0_10&lt;/P&gt;
&lt;P&gt;You have to use the code to configure the sselx pin.&lt;/P&gt;
&lt;P&gt;SWM-&amp;gt;PINASSIGN[4]|=0xFF00FFFF;&lt;/P&gt;
&lt;P&gt;SWM-&amp;gt;PINASSIGN[4]|=0x0A0000;&lt;/P&gt;
&lt;P&gt;Then the PIO0_10 will function as slave spi SSEL pin.&lt;/P&gt;
&lt;P&gt;2)I do not think it is good method to read the spi data register periodically.&lt;/P&gt;
&lt;P&gt;You should use polling mode or interrupt mode to check if there is data in receiver reg, if there is, just read it.&lt;/P&gt;
&lt;P&gt;while(1)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;while(!(SPI-&amp;gt;STAT&amp;amp;0x01)) {}&lt;/P&gt;
&lt;P&gt;uint32_t temp=SPI-&amp;gt;RXDAT;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2024 01:21:16 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2024-01-16T01:21:16Z</dc:date>
    <item>
      <title>LPC82x mcu spi - slave data reception from master is always 255 / 0xFF</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1787790#M55136</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to receive data (as a slave) from another mcu(master) via SPI. I am using SPI_SlaveTransferNonBlocking function call to read the received data. When i print the received data on the console it is always 255. The data i am sending from master is 170(0xAA).&lt;/P&gt;&lt;P&gt;I checked the signal output from MOSI and SCK from master end, the data 0xAA is displayed properly along with clock signal on the DSO.&lt;/P&gt;&lt;P&gt;Important thing is, i did not configure SSEL pin on slave mcu(LPC82x) since we did not have enough pins and also we use only one slave to communicate.&lt;/P&gt;&lt;P&gt;I enabled slave on spi_slave_config_t struct, both clock phase and polarity are same configuration on both sides.&lt;/P&gt;&lt;P&gt;polarity - KSPI_ClockPolarityActiveHigh&lt;/P&gt;&lt;P&gt;phase - KSPI_ClockPhaseFirstEdge&lt;/P&gt;&lt;P&gt;The wiring connection between master and slave is,&lt;/P&gt;&lt;P&gt;Master&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; slave&lt;/P&gt;&lt;P&gt;MOSI&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ---------&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;MISO&lt;/P&gt;&lt;P&gt;MISO&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ---------&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;MOSI&lt;/P&gt;&lt;P&gt;SCK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ---------&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SCK&lt;/P&gt;&lt;P&gt;Please help me if you know where i am going wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 07:28:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1787790#M55136</guid>
      <dc:creator>HariNandhan</dc:creator>
      <dc:date>2024-01-12T07:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: LPC82x mcu spi - slave data reception from master is always 255 / 0xFF</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1787889#M55138</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Based on SPI protocol, the /SS pin of spi slave must be asserted when the master transfers data so that the slave can receive the data.&lt;/P&gt;
&lt;P&gt;In other words, the spi master must connect the /CS signal or GPIO signal to the /SS pin of slave spi so that the spi slave knows when it receives the&amp;nbsp; data.&lt;/P&gt;
&lt;P&gt;In other words, you have to connect the /CS pin of master spi to one of spi0_SSEL0/1/2 pin, which is selected with SWM.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1705050015848.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/257960i35F7D5500AB03E6C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1705050015848.png" alt="xiangjun_rong_0-1705050015848.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 09:02:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1787889#M55138</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2024-01-12T09:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: LPC82x mcu spi - slave data reception from master is always 255 / 0xFF</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1788324#M55143</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help !&lt;/P&gt;&lt;P&gt;I configured the spi master mcu gpio to toggle during transmission to slave, (High before start to send &amp;amp; low after finish sending - vice versa).&lt;/P&gt;&lt;P&gt;Master sends 1 byte data to slave every 1 second, slave tries to read at every 500ms(tested to read data at the minimum of 10 ms)&lt;/P&gt;&lt;P&gt;During debugging slave mcu i checked upon the registers, the RXOV &amp;amp; TXUV bits were set. My understanding is sending data continuously at 1 second interval and reading at every 500ms isn't gonna set these bits. Also i am sending a 1 byte data.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HariNandhan_0-1705144579223.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/258072iA7D43B3CD3B0E60D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HariNandhan_0-1705144579223.png" alt="HariNandhan_0-1705144579223.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me where i am going wrong.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 11:17:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1788324#M55143</guid>
      <dc:creator>HariNandhan</dc:creator>
      <dc:date>2024-01-13T11:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: LPC82x mcu spi - slave data reception from master is always 255 / 0xFF</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1789023#M55147</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;This is the spi connection between slave spi of LPC82x and master spi.&lt;/P&gt;
&lt;P&gt;Master&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slave&lt;/P&gt;
&lt;P&gt;MOSI ---------&amp;gt; MISO&lt;/P&gt;
&lt;P&gt;MISO ---------&amp;gt; MOSI&lt;/P&gt;
&lt;P&gt;SCK ---------&amp;gt; SCK&lt;/P&gt;
&lt;P&gt;GPIO&amp;nbsp;&amp;nbsp; --------&amp;gt;any port pin for example PIO0_10&lt;/P&gt;
&lt;P&gt;You have to use the code to configure the sselx pin.&lt;/P&gt;
&lt;P&gt;SWM-&amp;gt;PINASSIGN[4]|=0xFF00FFFF;&lt;/P&gt;
&lt;P&gt;SWM-&amp;gt;PINASSIGN[4]|=0x0A0000;&lt;/P&gt;
&lt;P&gt;Then the PIO0_10 will function as slave spi SSEL pin.&lt;/P&gt;
&lt;P&gt;2)I do not think it is good method to read the spi data register periodically.&lt;/P&gt;
&lt;P&gt;You should use polling mode or interrupt mode to check if there is data in receiver reg, if there is, just read it.&lt;/P&gt;
&lt;P&gt;while(1)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;while(!(SPI-&amp;gt;STAT&amp;amp;0x01)) {}&lt;/P&gt;
&lt;P&gt;uint32_t temp=SPI-&amp;gt;RXDAT;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 01:21:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC82x-mcu-spi-slave-data-reception-from-master-is-always-255/m-p/1789023#M55147</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2024-01-16T01:21:16Z</dc:date>
    </item>
  </channel>
</rss>

