<?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 MicrocontrollersのトピックOnBlockReceived is not called when using SPImaster LDD</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718903#M44065</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am evaluating the Kinetis S9KEAZ128 micro for a design. I am using the FRDM board without modification. I am using KDS v3.2 with Processor Expert to generate code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the SPImaster_LDD component, I am able to send any amount of SPI data bytes without a problem. I am using interrupts. When I attempt to receive spi data, following the example found in the "help with this component", the OnBlockReceived event never occurs. When I stop execution and look at my data structure, it is always filled with n-1 of the bytes transmitted with the last byte never being populated regardless of the length of data sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not able to post my full code but a simplified version of it is given below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;(main.c)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SPI0ptr = SM2_Init(NULL);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint16_t Local_SPI_Timeout = 0xFFFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LDD_TError Local_SPI0_Error;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Local TX/RX Buffers&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint8_t LocalTX[4];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint8_t LocalRX[4];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LocalTX[0] = 0x55;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalTX[1] = 0xaa;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalTX[2] = 0xbe;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalTX[3] = 0xef;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[0] = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[1] = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[2] = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[3] = 0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the GPIO Bit low as a "manual" CS line.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIOA_PCOR |= 1&amp;lt;&amp;lt;28;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Local_SPI0_Error = SM2_ReceiveBlock(SPI0ptr, LocalRX, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Send the SPI data&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Local_SPI0_Error = SM2_SendBlock(SPI0ptr , LocalTX, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the GPIO Bit high as a "manual" CS line.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIOA_PSOR |= 1&amp;lt;&amp;lt;28;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;while (!SPI0_DataReceivedFlag &amp;amp;&amp;amp; (Local_SPI_Timeout &amp;gt; 0))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Local_SPI_Timeout--;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Events.c)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void SM2_OnBlockReceived(LDD_TUserData *UserDataPtr)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SPI0_DataReceivedFlag = TRUE;&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I tie MISO and MOSI together on the FRDM board to test. I would expect the code to execute, OnBlockReceieved to be called, SPI0_DataReceivedFlag to be set to 1, and LocalTX and LocalRX to be equal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happens is that OnBlockReceieved is never called (breakpoint never reached), SPI0_DataReceivedFlag remains zero, and LocalRX[0] = 55, LocalRX[1] = aa, LocalRX[2] = be, LocalRX[3] = 00. I have verified with a scope that the 4 TX bytes are being transmitted correctly with&amp;nbsp; the clocks and CS. This pattern occurs for any length of data. If I set the TX and RX size to 10, 10 bytes will send successfully (verified by scope) and the LocalRX array will be filled with the first 9 and the 10th still set to zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate any suggestions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 May 2018 19:31:50 GMT</pubDate>
    <dc:creator>brianherrold</dc:creator>
    <dc:date>2018-05-01T19:31:50Z</dc:date>
    <item>
      <title>OnBlockReceived is not called when using SPImaster LDD</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718903#M44065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am evaluating the Kinetis S9KEAZ128 micro for a design. I am using the FRDM board without modification. I am using KDS v3.2 with Processor Expert to generate code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the SPImaster_LDD component, I am able to send any amount of SPI data bytes without a problem. I am using interrupts. When I attempt to receive spi data, following the example found in the "help with this component", the OnBlockReceived event never occurs. When I stop execution and look at my data structure, it is always filled with n-1 of the bytes transmitted with the last byte never being populated regardless of the length of data sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not able to post my full code but a simplified version of it is given below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;(main.c)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SPI0ptr = SM2_Init(NULL);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint16_t Local_SPI_Timeout = 0xFFFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LDD_TError Local_SPI0_Error;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Local TX/RX Buffers&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint8_t LocalTX[4];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint8_t LocalRX[4];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LocalTX[0] = 0x55;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalTX[1] = 0xaa;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalTX[2] = 0xbe;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalTX[3] = 0xef;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[0] = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[1] = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[2] = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LocalRX[3] = 0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Set the GPIO Bit low as a "manual" CS line.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIOA_PCOR |= 1&amp;lt;&amp;lt;28;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Local_SPI0_Error = SM2_ReceiveBlock(SPI0ptr, LocalRX, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Send the SPI data&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Local_SPI0_Error = SM2_SendBlock(SPI0ptr , LocalTX, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the GPIO Bit high as a "manual" CS line.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIOA_PSOR |= 1&amp;lt;&amp;lt;28;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;while (!SPI0_DataReceivedFlag &amp;amp;&amp;amp; (Local_SPI_Timeout &amp;gt; 0))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Local_SPI_Timeout--;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Events.c)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void SM2_OnBlockReceived(LDD_TUserData *UserDataPtr)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;SPI0_DataReceivedFlag = TRUE;&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I tie MISO and MOSI together on the FRDM board to test. I would expect the code to execute, OnBlockReceieved to be called, SPI0_DataReceivedFlag to be set to 1, and LocalTX and LocalRX to be equal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happens is that OnBlockReceieved is never called (breakpoint never reached), SPI0_DataReceivedFlag remains zero, and LocalRX[0] = 55, LocalRX[1] = aa, LocalRX[2] = be, LocalRX[3] = 00. I have verified with a scope that the 4 TX bytes are being transmitted correctly with&amp;nbsp; the clocks and CS. This pattern occurs for any length of data. If I set the TX and RX size to 10, 10 bytes will send successfully (verified by scope) and the LocalRX array will be filled with the first 9 and the 10th still set to zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate any suggestions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2018 19:31:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718903#M44065</guid>
      <dc:creator>brianherrold</dc:creator>
      <dc:date>2018-05-01T19:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: OnBlockReceived is not called when using SPImaster LDD</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718904#M44066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;Sorry for the late reply!&lt;/P&gt;&lt;P&gt;Please try to call SM2_SendBlock first then call&amp;nbsp; SM2_ReceiveBlock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Send the SPI data&lt;BR /&gt;Local_SPI0_Error = SM2_SendBlock(SPI0ptr , LocalTX, 4);&lt;/P&gt;&lt;P&gt;// Receive the SPI data&lt;/P&gt;&lt;P&gt;Local_SPI0_Error = SM2_ReceiveBlock(SPI0ptr, LocalRX, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&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>Tue, 08 May 2018 02:13:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718904#M44066</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2018-05-08T02:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: OnBlockReceived is not called when using SPImaster LDD</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718905#M44067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your suggestion. That doesn't appear to help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In desperation, I was trying almost every combination of settings and found that the problem only happens for the .25 us clock period (what I happened to be using). The component functions correctly as described for any clock rate other than .25us Currently I'm running it faster at .083us period and it works fine. Same for slower rates.&amp;nbsp;I made no other changes to my code. Just changed the clock config in PE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still interested in understanding why this is the case if anyone has any insight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Capture.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/28554iECEDDD0D81F883C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 May 2018 13:48:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/OnBlockReceived-is-not-called-when-using-SPImaster-LDD/m-p/718905#M44067</guid>
      <dc:creator>brianherrold</dc:creator>
      <dc:date>2018-05-08T13:48:49Z</dc:date>
    </item>
  </channel>
</rss>

