<?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: Problem with subsequent calls to WriteEp in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535221#M4505</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by giedrius on Tue Jul 09 00:11:44 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, it explains even more than was needed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Solved!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:39:15 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:39:15Z</dc:date>
    <item>
      <title>Problem with subsequent calls to WriteEp</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535219#M4503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by giedrius on Mon Jul 08 09:18:48 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am working with LPC11U37 chip. I have somewhat modified USB CDC example (VCOM removed, more buffering added) and everything is running fine except when two subsequent calls to pUsbApi-&amp;gt;hw-&amp;gt;WriteEP are made. Calling WriteEP twice one after another causes undefined behavior in the data delivered to the PC - most of the time only the data specified in the second call is received on the PC and other times all data is lost.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it incorrect to call WriteEp, do a tiny or no pause, and call it again? If so, how can I check if it is safe to call WriteEp?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535219#M4503</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with subsequent calls to WriteEp</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535220#M4504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Tsuneo on Mon Jul 08 10:29:32 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;WriteEP() should not be called again, until the data on the IN endpoint has been sent out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the endpoint finishes a transaction, a completion interrupt occurs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After seeing this interrupt, your firmware calls next WriteEP().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you working on USB_ROM_CDC example in this code bundle?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Sample Code Bundle for LPC11Uxx Peripherals using LPCXpresso"&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.lpcware.com/content/nxpfile/sample-code-bundle-lpc11uxx-peripherals-using-lpcxpresso&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this example, VCOM_bulk_in_hdlr() callback is registered as the completion callback of the bulk IN endpoint,&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
\USB_ROM_CDC\src\main.c

int main (void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* register endpoint interrupt handler */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ep_indx = (((USB_CDC_EP_BULK_IN &amp;amp; 0x0F) &amp;lt;&amp;lt; 1) + 1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret = pUsbApi-&amp;gt;core-&amp;gt;RegisterEpHandler (hUsb, ep_indx, VCOM_bulk_in_hdlr, &amp;amp;g_vCOM);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may use this callback to know the timing when the last transaction finishes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this example, VCOM_bulk_in_hdlr() is an empty routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
\USB_ROM_CDC\src\main.c

ErrorCode_t VCOM_bulk_in_hdlr(USBD_HANDLE_T hUsb, void* data, uint32_t event) 
{
&amp;nbsp; //VCOM_DATA_T* pVcom = (VCOM_DATA_T*) data;
//&amp;nbsp; Not needed as WriteEP() is called in VCOM_usb_send() immediately.&amp;nbsp; 
//&amp;nbsp; if (event == USB_EVT_IN) {
//&amp;nbsp; }
&amp;nbsp; return LPC_OK;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you wouldn't use g_vCOM.send_fn, you should fill it with some code, like,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a) Send the next and latter packets with WriteEP(), to send a data block (transfer) greater than 64 bytes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b) raise a flag which shows that the endpoint is available again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tsuneo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535220#M4504</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with subsequent calls to WriteEp</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535221#M4505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by giedrius on Tue Jul 09 00:11:44 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, it explains even more than was needed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Solved!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-with-subsequent-calls-to-WriteEp/m-p/535221#M4505</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:15Z</dc:date>
    </item>
  </channel>
</rss>

