<?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: TOK_DNE too long sometimes in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181302#M7399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello, if it can help some people having the same bug, I finally resolved that problem (some time ago now!).&lt;/DIV&gt;&lt;DIV&gt;My software received data from serial port by 128 bytes packet, so I wrote directly on the USB key was I received, 128 bytes each time, instead of keeping a big buffer in memory.&lt;/DIV&gt;&lt;DIV&gt;But sectors on USB key, or mass storage, are 512 bytes long, so I tried to wait for 4 transactions, so 512 bytes,&amp;nbsp;before writing to USB key and it resolves my problem.&lt;/DIV&gt;&lt;DIV&gt;I repeat that the&amp;nbsp;slow transfer&amp;nbsp;occured on some USB keys only. Now the writing is done correctly using 512 bytes.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Frelon&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Nov 2008 21:53:36 GMT</pubDate>
    <dc:creator>Frelon</dc:creator>
    <dc:date>2008-11-28T21:53:36Z</dc:date>
    <item>
      <title>TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181290#M7387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I use the USB stack provided by Freescale on a MCF52211. It works well almost all the time, but sometimes I have speed problems when I write data on&amp;nbsp;some USB keys (2 out of 16 are problematic for now). I think that the problem may be related to ColdFire or USB stack because these 2 keys are working well on Windows.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here is what I have seen: my write test takes about 3 minutes on non-problematic keys. On problematic keys it can takes up to 50 minutes to do the same test. I noticed that the token TOK_DNE (in INT_STAT registry) takes very long to change its state from 0 to 1, so it loops in usb_host_start_transaction() for about 237 ms instead of 1 ms normally (as far I can see).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The loop is the following:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;while((MCF_USB_INT_STAT &amp;amp; (MCF_USB_INT_STAT_TOK_DNE | MCF_USB_INT_STAT_STALL | MCF_USB_INT_STAT_ERROR)) ==0)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (MCF_USB_INT_STAT &amp;amp; MCF_USB_INT_STAT_USB_RST)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; evt_disconnect();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tr_error=tre_disconnected;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return((hcc_u16)-1u);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Note that it doesn't go into the inner loop, which is OK.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Like I said, these keys are working quickly on Windows and they are USB 2.0 (Full speed) like the other ones that work well. Note that it doesn't seem to relate to a USB key manufacturer.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Maybe I can exit the loop if it's too long to go out of it, but I think that if the token is not in its done state, it can be a risk to exit and send new commands before it's ready.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;How can I solve this?&amp;nbsp;&amp;nbsp; Thanks.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 03:13:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181290#M7387</guid>
      <dc:creator>Frelon</dc:creator>
      <dc:date>2008-08-22T03:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181291#M7388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;There are bugs in the CMX example drivers, and I remember one related to data toggle.&amp;nbsp; They sometimes set the tgl_tx and tgl_rx structure members as if they are booleans, and sometimes as actual byte values.&amp;nbsp; I believe these two lines:&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#008000" size="2"&gt;/* After the setup we shall send/receive DATA1 packets. */&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;my_device.eps[ep].tgl_tx=1;&lt;BR /&gt;my_device.eps[ep].tgl_rx=1;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;Should change to:&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;P&gt;&lt;FONT color="#008000" size="2"&gt;/* After the setup we shall send/receive DATA1 packets. */&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;my_device.eps[ep].tgl_tx=&lt;FONT size="2"&gt;BDT_CTL_DATA&lt;/FONT&gt;;&lt;BR /&gt;my_device.eps[ep].tgl_rx=&lt;FONT size="2"&gt;BDT_CTL_DATA&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;I had a number of issues with the CMX stack, so I eventually wrote my own which is on the web at the bottom of this page, as host2.zip, if you want to see it:&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;A href="http://www.cpustick.com/downloads.htm" rel="nofollow" target="_blank"&gt;http://www.cpustick.com/downloads.htm&lt;/A&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;The driver decides between host (talking to MST) and device (exposing FTDI) mode on boot, so you only want the host code paths.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I believe &lt;A href="http://forums.freescale.com/freescale/view_profile?user.id=11361" target="_blank"&gt;&lt;SPAN&gt;fferraro&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp; also found bugs in the CMX stack at:&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;A href="http://forums.freescale.com/freescale/board/message?board.id=CFCOMM&amp;amp;message.id=4954#M4954" target="_blank"&gt;http://forums.freescale.com/freescale/board/message?board.id=CFCOMM&amp;amp;message.id=4954#M4954&lt;/A&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 05:03:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181291#M7388</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2008-08-22T05:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181292#M7389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Sorry to borrow your thread.&lt;BR /&gt;Rich - Does this code support interrupt endpoints in device mode?&lt;BR /&gt;(It look like it does - you pass in -1 to usb_bulk_transfer for an interrupt end point)&lt;BR /&gt;&lt;BR /&gt;Can I use the config tables from the CMX code unchanged?&lt;BR /&gt;&lt;BR /&gt;It might be nice if you made some upper level driver examples available, or explain a bit about the user callbacks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 05:27:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181292#M7389</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-08-22T05:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181293#M7390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi JimDon,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I just added some upper level driver examples to the host2.zip (including scsi.[ch] -- not sure if you saw it before or after I did that).&amp;nbsp; And I'll post some basic commands below.&amp;nbsp; Yes, device mode works with interrupt endpoints (though host mode does not) and the first device I brought up was an accelerometer-based mouse! &lt;IMG alt="Smiley Happy" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="https://community.nxp.com/i/smilies/16x16_smiley-happy.png" title="Smiley Happy" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am just learning how inconsistent different USB MST devices are...&amp;nbsp; I just found one where you *have to* send TUR, Request Sense, TUR, and a bunch of other commands before it will allow you to do a Read10 -- a Request Sense directly on the Read10 won't clear&amp;nbsp;the Unit Attention!!!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;        // set interface        usb_setup(0, SETUP_TYPE_STANDARD, SETUP_RECIP_INTERFACE, 0x0b, 0, 0, 0, &amp;amp;setup);        rv = usb_control_transfer(&amp;amp;setup, NULL, 0);        assert(rv == 0);        // get max lun        usb_setup(1, SETUP_TYPE_CLASS, SETUP_RECIP_INTERFACE, 0xfe, 0, 0, sizeof(max), &amp;amp;setup);        rv = usb_control_transfer(&amp;amp;setup, &amp;amp;max, sizeof(max));        assert(rv == 1 &amp;amp;&amp;amp; max == 0);        // inquiry        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x12;  // inquiry        cdb[4] = 36;        rv = scsi_bulk_transfer(1, cdb, 6, inq, sizeof(inq));        if (rv &amp;lt; 0) {            return rv;        }        assert(rv == sizeof(inq));        led_happy();                // test unit ready        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x00;  // test unit ready        (void)scsi_bulk_transfer(0, cdb, 6, NULL, 0);                // request sense        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x03;  // request sense        cdb[3] = sizeof(sense);        rv = scsi_bulk_transfer(1, cdb, 10, sense, sizeof(sense));        if (rv &amp;lt; 0) {            return rv;        }        assert(rv);        led_happy();                    // test unit ready        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x00;  // test unit ready        rv = scsi_bulk_transfer(0, cdb, 6, NULL, 0);        if (rv &amp;lt; 0) {            return rv;        }        assert(rv == 0);        led_happy();                    // read format capacities        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x23;  // read format capacities        cdb[8] = sizeof(caps);        rv = scsi_bulk_transfer(1, cdb, 12, caps, sizeof(caps));        if (rv &amp;lt; 0) {            return rv;        }        assert(rv);        led_happy();                // read capacity        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x25;  // read capacity        rv = scsi_bulk_transfer(1, cdb, 10, cap, sizeof(cap));        if (rv &amp;lt; 0) {            return rv;        }        assert(rv == sizeof(cap));        led_happy();                // read block        memset(cdb, 0, sizeof(cdb));        cdb[0] = 0x28;  // read10        cdb[2] = sector&amp;gt;&amp;gt;24;        cdb[3] = sector&amp;gt;&amp;gt;16;        cdb[4] = sector&amp;gt;&amp;gt;8;        cdb[5] = sector&amp;gt;&amp;gt;0;        assert(count &amp;lt; 256);        cdb[8] = count;        rv = scsi_bulk_transfer(1, cdb, 10, buffer, count*512);        if (rv &amp;lt; 0) {            return rv;        }        assert(rv == count*512);        led_happy();&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:31:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181293#M7390</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2020-10-29T09:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181294#M7391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;One more thought back to the original post, something you might try is setting MCF_USB_OTG_ENDPT_RETRY_DIS and seeing (now in software, rather than in hardware) if retries are occurring...&amp;nbsp; You'll now get back NAK tokens explicitly (rather than having hardware do a silent retry).&amp;nbsp; Obviously, you want to also notice if you're getting back token statuses of 0 (bus timeout) of 15 (data error) in usb_host_start_transaction(), as well.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2008 00:15:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181294#M7391</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2008-08-23T00:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181295#M7392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Rich,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for your replies,&amp;nbsp;I tried the 3 solution you told me:&lt;/DIV&gt;&lt;DIV&gt;1- &lt;FONT size="2"&gt;BDT_CTL_DATA&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;2- Fferraro's thread&lt;/DIV&gt;&lt;DIV&gt;3- ENDPT0_RETRY_DIS&lt;/DIV&gt;&lt;DIV&gt;Unfortunately,&amp;nbsp;it didn't&amp;nbsp;correct the situation.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Note that&amp;nbsp;ENDPT0_RETRY_DIS was already set.&amp;nbsp;I also&amp;nbsp;disabled it, but it wasn't better.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For the software retry, there is no software retry that occurs because it is outside the problematic loop.&lt;/DIV&gt;&lt;DIV&gt;If you take a look at the code of my first post, it loops until MCF_USB_INT_STAT_TOK_DNE equals 1 (or 8 to be exact). Other token remains at 0 and it's OK for them.&lt;/DIV&gt;&lt;DIV&gt;The result is that there is no error, but it takes a long time to MCF_USB_INT_STAT_TOK_DNE to change its state from 0 to 8, so delays are very long.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I will now try to change registry settings that may have an impact on MCF_USB_INT_STAT_TOK_DNE.&lt;/DIV&gt;&lt;DIV&gt;If you have another ideas, they are welcome,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Frelon&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2008 03:40:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181295#M7392</guid>
      <dc:creator>Frelon</dc:creator>
      <dc:date>2008-08-23T03:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181296#M7393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;gt; Note that&amp;nbsp;ENDPT0_RETRY_DIS was already set.&amp;nbsp;I also&amp;nbsp;disabled it, but it wasn't better.&lt;/DIV&gt;&lt;DIV&gt;&amp;gt; For the software retry, there is no software retry that occurs because it is outside the problematic loop.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So you are saying you tried with RETRY_DIS both set and clear?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The retry actually exactly affects the TOK_DNE loop, since if the target NAK's and hardware retries are enabled (i.e., the bit is clear), then the loop won't complete until the ACK -- the hardware retries automatically as many times as needed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However, if hardware retries are not enabled (i.e., the bit is set), then the loop will complete on the first NAK -- long before the eventual ACK -- and then software is responsible for initiating as many retries as are needed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So in the case of a device that was legitimately taking 10ms to do the ACK, if the first NAK came after 1ms, then with the bit set, your loop would complete in 10ms, and with the bit clear, it would complete (for the first time) in 1ms.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Does that make sense?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hardware retries are really nice (except for interrupt endpoints, obviously, since NAK does not mean you want a retry!), but they can hide long strings of NAKs (or worse yet, infinite strings of NAKs!) from the software, making you wonder what is actually going on.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't suppose you can check what's going on with an analyzer?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2008 03:54:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181296#M7393</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2008-08-23T03:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181297#M7394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Rich hastily said:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;gt; So in the case of a device that was legitimately taking 10ms to do the ACK,&lt;/DIV&gt;&lt;DIV&gt;&amp;gt; if the first NAK came after 1ms, then with the bit set, your loop would&lt;/DIV&gt;&lt;DIV&gt;&amp;gt; complete in 10ms, and with the bit clear, it would complete (for the first time)&lt;/DIV&gt;&lt;DIV&gt;&amp;gt; in 1ms.&lt;/DIV&gt;&lt;DIV&gt;&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;gt; Does that make sense?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It probably would have made more sense if he said exactly the opposite...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;With the bit set (hardware retries disabled), then the NAK would be passed&lt;/DIV&gt;&lt;DIV&gt;back to software in just 1ms.&amp;nbsp; With the bit clear (hardware retries enabled),&lt;/DIV&gt;&lt;DIV&gt;then only the ACK would be passed back to software, after 10ms.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't do double negatives very well... :smileyhappy:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Aug 2008 05:58:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181297#M7394</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2008-08-23T05:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181298#M7395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Rich,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In my last post I made I mistake, MCF_USB_ENDPT0_RETRY_DIS was set only on interrupt endpoints.&lt;/DIV&gt;&lt;DIV&gt;Anyway, I tried MCF_USB_ENDPT0_RETRY_DIS = 1 but I wasn't able to communicate with any USB key at all. The error returned was something like no valid usb key inserted. So I think that disabling hardware retry may not be the way to solve that problem.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Note: for an analyser, I have a scope but no USB analyser.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Frelon&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 22:37:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181298#M7395</guid>
      <dc:creator>Frelon</dc:creator>
      <dc:date>2008-08-29T22:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181299#M7396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Once you set RETRY_DIS to 1, you will most likely start receiving NAK responses back where you used to only get ACK's back before...&amp;nbsp; The USB device will often respond to a command with a NAK, meaning it wants the host to "try again later"...&amp;nbsp; Then it will go&amp;nbsp;fetch the data that was requested by the command it just NAK'd, and wait for the retry.&amp;nbsp; The retry will then be ACK'd.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So once you set RETRY_DIS to 1, you want to make sure your transaction code is retrying any NAK'd commands it issues (unless they are on an interrupt endpoint).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you are running the regular CMX stack, you should follow this code path in usb_host_start_transaction():&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;    case TOKEN_NAK:      /* device is not ready */      MKDBG_TRACE(ev_got_nak, ep);            if (my_device.eps[ep].type == EPTYPE_INT)      {        return(0);      }      /* retry */      break;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;That will retry the NAK'd transaction up to 3 times.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am now wondering if you might be getting many more than 3 NAK's in a row!&amp;nbsp; Which also might be an indicator of your original performance issue...&amp;nbsp; Note that the hardware retry mechanism will retry NAK's indefinitely, so if you wanted to make the software and hardware mechanisms identical, you'd need an infinite retry count.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can you try changing this line in the same function to a very big number (say, 1000000)?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;  hcc_u8 retry=3;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;At that point, you should have software retries behaving just like hardware retries.&amp;nbsp; Then you can instrument your code to see how many NAK's you are actually processing (which are otherwise hidden from your code with the hardware retry mechanism), and then you might have a good clue as to what is going on.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:31:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181299#M7396</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2020-10-29T09:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181300#M7397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;PS In case it is not clear, getting rid of the hardware retry *won't* make things go faster (typically I find software retries a bit slower, actually), but it helps diagnose *why* a TOK_DNE is taking a long time, because you can see if you're getting one (or more) NAK's before the final ACK that results in the TOK_DNE, thereby implicating the device (as opposed to the driver) as the source of the slowness.&amp;nbsp; The only problem with the hardware retry mechanism is that it hides what is really going on from you, especially if you don't have an analyzer.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BTW, if you have a digital storage scope, you can actually track the USB traffic that way, with a bit of effort...&amp;nbsp; I did so here: &lt;A href="http://www.testardi.com/rich/coldfire/bitscope.htm" rel="nofollow" target="_blank"&gt;http://www.testardi.com/rich/coldfire/bitscope.htm&lt;/A&gt;&amp;nbsp;and would be happy to walk you thru the details, if you need.&amp;nbsp; The only thing you really need to do is get a good trigger, and it seems you could just pulse a GPIO pin on the "slow command" completing, and get very close to the issue at hand.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 23:17:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181300#M7397</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2008-08-29T23:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181301#M7398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks for the hint, I will take a look at that!&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2008 01:43:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181301#M7398</guid>
      <dc:creator>Frelon</dc:creator>
      <dc:date>2008-08-30T01:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: TOK_DNE too long sometimes</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181302#M7399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello, if it can help some people having the same bug, I finally resolved that problem (some time ago now!).&lt;/DIV&gt;&lt;DIV&gt;My software received data from serial port by 128 bytes packet, so I wrote directly on the USB key was I received, 128 bytes each time, instead of keeping a big buffer in memory.&lt;/DIV&gt;&lt;DIV&gt;But sectors on USB key, or mass storage, are 512 bytes long, so I tried to wait for 4 transactions, so 512 bytes,&amp;nbsp;before writing to USB key and it resolves my problem.&lt;/DIV&gt;&lt;DIV&gt;I repeat that the&amp;nbsp;slow transfer&amp;nbsp;occured on some USB keys only. Now the writing is done correctly using 512 bytes.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Frelon&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 21:53:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/TOK-DNE-too-long-sometimes/m-p/181302#M7399</guid>
      <dc:creator>Frelon</dc:creator>
      <dc:date>2008-11-28T21:53:36Z</dc:date>
    </item>
  </channel>
</rss>

