<?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 SPI Slave Receive on LPC 812 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Slave-Receive-on-LPC-812/m-p/564268#M16846</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rorrik on Tue Sep 23 14:53:36 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attempting to use the LPC812 as a relay device for a SPI channel. The goal is to receive a signal and process it in order to send a derived signal on the to the target device. This means that one SPI channel on the LPC812 is functioning as a Master and the other as a Slave. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I seem to have the Master channel working properly. It transmits the correct messages when hard coded to do so and successfully programs the target device.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, on the Slave or receive side, I can't seem to see the signal. I am always stuck in this while loop in the provided ReadFrames function: while (!(Chip_SPI_GetStatus(pSPI) &amp;amp; SPI_STAT_RXRDY)) {}, even though it is while ( !( 0xFF &amp;amp; 0x01 ) ), which should exit immediately.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've removed the loop to get around this problem in the meantime, but somehow my entire signal is missed. I can see that the signal is on the MOSI pin using a O-scope, but in the code, I never see anything non-zero when the pin is set to be MOSI. If I punt and set it to MISO against all logic, I start seeing 0xFF over and over, but only after my signal has already passed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think MOSI is the right way to go, but I can't see a signal there. What am I missing? My Master clock is 100 kHz and I've set the receive clock to 2.4 MHz to be safe: ConfigStruct0.ClkDiv = Chip_SPI_CalClkRateDivider(LPC_SPI0, 2400000); Since I read I needed to be 12x as fast. Do I instead need to change the peripheral clock? How can I do that? Is there something else I should be looking at?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: So far I've just been modifying the example code attached.&lt;/SPAN&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338042"&gt;spi.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:03:12 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:03:12Z</dc:date>
    <item>
      <title>SPI Slave Receive on LPC 812</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Slave-Receive-on-LPC-812/m-p/564268#M16846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rorrik on Tue Sep 23 14:53:36 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attempting to use the LPC812 as a relay device for a SPI channel. The goal is to receive a signal and process it in order to send a derived signal on the to the target device. This means that one SPI channel on the LPC812 is functioning as a Master and the other as a Slave. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I seem to have the Master channel working properly. It transmits the correct messages when hard coded to do so and successfully programs the target device.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, on the Slave or receive side, I can't seem to see the signal. I am always stuck in this while loop in the provided ReadFrames function: while (!(Chip_SPI_GetStatus(pSPI) &amp;amp; SPI_STAT_RXRDY)) {}, even though it is while ( !( 0xFF &amp;amp; 0x01 ) ), which should exit immediately.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've removed the loop to get around this problem in the meantime, but somehow my entire signal is missed. I can see that the signal is on the MOSI pin using a O-scope, but in the code, I never see anything non-zero when the pin is set to be MOSI. If I punt and set it to MISO against all logic, I start seeing 0xFF over and over, but only after my signal has already passed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think MOSI is the right way to go, but I can't see a signal there. What am I missing? My Master clock is 100 kHz and I've set the receive clock to 2.4 MHz to be safe: ConfigStruct0.ClkDiv = Chip_SPI_CalClkRateDivider(LPC_SPI0, 2400000); Since I read I needed to be 12x as fast. Do I instead need to change the peripheral clock? How can I do that? Is there something else I should be looking at?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: So far I've just been modifying the example code attached.&lt;/SPAN&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338042"&gt;spi.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:03:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SPI-Slave-Receive-on-LPC-812/m-p/564268#M16846</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:03:12Z</dc:date>
    </item>
  </channel>
</rss>

