<?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: Trouble using SPI GetBlockSentStatus() in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494885#M30722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jorge,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works fine this way, thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2016 06:46:50 GMT</pubDate>
    <dc:creator>danielnagy</dc:creator>
    <dc:date>2016-05-06T06:46:50Z</dc:date>
    <item>
      <title>Trouble using SPI GetBlockSentStatus()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494881#M30718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Support and Forum Members,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a project using a Kinetis K64F microcontroller and am having some trouble detecting the end of an SPI transmission. I use Kinetis Design Studio 3.2 and Processor Expert. The microcontroller, an MK64FN1M0VLL12 is on a custom PCB. What I am experiencing is the following:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like send 3 bytes on SPI, where the master is the microcontroller. I set up an output buffer and call the PEx function SPI_SendBlock(). Then I would like to block the program until the transmission of all 3 bytes is done. For this purpose, I call the PEx function SPI_GetBlockSentStatus() in a loop and exit it when the function returns true. However, the function seems to return true well before the transmission completes. In fact, it returns true right after the first byte has been shifted out.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main() function looks like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;#define BUFLEN 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;int main(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // SPI output buffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; uint8 outbuf[BUFLEN];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; PE_low_level_init();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; /*** End of Processor Expert internal initialization.&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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // Fill in SPI output buffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; outbuf[0]=0xAA;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; outbuf[1]=0x00;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; outbuf[2]=0xFF;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // Initialize TestOut pin to 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; TestOut_PutVal(NULL, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; TestOut_PutVal(NULL, 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // Start SPI transmission&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; SPI_SendBlock(SPI_DeviceData, outbuf, BUFLEN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // Wait until all data is sent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; while (!SPI_GetBlockSentStatus(SPI_DeviceData));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // Assert TestOut pin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; TestOut_PutVal(NULL, 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; // Wait forever&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; for(;;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; #ifdef PEX_RTOS_START&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PEX_RTOS_START();&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; /* Startup of the selected RTOS. Macro is defined by the RTOS component. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; #endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; /*** End of RTOS startup code.&amp;nbsp; ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; for(;;){}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a BitIO component (named TestOut) to determine when the program passes the line "while (!SPI_GetBlockSentStatus(SPI_DeviceData));". Capturing the signals with an oscilloscope, I see this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="148476_148476.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/121529iBF8DC7524EED6BCB/image-size/large?v=v2&amp;amp;px=999" role="button" title="148476_148476.png" alt="148476_148476.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SPI.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/56489iB16AA8790EF68F25/image-size/large?v=v2&amp;amp;px=999" role="button" title="SPI.png" alt="SPI.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It can be seen that data transmission works fine, but the TestOut pin (blue channel on the oscilloscope) is asserted after the first byte has been transmitted on the SPI bus.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question would be: Am I misunderstanding the aim of the function SPI_GetBlockSentStatus()? Shouldn't it indicate the very end of the SPI transmission? Could you help me finding out what I am doing wrong?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some additional information:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have reproduced this phenomenon on an FRDM-K22F board with the very same code. The issue there is similar, although TestOut is asserted a little later (during the transmission of the second SPI byte).&lt;/LI&gt;&lt;LI&gt;I have been using SPI_GetBlockReceivedStatus() successfully. There, logical true is only returned, once all of the bytes have been received.&lt;/LI&gt;&lt;LI&gt;Instead of using SPI_GetBlockSentStatus(), I have tried setting a flag in the event function SPI_OnBlockSent(), but the results were exactly the same as with the original method.&lt;/LI&gt;&lt;LI&gt;Here is a similar thread, but no solution was found there, unfortunately: &lt;A _jive_internal="true" data-containerid="2019" data-containertype="14" data-objectid="118176" data-objecttype="1" href="https://community.nxp.com/thread/118176"&gt;K70 SPI transmission end detection?&lt;/A&gt; &lt;/LI&gt;&lt;LI&gt;I am attaching the project for both the custom board with the K64F and the one for the FRDM-K22F board.&lt;/LI&gt;&lt;/UL&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate your help. Thanks and regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&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-337419"&gt;K64F_custom_board_SPIStatusTest.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&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-337419"&gt;FRDM_K22F_SPIStatusTest.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 13:40:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494881#M30718</guid>
      <dc:creator>danielnagy</dc:creator>
      <dc:date>2016-05-03T13:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using SPI GetBlockSentStatus()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494882#M30719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel Nagy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a bug in the SPI PE driver. It actually set the SerFlag when you push all the bytes in the TxFIFO and it doesn´t wait for the data to be shifted, hence, the Serflag is up before the last 2 bytes are shifted. &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;You can fix the problem if you use the EOQ (End Of Queue) flag, it tell you when the end of the transfer is reached. To make this you have to mask your Txcommand with the EOQ bit to indicate that what the last byte is. This has to be done before it push the tx data in the interrupt. So in your SPI interrupt:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;if&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; (DeviceDataPrv-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #0000c0;"&gt;OutSentDataNum&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; == DeviceDataPrv-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #0000c0;"&gt;OutDataNumReq&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;){&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;/* check if it’s the last byte */&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt; text-indent: .5in;"&gt;&lt;EM style="color: black; font-size: 10.0pt; font-family: Consolas;"&gt;TxCommand|= SPI_PUSHR_EOQ_MASK;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;EM style="color: black; font-size: 10.0pt; font-family: Consolas;"&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;SPI_PDD_WriteMasterPushTxFIFOReg(SPI0_BASE_PTR, TxCommand); &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;/* Put a character with command to the transmit register */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;And in your main.c you just have to use the EOQF flag instead of the GetBlockSentStatus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//while (!SPI_GetBlockSentStatus(SPI_DeviceData));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;while&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="color: black; font-size: 10.0pt; font-family: Consolas;"&gt; (!(SPI_PDD_GetInterruptFlags(SPI0_BASE_PTR) &amp;amp; SPI_SR_EOQF_MASK));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;And everything should works fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Hope it helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 18:04:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494882#M30719</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2016-05-04T18:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using SPI GetBlockSentStatus()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494883#M30720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jorge,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your response. I have carried out the change to the SPI driver you suggested, and it did work, however, I am now facing another issue. As you suggested, I took the SPI driver source (SPI.c) and in the function "PE_ISR(SPI_Interrupt)" replaced this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14624621681767969 jive_text_macro" data-renderedposition="138_8_1192_64" jivemacro_uid="_14624621681767969"&gt;&lt;P&gt;if (DeviceDataPrv-&amp;gt;OutSentDataNum == DeviceDataPrv-&amp;gt;OutDataNumReq) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TxCommand &amp;amp;= 0x7FFFFFFFU;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;SPI_PDD_WriteMasterPushTxFIFOReg(SPI1_BASE_PTR, TxCommand); /* Put a character with command to the transmit register */&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14624621800207274 jive_text_macro" data-renderedposition="280_8_1192_64" jivemacro_uid="_14624621800207274"&gt;&lt;P&gt;if (DeviceDataPrv-&amp;gt;OutSentDataNum == DeviceDataPrv-&amp;gt;OutDataNumReq) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TxCommand|= SPI_PUSHR_EOQ_MASK;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;SPI_PDD_WriteMasterPushTxFIFOReg(SPI1_BASE_PTR, TxCommand); /* Put a character with command to the transmit register */&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, I initated one 3-byte long SPI transmission and verifed that the expression "SPI_PDD_GetInterruptFlags(SPI1_BASE_PTR) &amp;amp; SPI_SR_EOQF_MASK" really returned logical true if the whole SPI transmission was completed. However, having made the suggested change to the driver, now I seem not to be able to carry out any further SPI transmissions. My main() funcion is as simple as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14624621926087938 jive_macro_code jive_text_macro" data-renderedposition="474_8_1192_576" jivemacro_uid="_14624621926087938"&gt;&lt;P&gt;int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
 /* Write your local variable definition here */
 // SPI output buffer
 uint8 outbuf[BUFLEN];&lt;/P&gt;&lt;P&gt;/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
 PE_low_level_init();
 /*** End of Processor Expert internal initialization.&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;/P&gt;&lt;P&gt;/* Write your code here */
 /* For example: for(;;) { } */
 // Fill in SPI output buffer
 outbuf[0]=0xAA;
 outbuf[1]=0x00;
 outbuf[2]=0xFF;
 
 for (uint8 i=0; i&amp;lt;5; i++)
 {
&amp;nbsp; // Start SPI transmission
&amp;nbsp; SPI_SendBlock(SPI_DeviceData, outbuf, BUFLEN);&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Wait until all data is sent
&amp;nbsp; while (!(SPI_PDD_GetInterruptFlags(SPI1_BASE_PTR) &amp;amp; SPI_SR_EOQF_MASK));
 }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Wait forever
 for(;;);&lt;/P&gt;&lt;P&gt;/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
&amp;nbsp; /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
&amp;nbsp; #ifdef PEX_RTOS_START
&amp;nbsp;&amp;nbsp;&amp;nbsp; PEX_RTOS_START();&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; /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
&amp;nbsp; #endif
&amp;nbsp; /*** End of RTOS startup code.&amp;nbsp; ***/
&amp;nbsp; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
&amp;nbsp; for(;;){}
&amp;nbsp; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first SPI tranfer in the for loop starts and finishes fine. The rest of them just don't happen, however and the for loop finishes without them being executed. If I leave the SPI driver untouched (and include a fixed, manual delay in my for loop instead of "while (!(SPI_PDD_GetInterruptFlags(SPI1_BASE_PTR) &amp;amp; SPI_SR_EOQF_MASK));"), then all 5 SPI transmissions are executed, as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions to this phenomenon? I highly appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2016 15:31:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494883#M30720</guid>
      <dc:creator>danielnagy</dc:creator>
      <dc:date>2016-05-05T15:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using SPI GetBlockSentStatus()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494884#M30721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel Nagy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This issue is because you the EOQ flag is not cleared, so, in the second the&amp;nbsp; SPI transfer you jump the while instruction and a third transfer is executed. so, after you pass you while, you should clear the flag:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (uint8 i=&lt;SPAN class="number"&gt;0; i&amp;lt;&lt;SPAN class="number"&gt;5&lt;/SPAN&gt;; i++&lt;/SPAN&gt;)&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Start SPI transmission&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI_SendBlock(SPI_DeviceData, outbuf, BUFLEN);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Wait until all data is sent&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!(SPI_PDD_GetInterruptFlags(SPI1_BASE_PTR) &amp;amp; SPI_SR_EOQF_MASK));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear EOQ flag&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;SPI_PDD_ClearInterruptFlags(SPI1_BASE_PTR, SPI_SR_EOQF_MASK);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Hope it helps!&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2016 18:06:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494884#M30721</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2016-05-05T18:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using SPI GetBlockSentStatus()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494885#M30722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jorge,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works fine this way, thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 06:46:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494885#M30722</guid>
      <dc:creator>danielnagy</dc:creator>
      <dc:date>2016-05-06T06:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble using SPI GetBlockSentStatus()</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494886#M30723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jorge,&lt;/P&gt;&lt;P&gt;i saw your suggested modifications for SPI transmission. I am trying to interface MK60FX512 master with AD5421 DAC. Can u suggest the code for receiving the transmitted bytes back to master using SPI_ReceiveBlock?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Sruthy UK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2016 12:25:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Trouble-using-SPI-GetBlockSentStatus/m-p/494886#M30723</guid>
      <dc:creator>sruthyuk</dc:creator>
      <dc:date>2016-07-28T12:25:32Z</dc:date>
    </item>
  </channel>
</rss>

