<?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>Processor Expert SoftwareのトピックRe: SPI SendBlock</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223988#M1065</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Just a note regarding my previous post - I've overlooked that there is missing ! in my last example in the while (in the while&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;(&lt;STRONG&gt;!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;SS1_&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;GetBlockReceivedStatus&lt;/SPAN&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;slaveDevData1&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; )...&amp;nbsp; I fixed it now there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if I understand, but if you need to send sometimes one character and sometimes two, you can just use a variable as a length parameter, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t OutBlock[2];&lt;/P&gt;&lt;P&gt;uint8_t InBlock[2];&lt;/P&gt;&lt;P&gt;uint8_t length;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;if (...) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; OutBlock[0]= 'a';&lt;/P&gt;&lt;P&gt;&amp;nbsp; length = 1;&lt;/P&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; OutBlock[0]= 'b';&lt;/P&gt;&lt;P&gt;&amp;nbsp; OutBlock[1]= 'c';&lt;/P&gt;&lt;P&gt;&amp;nbsp; length = 2;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;err = SS1_ReceiveBlock(slaveDevData1, InBlock, length); /* Request data block reception */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;err = SS1_SendBlock(slaveDevData1, OutBlock, length);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start transmission/reception */&lt;SPAN style="line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;while (!&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;SS1_&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;GetBlockReceivedStatus&lt;/SPAN&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;slaveDevData1&lt;/SPAN&gt;)&lt;/SPAN&gt;); /* Wait until data block is transmitted/received */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;...&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;What does the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;Read_MOSI();&lt;/SPAN&gt; do in your code? I think there should not be anything like this. You should use just functions the component to access the hardware. &lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Petr Hradsky&lt;/P&gt;&lt;P&gt;Processor Expert Support Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2014 10:50:00 GMT</pubDate>
    <dc:creator>Petr_H</dc:creator>
    <dc:date>2014-01-16T10:50:00Z</dc:date>
    <item>
      <title>SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223982#M1059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;n/a&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 00:39:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223982#M1059</guid>
      <dc:creator>mehdikarimibiuk</dc:creator>
      <dc:date>2014-01-09T00:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223983#M1060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There might be issues related to the fact that the slave can send only when it receives clock and data from the master. Please ensure that your master is sending enough charatcters to match what you need from slave. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;You code also doesn't seem to wait until the data are received/sent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please take a look to the Typical usage page of the SPISlave_LDD component help which you can get using the pop-up menu command "Help on component"&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(I suppose you are using SPISlave_LDD).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a part of code copied from that example (mode with interrupts enabled):&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;void main(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; MySPIPtr = SS1_Init(NULL); /* Initialization of SS1 component */&lt;/P&gt;&lt;P&gt;&amp;nbsp; Error = SS1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */&lt;/P&gt;&lt;P&gt;&amp;nbsp; Error = SS1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (!DataReceivedFlag) {}; /* Wait until data block is transmitted/received */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Petr Hradsky&lt;/P&gt;&lt;P&gt;Processor Expert Support Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 15:46:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223983#M1060</guid>
      <dc:creator>Petr_H</dc:creator>
      <dc:date>2014-01-10T15:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223984#M1061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 12.800000190734863px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;n/a&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 17:38:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223984#M1061</guid>
      <dc:creator>mehdikarimibiuk</dc:creator>
      <dc:date>2014-01-10T17:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223985#M1062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to sort it out.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is the similar snippet how I did it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (;;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; err = SS1_ReceiveBlock(slaveDevData1, InpDataSlave1, 2); /* Request data block reception */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; err = SS1_SendBlock(slaveDevData1, &amp;amp;out, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start transmission/reception */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; while (DataReceivedFlagSlave1 != TRUE); /* Wait until data block is transmitted/received */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Read_MOSI();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("TX0 = %x\n", IO_READ32(0x4002c03c));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("TX1 = %x\n", IO_READ32(0x4002c040));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("TX2 = %x\n", IO_READ32(0x4002c044));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("TX3 = %x\n", IO_READ32(0x4002c048));&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and as discussed before in events.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void SS1_OnBlockReceived(LDD_TUserData *UserDataPtr)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; DataReceivedFlagSlave1 = TRUE;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 17:02:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223985#M1062</guid>
      <dc:creator>mehdikarimibiuk</dc:creator>
      <dc:date>2014-01-14T17:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223986#M1063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To reply to your question in previous post: &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; line-height: 1.5em;"&gt;&lt;EM&gt;"I expect that SS1_ReceiveBlock block the for loop until it receives data, is this true?" :&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; line-height: 1.5em;"&gt;No, this is not true. Both ReceiveBlock and SendBlock methods do not wait for end of the operation (they are not "blocking").&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;You have to use the event handler, or you can call &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;GetBlockReceivedStatus and&lt;/SPAN&gt; GetBlockSendStatus to check if the reception/sending has finished (you need to enable these methods then).&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;So your code could optionally be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp; err = SS1_ReceiveBlock(slaveDevData1, InpDataSlave1, 2); /* Request data block reception */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp; err = SS1_SendBlock(slaveDevData1, &amp;amp;out, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start transmission/reception */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; while (!&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;SS1_&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;GetBlockReceivedStatus&lt;/SPAN&gt;(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;slaveDevData1&lt;/SPAN&gt;)&lt;/SPAN&gt;); /* Wait until data block is transmitted/received */&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;...&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;This way you can completely omit the event code if you just need to wait till it's send.&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have noticed one more thing in the code, that I would like to warn about:&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;The boolean values like check &lt;EM&gt;&lt;STRONG&gt;while (DataReceivedFlagSlave1 != TRUE)&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp; may not generally always work in all cases. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;The problem is that true logical value is in C defined as any non-zero value, so if you test to only TRUE which is a number constant (typically 1), it won't work when the value hidden inside the bool variable will be e.g. 255 (which still fulfills the definition of "true" value). &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;There should be &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;instead &lt;/SPAN&gt;used &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;&lt;STRONG&gt;while (!DataReceivedFlagSlave1)&lt;/STRONG&gt; ... .&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Petr Hradsky&lt;/P&gt;&lt;P&gt;Processor Expert Support Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 09:55:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223986#M1063</guid>
      <dc:creator>Petr_H</dc:creator>
      <dc:date>2014-01-15T09:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223987#M1064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/Petr_H"&gt;Petr_H&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have one more question, I sometimes need to send back one block of data and sometimes need to send two blocks of data. How is it possible to handle this in one iteration?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in my for loop after I got all block, I go and check my RX FIFO in my function Read_MOSI(). I know that my data are also in InpDataSlave1, but this is for time being. I check my RX FIFO directly at the moment in my Read_MOSI().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (;;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; err = SS1_ReceiveBlock(slaveDevData1, InpDataSlave1, 1); /* Request data block reception */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; err = SS1_SendBlock(slaveDevData1, &amp;amp;out, 1);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start transmission/reception */&lt;/P&gt;&lt;P style="font-size: 12.800000190734863px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; &lt;STRONG style="font-style: inherit; font-family: inherit;"&gt; &lt;/STRONG&gt;while (&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12.727272033691406px;"&gt;SS1_&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12.727272033691406px;"&gt;GetBlockReceivedStatus&lt;/SPAN&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12.727272033691406px;"&gt;slaveDevData1&lt;/SPAN&gt;)&lt;/SPAN&gt;); /* Wait until data block is transmitted/received */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Read_MOSI();&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;}&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;what if I read my data and see based on my opcode, I have to send two blocks back instead of one block. In my sendblock I am sending one block back at the moment. Is there possible to switch between one and two blocks for sending data out?&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;One solution I could think of is, according to the opcode I receive, I tell one block or two block, then I create a vector:&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;UINT16 outblock[2];&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and put data in each element of it for two blocks and then pass one by one to the out:&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;out = outblock[0];&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;out= outblock[1];&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;but the problem with this is, I don't know where to put my second outblock for proper send out on the second reading?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 17:52:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223987#M1064</guid>
      <dc:creator>mehdikarimibiuk</dc:creator>
      <dc:date>2014-01-15T17:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223988#M1065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Just a note regarding my previous post - I've overlooked that there is missing ! in my last example in the while (in the while&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;(&lt;STRONG&gt;!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;SS1_&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;GetBlockReceivedStatus&lt;/SPAN&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;slaveDevData1&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; )...&amp;nbsp; I fixed it now there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if I understand, but if you need to send sometimes one character and sometimes two, you can just use a variable as a length parameter, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t OutBlock[2];&lt;/P&gt;&lt;P&gt;uint8_t InBlock[2];&lt;/P&gt;&lt;P&gt;uint8_t length;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;if (...) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; OutBlock[0]= 'a';&lt;/P&gt;&lt;P&gt;&amp;nbsp; length = 1;&lt;/P&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; OutBlock[0]= 'b';&lt;/P&gt;&lt;P&gt;&amp;nbsp; OutBlock[1]= 'c';&lt;/P&gt;&lt;P&gt;&amp;nbsp; length = 2;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;err = SS1_ReceiveBlock(slaveDevData1, InBlock, length); /* Request data block reception */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;err = SS1_SendBlock(slaveDevData1, OutBlock, length);&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start transmission/reception */&lt;SPAN style="line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;while (!&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;SS1_&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;GetBlockReceivedStatus&lt;/SPAN&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;slaveDevData1&lt;/SPAN&gt;)&lt;/SPAN&gt;); /* Wait until data block is transmitted/received */&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;...&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;What does the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;Read_MOSI();&lt;/SPAN&gt; do in your code? I think there should not be anything like this. You should use just functions the component to access the hardware. &lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Petr Hradsky&lt;/P&gt;&lt;P&gt;Processor Expert Support Team&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 10:50:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223988#M1065</guid>
      <dc:creator>Petr_H</dc:creator>
      <dc:date>2014-01-16T10:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: SPI SendBlock</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223989#M1066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/Petr_H"&gt;Petr_H&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Yes, I realized that "!" was missing. Thanks for reminding. :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mehdi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jan 2014 01:26:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/SPI-SendBlock/m-p/223989#M1066</guid>
      <dc:creator>mehdikarimibiuk</dc:creator>
      <dc:date>2014-01-18T01:26:28Z</dc:date>
    </item>
  </channel>
</rss>

