<?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: Unable to debug the spi_master example demo code in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882932#M35354</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 13px;"&gt;&lt;A _jive_internal="true" class="" data-containerid="-1" data-containertype="-1" data-content-finding="Community" data-objectid="227361" data-objecttype="3" href="https://community.nxp.com/people/Alice_Yang" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 200; font-size: 1.286rem; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Alice_Yang&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 13px;"&gt;I have checked. There is no data available on MOSI pin and clock pin.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Mar 2019 10:44:04 GMT</pubDate>
    <dc:creator>rewatee_poonia</dc:creator>
    <dc:date>2019-03-14T10:44:04Z</dc:date>
    <item>
      <title>Unable to debug the spi_master example demo code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882928#M35350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;I am debugging the example code of lpc17xx SPI master.&lt;/P&gt;&lt;P&gt;Problem: data is not copying in the SPDR data registor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="lpc17xx_spi_master.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/78338iD556F5DA8A309460/image-size/large?v=v2&amp;amp;px=999" role="button" title="lpc17xx_spi_master.PNG" alt="lpc17xx_spi_master.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2019 04:43:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882928#M35350</guid>
      <dc:creator>rewatee_poonia</dc:creator>
      <dc:date>2019-02-25T04:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to debug the spi_master example demo code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882929#M35351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" data-content-finding="Community" data-userid="336131" data-username="rewatee.poonia@bluebinaries.com" href="https://community.nxp.com/people/rewatee.poonia@bluebinaries.com"&gt;rewatee poonia&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;In SPI model of LPC17xx, there is no buffer between the data register and the internal shift register. A write to the&lt;BR /&gt;data register goes directly into the internal shift register, so we can not read the send data in SPI Data Register (S0SPDR).&lt;/P&gt;&lt;P&gt;The SPI Data Register (S0SPDR) is used to provide the transmit and receive data bytes, Read data is buffered.&lt;BR /&gt;When a transfer is complete, the receive data is transferred to a single byte data buffer, where it is later read. A read of the SPI Data Register returns the value of the read data buffer.&lt;/P&gt;&lt;P&gt;About the detail you also can have a look at User manual of your chip , the SPI part:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/38647iB18EC306ED7F7495/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2019 14:38:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882929#M35351</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-02-25T14:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to debug the spi_master example demo code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882930#M35352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 22px;"&gt;Hello&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN style="font-size: 13px;"&gt;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="227361" data-username="Alice_Yang" href="https://community.nxp.com/people/Alice_Yang" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: none; font-size: 1.286rem;"&gt;Alice_Yang&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;I have tried the SPI example with Open LPC1768(Master) microcontroller and Arduino Mega 2560(Slave).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;problem: The data is not getting at the slave arduino.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;I have tried the SPI communication between two arduino mega(MASTER &amp;amp; SLAVE). In that case SPDR is updating. Whatever data i am sending from master, it is getting receive at slave device.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;** In case of open LPC1768&amp;nbsp; it is not working. I am receiving 0 at slave.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;SPI master code (Example code from cmsis library)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; "&gt;I did some changes in spi_master.c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;1. mode 0-&amp;gt;CPHA&amp;nbsp; &amp;amp; CPOL =0 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SPI_ConfigStruct.CPHA = SPI_CPHA_FIRST;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SPI_ConfigStruct.CPOL = SPI_CPOL_HI;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;2.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;#define SPI_DATABIT_SIZE &amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/** Max buffer length */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#define BUFFER_SIZE &amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/P&gt;&lt;P&gt;3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;void Buffer_Init(void)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint32_t i;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (i = 0; i &amp;lt; BUFFER_SIZE; i++) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Tx_Buf[i] = i+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Rx_Buf[i] = 0;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 30px; "&gt;&lt;STRONG&gt;Arduino slave code&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;//SPI SLAVE (ARDUINO)&lt;BR /&gt;#include&amp;lt;SPI.h&amp;gt;&lt;BR /&gt;#define LEDpin 13&lt;BR /&gt;volatile boolean received;&lt;BR /&gt;volatile byte Slavereceived,Slavesend;&lt;BR /&gt;void setup()&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; Serial.begin(115200);&lt;BR /&gt; pinMode(LEDpin,OUTPUT); // Setting pin 7 as OUTPUT&lt;BR /&gt; pinMode(MISO,OUTPUT); //Sets MISO as OUTPUT (Have to Send data to Master IN &lt;BR /&gt;SPI.beginTransaction(SPISettings(2500000, MSBFIRST, SPI_MODE0));&lt;BR /&gt; SPCR |= _BV(SPE); //Turn on SPI in Slave Mode&lt;BR /&gt; SPCR |= _BV(SPIE);&lt;BR /&gt; received = false;&lt;/P&gt;&lt;P&gt;//SPI.attachInterrupt(); //Interuupt ON is set for SPI commnucation&lt;BR /&gt; &lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;ISR (SPI_STC_vect) //Inerrrput routine function &lt;BR /&gt;{&lt;BR /&gt; Slavereceived = SPDR; // Value received from master if store in variable slavereceived&lt;BR /&gt; received = true; //Sets received as True &lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void loop()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;if(received) //Logic to SET LED ON OR OFF depending upon the value recerived from master&lt;BR /&gt; {&lt;BR /&gt; if (Slavereceived==1) &lt;BR /&gt; {&lt;BR /&gt; digitalWrite(LEDpin,HIGH); //Sets pin 7 as HIGH LED ON&lt;BR /&gt; Serial.println("Slave LED ON");&lt;BR /&gt; Serial.println(Slavereceived);&lt;BR /&gt; }else&lt;BR /&gt; {&lt;BR /&gt; digitalWrite(LEDpin,LOW); //Sets pin 7 as LOW LED OFF&lt;BR /&gt; Serial.println("Slave LED OFF");&lt;BR /&gt; Serial.println(Slavereceived);&lt;BR /&gt; } &lt;BR /&gt; Slavesend = 2; &lt;BR /&gt; SPDR = Slavesend; //Sends the&amp;nbsp; value to master via SPDR &lt;BR /&gt; delay(1000); &lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2019 07:43:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882930#M35352</guid>
      <dc:creator>rewatee_poonia</dc:creator>
      <dc:date>2019-02-27T07:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to debug the spi_master example demo code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882931#M35353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;STRONG class=""&gt; &lt;SPAN class=""&gt;rewatee ,&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG class=""&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;First of all , we should confirm&amp;nbsp; there is right output signal on MOSI of LPC1768,&amp;nbsp; Please use logic analyzer check it .&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2019 03:28:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882931#M35353</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-03-05T03:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to debug the spi_master example demo code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882932#M35354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 13px;"&gt;&lt;A _jive_internal="true" class="" data-containerid="-1" data-containertype="-1" data-content-finding="Community" data-objectid="227361" data-objecttype="3" href="https://community.nxp.com/people/Alice_Yang" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 200; font-size: 1.286rem; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Alice_Yang&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 13px;"&gt;I have checked. There is no data available on MOSI pin and clock pin.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2019 10:44:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-debug-the-spi-master-example-demo-code/m-p/882932#M35354</guid>
      <dc:creator>rewatee_poonia</dc:creator>
      <dc:date>2019-03-14T10:44:04Z</dc:date>
    </item>
  </channel>
</rss>

