<?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 FreeRTOS demo for K60 transmitts ethernet frames twice in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447689#M26468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been using the Ethernet code included in the FreeRTOS V8.1 demo for a while in an application, and the outgoing (from the K60) always get sent out twice.&amp;nbsp; I've tried fixing the obvious things in the driver, and without the "double transmits", it doesn't work.&amp;nbsp;&amp;nbsp; We don't use the IP stack - we just send out short custom built Ethernet frames to a Linux machine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code from the tree. &lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;void vEMACWrite(&lt;BR /&gt;void )&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;long x;&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&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; Wait until the second transmission of the last packet has completed. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;for(x = 0; x &amp;lt; emacTX_WAIT_ATTEMPTS; x++ )&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;if(( xTxDescriptors[ 1 ].status &amp;amp; TX_BD_R ) != 0 )&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 1.125in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Descriptor is still active. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 1.125in; font-family: Calibri; font-size: 11pt;"&gt;vTaskDelay(emacTX_WAIT_DELAY_ms );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;else&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 1.125in; font-family: Calibri; font-size: 11pt;"&gt;break;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Is the descriptor free after waiting for it? */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;if(( xTxDescriptors[ 1 ].status &amp;amp; TX_BD_R ) != 0 )&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Something has gone wrong. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;prvResetEverything();&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Setup both descriptors to transmit the frame. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[0 ].data = ( uint8_t * ) __REV( ( unsigned long ) uip_buf );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[0 ].length = __REVSH( uip_len );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[1 ].data = ( uint8_t * ) __REV( ( unsigned long ) uip_buf );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[1 ].length = __REVSH( uip_len );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;uip_buf is being sent by the Tx descriptor. &lt;BR /&gt;Allocate a new buffer&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;for&lt;BR /&gt;use by the stack. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;uip_buf= prvGetNextBuffer();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Clear previous settings and go. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[0 ].status |= ( TX_BD_R | TX_BD_L );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[1 ].status |= ( TX_BD_R | TX_BD_L );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Start the Tx. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;ENET_TDAR= ENET_TDAR_TDAR_MASK;&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;/*-----------------------------------------------------------*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2015 16:09:32 GMT</pubDate>
    <dc:creator>larryc</dc:creator>
    <dc:date>2015-06-10T16:09:32Z</dc:date>
    <item>
      <title>FreeRTOS demo for K60 transmitts ethernet frames twice</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447689#M26468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been using the Ethernet code included in the FreeRTOS V8.1 demo for a while in an application, and the outgoing (from the K60) always get sent out twice.&amp;nbsp; I've tried fixing the obvious things in the driver, and without the "double transmits", it doesn't work.&amp;nbsp;&amp;nbsp; We don't use the IP stack - we just send out short custom built Ethernet frames to a Linux machine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code from the tree. &lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;void vEMACWrite(&lt;BR /&gt;void )&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;long x;&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&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; Wait until the second transmission of the last packet has completed. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;for(x = 0; x &amp;lt; emacTX_WAIT_ATTEMPTS; x++ )&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;if(( xTxDescriptors[ 1 ].status &amp;amp; TX_BD_R ) != 0 )&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 1.125in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Descriptor is still active. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 1.125in; font-family: Calibri; font-size: 11pt;"&gt;vTaskDelay(emacTX_WAIT_DELAY_ms );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;else&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 1.125in; font-family: Calibri; font-size: 11pt;"&gt;break;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Is the descriptor free after waiting for it? */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;if(( xTxDescriptors[ 1 ].status &amp;amp; TX_BD_R ) != 0 )&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;{&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Something has gone wrong. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.75in; font-family: Calibri; font-size: 11pt;"&gt;prvResetEverything();&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Setup both descriptors to transmit the frame. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[0 ].data = ( uint8_t * ) __REV( ( unsigned long ) uip_buf );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[0 ].length = __REVSH( uip_len );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[1 ].data = ( uint8_t * ) __REV( ( unsigned long ) uip_buf );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[1 ].length = __REVSH( uip_len );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;uip_buf is being sent by the Tx descriptor. &lt;BR /&gt;Allocate a new buffer&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;for&lt;BR /&gt;use by the stack. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;uip_buf= prvGetNextBuffer();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Clear previous settings and go. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[0 ].status |= ( TX_BD_R | TX_BD_L );&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;xTxDescriptors[1 ].status |= ( TX_BD_R | TX_BD_L );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;/*&lt;BR /&gt;Start the Tx. */&lt;/P&gt;&lt;P style="margin: 0px 0px 0px 0.375in; font-family: Calibri; font-size: 11pt;"&gt;ENET_TDAR= ENET_TDAR_TDAR_MASK;&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;}&lt;/P&gt;&lt;P style="font-family: Calibri; font-size: 11pt;"&gt;/*-----------------------------------------------------------*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:09:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447689#M26468</guid>
      <dc:creator>larryc</dc:creator>
      <dc:date>2015-06-10T16:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: FreeRTOS demo for K60 transmitts ethernet frames twice</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447690#M26469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm guessing you have based this on a very very old demo that used uIP.&amp;nbsp; uIP is designed to use the minimum amount of RAM possible (and is very clever at how it achieves that).&amp;nbsp; That means you can only have one packet outstanding on the network at any one time.&amp;nbsp; That however makes communication very slow when communicating with a stack that uses delayed acks.&amp;nbsp; Delayed acks are a standard technique used to minimise network traffic.&amp;nbsp; The examples provided a basic web server, but when connecting to the web server from Windows, the delayed ack scheme used on Windows meant there is only one packet sent every 200ms - which was painfully slow.&amp;nbsp; Therefore, each packet was sent twice - that panics Windows into sending its ack immediately - and the web server then appears very fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;A demo using uIP has not been created in a long time.&amp;nbsp; FreeRTOS now has its own TCP/IP stack &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.freertos.org/tcp" rel="nofollow" target="_blank"&gt;http://www.freertos.org/tcp&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 09:47:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447690#M26469</guid>
      <dc:creator>FreeRTOS_org</dc:creator>
      <dc:date>2015-06-11T09:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: FreeRTOS demo for K60 transmitts ethernet frames twice</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447691#M26470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response.&amp;nbsp; I checked the most recent FreeRTOS demo on the web site (8.2) for K60 and it appears to use the same stack and Ethernet code.&amp;nbsp; Are there sources of other demos that use other stacks and Ethernet code?&amp;nbsp; I see other stacks within the EWW project, but the demo that's in there "main-blinky.c" uses the stack with the double transmit code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 19:31:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447691#M26470</guid>
      <dc:creator>larryc</dc:creator>
      <dc:date>2015-06-16T19:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: FreeRTOS demo for K60 transmitts ethernet frames twice</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447692#M26471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like I said - its a very old demo.&amp;nbsp; There will be some new Kinetis demos coming along, but probably on different hardware (frdm).&amp;nbsp; With regards to TCP, our main focus at the moment is our own stack as per the previous link.&amp;nbsp; We have demos for several hardware platforms (two of which are Cortex-M, one is a Cortex-A) - and will be rolling these out over the coming weeks as and when they are tidied up sufficiently.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 20:17:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FreeRTOS-demo-for-K60-transmitts-ethernet-frames-twice/m-p/447692#M26471</guid>
      <dc:creator>FreeRTOS_org</dc:creator>
      <dc:date>2015-06-16T20:17:52Z</dc:date>
    </item>
  </channel>
</rss>

