<?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: MCF52259  FEC  buffer descriptors help in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192153#M8395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vespaman,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much to put this not here. I lost 7 days with full of load for this issue and found your answer. It resolved my issue. if you were here i would have taken you to a meal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Jul 2010 19:30:42 GMT</pubDate>
    <dc:creator>tamirci</dc:creator>
    <dc:date>2010-07-02T19:30:42Z</dc:date>
    <item>
      <title>MCF52259  FEC  buffer descriptors help</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192148#M8390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm struggling to find the bug in my FEC routines.&amp;nbsp; The bug is that my Rx buffer descriptors (BD) never get updated by the FEC.&amp;nbsp; They all stay at their initial value. It's like if the FEC does'nt access the right spot in the memory.&amp;nbsp;&amp;nbsp;&amp;nbsp; Anyways here's some code.&amp;nbsp; I declare 4 Rx BD as follow:&lt;/P&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="font-size: 1;"&gt;/* The DMA descriptors.&amp;nbsp; This is a char array to allow us to align it correctly. */&lt;BR /&gt;static uint8 xFECTxDescriptors_unaligned[ ( configNUM_FEC_TX_BUFFERS * sizeof( FECBD ) ) + 16 ];&lt;BR /&gt;static uint8 xFECRxDescriptors_unaligned[ ( configNUM_FEC_RX_BUFFERS * sizeof( FECBD ) ) + 16 ];&lt;BR /&gt;static FECBD *xFECTxDescriptors;&lt;BR /&gt;static FECBD *xFECRxDescriptors;&lt;BR /&gt;&lt;BR /&gt;/* The DMA buffers.&amp;nbsp; These are char arrays to allow them to be alligned correctly. */&lt;BR /&gt;static uint8 ucFECTxBuffers[ ( configNUM_FEC_TX_BUFFERS * configFEC_BUFFER_SIZE ) + 16 ];&lt;BR /&gt;static uint8 ucFECRxBuffers[ ( configNUM_FEC_RX_BUFFERS * configFEC_BUFFER_SIZE ) + 16 ];&lt;BR /&gt;static uint32 uxNextRxBuffer = 0;&lt;BR /&gt;static uint32 uxNextTxBuffer = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The pointers to the BD rings are set here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Point to the start of the circular Rx buffer descriptor queue */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MCF_FEC_ERDSR = ( volatile uint32 ) &amp;amp;( xFECRxDescriptors[ 0 ] );&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Point to the start of the circular Tx buffer descriptor queue */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MCF_FEC_ETSDR = ( volatile uint32 ) &amp;amp;( xFECTxDescriptors[ 0 ] );&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My "Rxed Frame" ISR routine is called for each new incoming frames, so I know its getting frames. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My project is based on the MCF52259EVB with CodeWarrior 7.1.1a &amp;nbsp; (the patch for 52259)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any suggestions.&lt;/P&gt;&lt;P&gt;FB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Jun 2009 00:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192148#M8390</guid>
      <dc:creator>francois_boucha</dc:creator>
      <dc:date>2009-06-20T00:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: MCF52259  FEC  buffer descriptors help</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192149#M8391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi FB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't see the control field initialisation values, which are a possible cause of problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a code for the RX buffer descriptor initialisation from the uTasker project - it is identical for the M5223x and M5225x. Maybe you see something(?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
  EMRBR = pars-&amp;gt;usSizeRx;                                                // set receive buffer size
  ptrRxBd = ptrBD = (M5223X_FEC_BD *)uMallocAlign((MAX_MALLOC)(sizeof(M5223X_FEC_BD)*NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE), 16); // define memory for rx buffer descriptors (aligned on 16 byte boundary)
  ERDSR = (unsigned long)ptrBD;                                          // set pointer to receive descriptor ring
  ptrBuffer = (unsigned char *)uMallocAlign((MAX_MALLOC)(pars-&amp;gt;usSizeRx*NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE), 16);    // get rx buffer memory
  for (i = 0; i &amp;lt; NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE; i++) {        // initialise each Rx buffer descriptor
      if (i == (NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE - 1)) {
          ptrBD-&amp;gt;usBDControl = (EMPTY_BUFFER | WRAP_BIT);
      }
      else {
          ptrBD-&amp;gt;usBDControl = EMPTY_BUFFER;
      }
      ptrBD-&amp;gt;ptrBD_Data = ptrBuffer;
      ptrBuffer += pars-&amp;gt;usSizeRx;
      ptrBD++;
  }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.uTasker.com" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank"&gt;www.uTasker.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - &lt;SPAN&gt;"Embedding it better..."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:44:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192149#M8391</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-10-29T09:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: MCF52259  FEC  buffer descriptors help</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192150#M8392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A couple of FEC routines I got were originally made for the 5282.&amp;nbsp; Correct me if I'm wrong, but I assume that the 52259 FEC is the same as the 5282's one, so I expect the code to run on both platform.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway,I'm looking at your init code right now.&amp;nbsp; Here some init code I use on some project:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;
static void prvInitialiseFECBuffers( void )
{
    uint32 ux;
    uint8 *pcBufPointer;

    pcBufPointer = &amp;amp;( xFECTxDescriptors_unaligned[ 0 ] );
    while( ( ( uint32 ) pcBufPointer &amp;amp; 0x0fUL ) != 0 )
    {
        pcBufPointer++;
    }
  
    xFECTxDescriptors = ( FECBD * ) pcBufPointer;
  
    pcBufPointer = &amp;amp;( xFECRxDescriptors_unaligned[ 0 ] );
    while( ( ( uint32 ) pcBufPointer &amp;amp; 0x0fUL ) != 0 )
    {
        pcBufPointer++;
    }
  
    xFECRxDescriptors = ( FECBD * ) pcBufPointer;


    /* Setup the buffers and descriptors. */
    pcBufPointer = &amp;amp;( ucFECTxBuffers[ 0 ] );
    while( ( ( uint32 ) pcBufPointer &amp;amp; 0x0fUL ) != 0 )
    {
        pcBufPointer++;
    }

    for( ux = 0; ux &amp;lt; configNUM_FEC_TX_BUFFERS; ux++ )
    {
        xFECTxDescriptors[ ux ].status = TX_BD_TC;
        xFECTxDescriptors[ ux ].data = pcBufPointer;
        pcBufPointer += configFEC_BUFFER_SIZE;
        xFECTxDescriptors[ ux ].length = 0;
    }

    pcBufPointer = &amp;amp;( ucFECRxBuffers[ 0 ] );
    while( ( ( uint32 ) pcBufPointer &amp;amp; 0x0fUL ) != 0 )
    {
        pcBufPointer++;
    }
  
    for( ux = 0; ux &amp;lt; configNUM_FEC_RX_BUFFERS; ux++ )
    {
        xFECRxDescriptors[ ux ].status = RX_BD_E;
        xFECRxDescriptors[ ux ].length = configFEC_BUFFER_SIZE;
        xFECRxDescriptors[ ux ].data = pcBufPointer;
        pcBufPointer += configFEC_BUFFER_SIZE;
    }

    /* Set the wrap bit in the last descriptors to form a ring. */
    xFECTxDescriptors[ configNUM_FEC_TX_BUFFERS - 1 ].status |= TX_BD_W;
    xFECRxDescriptors[ configNUM_FEC_RX_BUFFERS - 1 ].status |= RX_BD_W;

    uxNextRxBuffer = 0;
    uxNextTxBuffer = 0;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Francois&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:44:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192150#M8392</guid>
      <dc:creator>francois_boucha</dc:creator>
      <dc:date>2020-10-29T09:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: MCF52259  FEC  buffer descriptors help</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192151#M8393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am stuck at exactly this problem (rx interrupts, but descriptors left untouched). Also I have done 5280 work before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While searching the forum, I found your post..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you find any resolution to why this happens?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Micael&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2009 21:38:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192151#M8393</guid>
      <dc:creator>vespaman</dc:creator>
      <dc:date>2009-10-20T21:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: MCF52259  FEC  buffer descriptors help</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192152#M8394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found it! Since I was so focused on the FEC stuff, I missed one very important set-up; letting peripherals write to the internal RAM. (MCF_SCM_RAMBAR)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For everyone in the future stumbling onto this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Oct 2009 01:50:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192152#M8394</guid>
      <dc:creator>vespaman</dc:creator>
      <dc:date>2009-10-24T01:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: MCF52259  FEC  buffer descriptors help</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192153#M8395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vespaman,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much to put this not here. I lost 7 days with full of load for this issue and found your answer. It resolved my issue. if you were here i would have taken you to a meal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jul 2010 19:30:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MCF52259-FEC-buffer-descriptors-help/m-p/192153#M8395</guid>
      <dc:creator>tamirci</dc:creator>
      <dc:date>2010-07-02T19:30:42Z</dc:date>
    </item>
  </channel>
</rss>

