<?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>LPC MicrocontrollersのトピックRe: i2c transfer keep busy in the event handler</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756229#M30437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, from oscilloscope, I saw the i2c scl from hight to low and keeping low forever.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2018 07:03:23 GMT</pubDate>
    <dc:creator>samchen_tw</dc:creator>
    <dc:date>2018-06-06T07:03:23Z</dc:date>
    <item>
      <title>i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756228#M30436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using NXP OM13088 develop board.&lt;/P&gt;&lt;P&gt;I try example usbd_rom_hid_generic combined with i2c transfer.&lt;/P&gt;&lt;P&gt;I want to do i2c transfer in endpoint handler&lt;/P&gt;&lt;DIV&gt;/* HID Interrupt endpoint event handler. */&lt;BR /&gt;static ErrorCode_t HID_Ep_Hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;USB_HID_CTRL_T *pHidCtrl = (USB_HID_CTRL_T *) data;&lt;BR /&gt;&amp;nbsp;unsigned int report_pending = 0;&lt;BR /&gt;&amp;nbsp;uint8_t ch[2];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;switch (event) {&lt;BR /&gt;&amp;nbsp;case USB_EVT_IN:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;DEBUGOUT("USB_EVT_IN\r\n");&lt;BR /&gt;#if 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;DEBUGOUT("HID_Ep_Hdlr HID_REPORT_INPUT_i2c!\r\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;I2C_XFER_T xfer;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;i2cDev = I2C1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;xfer.slaveAddr = 0x38;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;xfer.rxBuff = ch;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;xfer.txBuff = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;xfer.txSz = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;xfer.rxSz = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;Chip_I2C_MasterRead(i2cDev, xfer.slaveAddr, xfer.rxBuff, xfer.rxSz);&lt;BR /&gt;#endif&lt;BR /&gt;&amp;nbsp;&amp;nbsp;DEBUGOUT("HID_Ep_Hdlr End of HID_REPORT_INPUT\r\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;report_pending = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;break;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;P&gt;I run this code, and found the device would be stuck in the Chip_I2C_EventHandler. The status is keeping I2C_STATUS_BUSY.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;void Chip_I2C_EventHandler(I2C_ID_T id, I2C_EVENT_T event)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;struct i2c_interface *iic = &amp;amp;i2c[id];&lt;BR /&gt;&amp;nbsp;volatile I2C_STATUS_T *stat;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;/* Only WAIT event needs to be handled */&lt;BR /&gt;&amp;nbsp;if (event != I2C_EVENT_WAIT) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return;&lt;BR /&gt;&amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;stat = &amp;amp;iic-&amp;gt;mXfer-&amp;gt;status;&lt;BR /&gt;&amp;nbsp;/* Wait for the status to change */&lt;BR /&gt;&amp;nbsp;while (*stat == I2C_STATUS_BUSY) {printf("Chip_I2C_EventHandler is busy\r\n");}&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Please help how to fix it.&lt;/DIV&gt;&lt;DIV&gt;Thanks.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 01:18:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756228#M30436</guid>
      <dc:creator>samchen_tw</dc:creator>
      <dc:date>2018-06-06T01:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756229#M30437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, from oscilloscope, I saw the i2c scl from hight to low and keeping low forever.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 07:03:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756229#M30437</guid>
      <dc:creator>samchen_tw</dc:creator>
      <dc:date>2018-06-06T07:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756230#M30438</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;Please download the LPCOpen&amp;nbsp; software for OM13088 (LPCXpresso4367 Development Board) from &lt;A href="https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc4300-cortex-m4-m0/lpcopen-software-development-platform-lpc43xx:LPCOPEN-SOFTWARE-FOR-LPC43XX"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;There provides I2C master interrupt/polling demo with below path:&lt;/P&gt;&lt;P&gt;..\lpcopen_3_02_keil_iar_xpresso4337\LPC43xx_18xx\examples_43xx_18xx\periph_i2cm_interrupt&lt;/P&gt;&lt;P&gt;..\lpcopen_3_02_keil_iar_xpresso4337\LPC43xx_18xx\examples_43xx_18xx\periph_i2cm_polling&lt;/P&gt;&lt;P&gt;Please refer above demos about I2C master application.&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Mike&lt;/P&gt;&lt;P&gt;&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>Thu, 07 Jun 2018 08:00:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756230#M30438</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2018-06-07T08:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756231#M30439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your suggenstion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found that we can't do i2c transfer in the usb interrupt handler.&lt;/P&gt;&lt;P&gt;I causes dead lock for waiting i2c interrupt handler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 08:25:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756231#M30439</guid>
      <dc:creator>samchen_tw</dc:creator>
      <dc:date>2018-06-11T08:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756232#M30440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can set a I2C transfer flag at usb interrupt service routine.&lt;/P&gt;&lt;P&gt;The I2C transfer flag will trigger I2C transfer, when exit the usb service routine.&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Mike&lt;/P&gt;&lt;P&gt;&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, 12 Jun 2018 02:05:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756232#M30440</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2018-06-12T02:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756233#M30441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you please help provide sample codes for setting I2C trasnfer flag?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;"&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;"&gt;Sam&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 02:08:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756233#M30441</guid>
      <dc:creator>samchen_tw</dc:creator>
      <dc:date>2018-06-12T02:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756234#M30442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I mentioned I2C transfer flag is just a volatile global variable.&lt;/P&gt;&lt;P&gt;The I2C communication is slow, which shouldn't take place in USB interrupt service routine.&lt;/P&gt;&lt;P&gt;Thank you for the attention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2018 07:52:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756234#M30442</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2018-06-13T07:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: i2c transfer keep busy in the event handler</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756235#M30443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's clear.&lt;/P&gt;&lt;P&gt;I will try i2c transfer in other place.&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 01:28:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/i2c-transfer-keep-busy-in-the-event-handler/m-p/756235#M30443</guid>
      <dc:creator>samchen_tw</dc:creator>
      <dc:date>2018-06-14T01:28:53Z</dc:date>
    </item>
  </channel>
</rss>

