<?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>S32K中的主题 LPI2C Slave Callback</title>
    <link>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1520493#M17649</link>
    <description>&lt;P&gt;Hello All, I want to understated the&amp;nbsp;&amp;nbsp;LPI2C Slave Callback&amp;nbsp;&lt;/P&gt;&lt;P&gt;void lpi2c0_SlaveCallback0(i2c_slave_event_t slaveEvent,void *userData);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;what is meant by&amp;nbsp;userData? in the code example it used as the instance&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do :&lt;/P&gt;&lt;P&gt;1- the master will send the frame ID and after that based on this ID the slave will send frame that&amp;nbsp; related to the ID and I want to use the&amp;nbsp;lpi2c0_SlaveCallback0 function but I don't know how to use it&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if anyone&amp;nbsp; could help me in this part?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Sep 2022 10:47:09 GMT</pubDate>
    <dc:creator>RehabSoliman</dc:creator>
    <dc:date>2022-09-12T10:47:09Z</dc:date>
    <item>
      <title>LPI2C Slave Callback</title>
      <link>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1520493#M17649</link>
      <description>&lt;P&gt;Hello All, I want to understated the&amp;nbsp;&amp;nbsp;LPI2C Slave Callback&amp;nbsp;&lt;/P&gt;&lt;P&gt;void lpi2c0_SlaveCallback0(i2c_slave_event_t slaveEvent,void *userData);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;what is meant by&amp;nbsp;userData? in the code example it used as the instance&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do :&lt;/P&gt;&lt;P&gt;1- the master will send the frame ID and after that based on this ID the slave will send frame that&amp;nbsp; related to the ID and I want to use the&amp;nbsp;lpi2c0_SlaveCallback0 function but I don't know how to use it&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if anyone&amp;nbsp; could help me in this part?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 10:47:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1520493#M17649</guid>
      <dc:creator>RehabSoliman</dc:creator>
      <dc:date>2022-09-12T10:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: LPI2C Slave Callback</title>
      <link>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1523613#M17755</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;If slaveListening item is set, the slave interrupt is enabled at initialization time and the slave always listens to the line for a master addressing it. Any events are reported to the application through the callback function provided at initialization time.&lt;/P&gt;
&lt;P&gt;So Master always starts with sending device address with R/W bit. Upon receving this, callback is called with I2C_SLAVE_EVENT_RX_REQ or I2C_SLAVE_EVENT_TX_REQ events depending R/W bit received. You can use LPI2C_DRV_SlaveSetRxBuffer() or LPI2C_DRV_SlaveSetTxBuffer() to provide the appropriate buffers for transmit or receive with given number of bytes to be transfered. As shown in the demo example. &lt;BR /&gt;If master still sending or requesting more bytes you got I2C_SLAVE_EVENT_RX_FULL or I2C_SLAVE_EVENT_TX_EMPTY events and above functions can be called again.&lt;BR /&gt;For stop or repeated start condition detected an I2C_SLAVE_EVENT_STOP event is called.&lt;/P&gt;
&lt;P&gt;So the usage depends on used protocol, I think. Obviously if master request data from specified slave address/register it looks like below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PetrS_0-1663328940853.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/193967iD42B116C71DD6D64/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PetrS_0-1663328940853.png" alt="PetrS_0-1663328940853.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Master sends device address with R/W =0 followed by address/register to be read then repeat start is send. Using driver you got I2C_SLAVE_EVENT_RX_REQ, you define receive buffer. After next byte received you should get I2C_SLAVE_EVENT_STOP event and first byte in receive buffer should be address, in your case ID probably. As master then sends again device address with R/W = 1, you got I2C_SLAVE_EVENT_TX_REQ event an you can specify the TX buffer to be sent.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 11:50:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1523613#M17755</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2022-09-16T11:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: LPI2C Slave Callback</title>
      <link>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1523659#M17758</link>
      <description>&lt;P&gt;thanks for your replay&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the callback function on the slave side in case of the master send Frame ID the salve receive it and push this id to the upper layer to take the data related to this id to send it to the master after send read request but the correct data send to the master in the next request not in the same read request so I need when the master send the frame id the slave take this id and send the data in the same request&lt;/P&gt;&lt;P&gt;I will attach the code of the slave and of the master&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you help me to solve this issue ?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:40:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1523659#M17758</guid>
      <dc:creator>RehabSoliman</dc:creator>
      <dc:date>2022-09-16T13:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPI2C Slave Callback</title>
      <link>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1740402#M27874</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am facing an issue with the example code for the lpi2c_flexio_that the slave doesnot not receive the data even thought i am using the defaults configurations for the example code&amp;nbsp; ,i think the slave callback function is not been called.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 11:35:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPI2C-Slave-Callback/m-p/1740402#M27874</guid>
      <dc:creator>Ayaz</dc:creator>
      <dc:date>2023-10-16T11:35:15Z</dc:date>
    </item>
  </channel>
</rss>

