<?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>Kinetis Design StudioのトピックRe: K22F SPI recieving 0</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612694#M7765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using KDS 3.2.0, I've pasted a screenshot of my Version IDs (build numbers?) for KDS prerequisites:&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15241i4E99E44368DCEB7D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My PE SPI settings are pasted below. This screenshot was taken today when I'd temporarily disabled the SPI module for unrelated reasons, but at the time I was debugging, it was enabled.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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/15200iAC94CE8E6D694798/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;Code samples:&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TDeviceData * SPI1DeviceDataPtr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;void InitSPI()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;SPI1DeviceDataPtr = SM1_Init(NULL);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;return;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;void SendByteSPI1(byte data)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TError er = ERR_OK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;er = SM1_SendBlock(SPI1DeviceDataPtr, &amp;amp;data, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; while (!SM1_GetBlockSentStatus(SPI1DeviceDataPtr)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; SM1_Main(SPI1DeviceDataPtr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;if (er != ERR_OK)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;printf("Error sending byte on SPI1\n");&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;return;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;char RecieveByteSPI1()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;char b, dummy;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;byte inBuffer [2];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;dummy = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TError er;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TData * receivePtr = &amp;amp;b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;er = SM1_ReceiveBlock(SPI1DeviceDataPtr, (LDD_TData*) &amp;amp;inBuffer, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;er = SM1_SendBlock(SPI1DeviceDataPtr, &amp;amp;dummy, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; while (!SM1_GetBlockSentStatus(SPI1DeviceDataPtr)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; SM1_Main(SPI1DeviceDataPtr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;//TODO: Shouldn't be necessary to manually read from POPR register&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;b = (uint16_t)SPI_PDD_ReadPopRxFIFOReg(SPI1_BASE_PTR); /* Read character from receiver */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;return b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Mar 2017 22:00:36 GMT</pubDate>
    <dc:creator>asfarley</dc:creator>
    <dc:date>2017-03-02T22:00:36Z</dc:date>
    <item>
      <title>K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612691#M7762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working with an SPI barometer trying to get the K22F reading SPI responses using an SPIMaster_LDD PE component. I've scoped the bus&amp;nbsp;lines - everything looks correct. K22F sends a "read address" byte, barometer then clocks out the values for the byte, then CS is set high. I'm manually driving CS to ensure that it stays low between request/read transmissions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've had to add a work-around&amp;nbsp;for&amp;nbsp;the PE SPI driver bug where the function&amp;nbsp;SM1_GetBlockReceivedStatus returns before the byte is actually recieved by adding a fixed delay afterwards:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;char RecieveByteSPI1()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; char b, dummy;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; dummy = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; LDD_TError er;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;er = SM1_ReceiveBlock(SPI1DeviceDataPtr, &amp;amp;b, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; er = SM1_SendBlock(SPI1DeviceDataPtr, &amp;amp;dummy, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; while (!SM1_GetBlockSentStatus(SPI1DeviceDataPtr)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; SM1_Main(SPI1DeviceDataPtr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; // /* Wait until data block is transmitted/received */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; while (!SM1_GetBlockReceivedStatus(SPI1DeviceDataPtr)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; SM1_Main(SPI1DeviceDataPtr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;return b;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the delay, I can see that the SPI bus transaction happens correctly at the electrical level. However, the variable b is not populated when the code returns. The SPI1 register POPR/RXDATA shows that it holds the expected value just before this function returns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SPI1 is configured to *not* use interrupts. Aside from that, it's basically at default settings. Any idea what could be going wrong here?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Updates:&lt;/P&gt;&lt;P&gt;1) Manually reading from POPR after receiving seems to fix the issue. Not sure why this is necessary:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;b = (uint16_t)SPI_PDD_ReadPopRxFIFOReg(SPI1_BASE_PTR); /* Read character from receiver */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I found other reports (&lt;A href="https://community.nxp.com/thread/307520"&gt;Is anyone really using PE Generated SPI driver with MQXLite? How?&lt;/A&gt;&amp;nbsp;) of PE SPI issues where GetBlockReceivedStatus wasn't working and a different flag was used to check if reception was complete. However, it looks like the receive-commplete flag is never set, and my SendByteSPI1 function hangs on this line:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;while (!(SPI_PDD_GetInterruptFlags(SPI1_BASE_PTR) &amp;amp; SPI_SR_EOQF_MASK));//wait for the end of transfer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just noticed this issue related to using a GPIO for CS, although I'm using a different MCU:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/379099"&gt;SPI with no CS. Problem with PE&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------&lt;/P&gt;&lt;P&gt;Edit 2017-07-11&lt;/P&gt;&lt;P&gt;Here are a couple of discussions on what may be the same issue:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/105474"&gt;SPI Example&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/342498"&gt;https://community.nxp.com/thread/342498&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Mar 2017 19:33:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612691#M7762</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-03-01T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612692#M7763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EOQ (end of queue) IS NOT a 'receive complete' flag.&amp;nbsp; That is a 'TX-FIFO flag' block-send can use.&amp;nbsp; Receive-data-available is RFDF.&amp;nbsp; As for CS, look into the CONT bit-setting to keep CS 'active' between 'parts' of an otherwise contiguous set of SPI transfers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Mar 2017 21:16:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612692#M7763</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2017-03-01T21:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612693#M7764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Earl.&lt;/P&gt;&lt;P&gt;To solve your problem, we need to know your SW version:&lt;/P&gt;&lt;P&gt;- Start the IDE and click on Help | About CodeWarrior(KDS) Development Studio. Send me the version and build id.&lt;/P&gt;&lt;P&gt;- send me your demo code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will check it from my side. Thanks.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Jennie Zhang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 07:09:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612693#M7764</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2017-03-02T07:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612694#M7765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using KDS 3.2.0, I've pasted a screenshot of my Version IDs (build numbers?) for KDS prerequisites:&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/15241i4E99E44368DCEB7D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My PE SPI settings are pasted below. This screenshot was taken today when I'd temporarily disabled the SPI module for unrelated reasons, but at the time I was debugging, it was enabled.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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/15200iAC94CE8E6D694798/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;Code samples:&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TDeviceData * SPI1DeviceDataPtr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;void InitSPI()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;SPI1DeviceDataPtr = SM1_Init(NULL);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;return;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;void SendByteSPI1(byte data)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TError er = ERR_OK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;er = SM1_SendBlock(SPI1DeviceDataPtr, &amp;amp;data, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; while (!SM1_GetBlockSentStatus(SPI1DeviceDataPtr)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; SM1_Main(SPI1DeviceDataPtr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;if (er != ERR_OK)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;printf("Error sending byte on SPI1\n");&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;return;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;char RecieveByteSPI1()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;char b, dummy;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;byte inBuffer [2];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;dummy = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TError er;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;LDD_TData * receivePtr = &amp;amp;b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;er = SM1_ReceiveBlock(SPI1DeviceDataPtr, (LDD_TData*) &amp;amp;inBuffer, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;er = SM1_SendBlock(SPI1DeviceDataPtr, &amp;amp;dummy, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; while (!SM1_GetBlockSentStatus(SPI1DeviceDataPtr)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; SM1_Main(SPI1DeviceDataPtr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;WAIT1_Waitms(2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;//TODO: Shouldn't be necessary to manually read from POPR register&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;b = (uint16_t)SPI_PDD_ReadPopRxFIFOReg(SPI1_BASE_PTR); /* Read character from receiver */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;return b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:00:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612694#M7765</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-03-02T22:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612695#M7766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please send us your demo project rather than a piece of code.&lt;/P&gt;&lt;P&gt;you posted a SPI setting screenshot, what is it related with your original question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jennie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2017 08:46:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612695#M7766</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2017-03-13T08:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612696#M7767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's still not clear why you are spinning on a SENT status while waiting for a RECEIVE byte/word.&amp;nbsp; TX is 'done' at least 1/2 Sclk before RX.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Mar 2017 13:42:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612696#M7767</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2017-03-16T13:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612697#M7768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't find the post now but at one point I saw another issue where the user was seeing that the RECEIVE flag was never being set. I used the SENT status as the next-best thing based on the idea that they're clocked in/out at the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It didn't occur to me that there would be a difference between recieve-complete and send-complete in this situation, but I see what you mean about the 1/2 Sclk difference. That could have been part of the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, this issue is on hold for me since it's not pressing. I will post a cut-down example when I get a chance.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Apr 2017 20:38:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612697#M7768</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-04-25T20:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612698#M7769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally had a chance to update this issue. I've created a minimal example to demo this issue here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://u59343634.dl.dropboxusercontent.com/u/59343634/Minimal%20SPI%20Issue%20Demo.zip" title="https://u59343634.dl.dropboxusercontent.com/u/59343634/Minimal%20SPI%20Issue%20Demo.zip"&gt;https://u59343634.dl.dropboxusercontent.com/u/59343634/Minimal%20SPI%20Issue%20Demo.zip&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This project just sets up SPI1 and attempts to talk to a device on the other end. To recap, the current issues I'm seeing are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) The received bytes have to be read manually from POPR, they don't appear in the user-supplied receive buffer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) A mysterious 10ms delay is necessary between transmit and receive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jul 2017 20:35:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612698#M7769</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-07-11T20:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: K22F SPI recieving 0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612699#M7770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jennie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wanted to bump this issue - I've uploaded a demo project to reproduce the issue. I don't know if you'll be able to reproduce without having another SPI device attached, but at least you can take a look.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 18:17:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/K22F-SPI-recieving-0/m-p/612699#M7770</guid>
      <dc:creator>asfarley</dc:creator>
      <dc:date>2017-07-20T18:17:42Z</dc:date>
    </item>
  </channel>
</rss>

