<?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: Slave I2C and Variable Length Receive</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252938#M1482</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;/P&gt;&lt;P&gt;* Regarding CancelBlockReceive - When you use the CancelBlockReceive, you need to call the ReceiveBlock then to clear the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Regarding the reception of variable length data - the steps should be the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. call SlaveReceiveBlock() with the size larger than the part of the packet where you expect the size or command type to get information on the final size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use OnSlaveByteReceived() to process the bytes. If you detect get the size/type information adjust the expected size by calling SlaveUpdateReceiveBlockSize() method here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. After you'll get all the data, the event OnSlaveBlockReceived() is invoked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Continue with the step 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Regarding handling NACK from the master - When the slave receives NACK from the master, there is invoked OnError event, where you can chceck the type using GetError method and in this case it returns LDD_I2C_MASTER_NACK&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you'd like to send NACK from the slave, then you can use the SendAcknowledge method with appropriate parameter.&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Feb 2013 14:47:41 GMT</pubDate>
    <dc:creator>Petr_H</dc:creator>
    <dc:date>2013-02-14T14:47:41Z</dc:date>
    <item>
      <title>Slave I2C and Variable Length Receive</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252937#M1481</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;/P&gt;&lt;P&gt;I'm trying to implement Slave I2C bean on a Kinetis K10, and am a bit confused about the interaction between CancelBlockReceive, GetReceivedBlockStatus, and the ISR and it's associated OnError masks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at the PE code, it looks like an RX cancel will always generate a SLAVE_RX_OVERRUN error as the cancel block receive function doesn't actually cancel and clear out the receive block so much as sets the requested number of bytes to 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working with SM Bus burst reads and with a custom protocol that sends both strings and 16-bit values, and it looks like the only way to handle a NACK from the master is to process the error and generate an RX Overrun error. With the I2C bean as it is, is it necessary to process every byte as it is received and use the UpdateNumReceivedBytes, or is there some better way of managing variable length messages?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 20:22:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252937#M1481</guid>
      <dc:creator>Jeinstei</dc:creator>
      <dc:date>2013-02-08T20:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Slave I2C and Variable Length Receive</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252938#M1482</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;/P&gt;&lt;P&gt;* Regarding CancelBlockReceive - When you use the CancelBlockReceive, you need to call the ReceiveBlock then to clear the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Regarding the reception of variable length data - the steps should be the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. call SlaveReceiveBlock() with the size larger than the part of the packet where you expect the size or command type to get information on the final size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use OnSlaveByteReceived() to process the bytes. If you detect get the size/type information adjust the expected size by calling SlaveUpdateReceiveBlockSize() method here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. After you'll get all the data, the event OnSlaveBlockReceived() is invoked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Continue with the step 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Regarding handling NACK from the master - When the slave receives NACK from the master, there is invoked OnError event, where you can chceck the type using GetError method and in this case it returns LDD_I2C_MASTER_NACK&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you'd like to send NACK from the slave, then you can use the SendAcknowledge method with appropriate parameter.&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 14:47:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252938#M1482</guid>
      <dc:creator>Petr_H</dc:creator>
      <dc:date>2013-02-14T14:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Slave I2C and Variable Length Receive</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252939#M1483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank Petr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I finally worked out the variable byte method, but in fact didn't even need to use it in the end!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CancelBlockReceive issue was very odd to me. If you call CancelBlockReceive and then want to actually cancel the receive, won't a ReceiveBlock of length zero throw an error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 14:53:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252939#M1483</guid>
      <dc:creator>Jeinstei</dc:creator>
      <dc:date>2013-02-14T14:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Slave I2C and Variable Length Receive</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252940#M1484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;After calling the &lt;SPAN style="color: #1f497d;"&gt;CancelBlockReceive&lt;/SPAN&gt;, the data stay in the user buffer (defined by the ReceiveBlock method). After calling the CancelBlockReceive it's possible to call &lt;SPAN style="color: #1f497d;"&gt;ReceiveBlock&lt;/SPAN&gt; with new buffer or with the same old one. If you use the old one, the data will be rewritten. So actually I was not very precise, the ReceiveBlock is to be called for starting reception of the next data, not for just cleaning them.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt;&lt;/SPAN&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 09:03:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252940#M1484</guid>
      <dc:creator>Petr_H</dc:creator>
      <dc:date>2013-02-15T09:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Slave I2C and Variable Length Receive</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252941#M1485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Petr-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if you call a cancel alone, you will receive the RX_BUFFER_OVERFLOW error still? That's what I was seeing in the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Josh E&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 13:28:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252941#M1485</guid>
      <dc:creator>Jeinstei</dc:creator>
      <dc:date>2013-02-15T13:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Slave I2C and Variable Length Receive</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252942#M1486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Petr-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the final question. If the Master sends a STOP, does the receive block end as being a success? I'm trying to figure out how to tell in PE whether we have received a write to switch the active register or just receiving multiple bytes (like SMBus)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 16:44:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/Slave-I2C-and-Variable-Length-Receive/m-p/252942#M1486</guid>
      <dc:creator>Jeinstei</dc:creator>
      <dc:date>2013-02-15T16:44:48Z</dc:date>
    </item>
  </channel>
</rss>

