• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » Hercules™ Safety Microcontrollers » Hercules™ Safety Microcontrollers Forum » Error using EMAC
Share
Hercules™ Safety Microcontrollers
  • Forum
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

Error using EMAC

This question is not answered
Cristiano Werner Araujo
Posted by Cristiano Werner Araujo
on May 08 2012 10:53 AM
Intellectual280 points

Hello, I'm trying to enable the EMAC/MDIO interfaces in a RM48 HDK.

I've follwed the http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration 

"Programming Sequence using HALCoGen generated drivers", using the LwIp code as a base, but not enabling LwIP, just phy and emac.

I will run other protocol over ethernet rather than IP, so I don't need it. But I'm not able to transmit a packet. I Have made a simple example using a static buffer just to test it. 

----------------------

...

int eth_transmit(uint8_t* buf,uint32_t length)
{
    if( length > 1500 )

        return -1;
    else
    {


         tx_buffer->next = NULL;
         tx_buffer->bufptr = buf;
         tx_buffer->bufoff_len = length;
         tx_buffer->flags_pktlen = length;
         tx_buffer->flags_pktlen |= EMAC_DSC_FLAG_EOP | EMAC_DSC_FLAG_SOP;
         EMACTxHdrDescPtrWrite(MDIO_0_BASE, (unsigned int)(tx_buffer), 1);
         return 0;
    }
}

uint8_t vec[80] = { 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
                                 };

int eth_example_send()
{
      eth_transmit(vec,80);
      return 0;
}

---------------------------

When I run eth_example_send(), I got a Data Abort error from the processor in line  of the emac.c file :

------

valHDPbefWrite = HWREG(emacBase + EMAC_TXHDP(channel));

------

What I'm doing wrong ? I'm missing something ?

Thanks.

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Kevin Lavery
    Posted by Kevin Lavery
    on May 08 2012 16:35 PM
    Intellectual1460 points

    Hello Cristiano,

    Thanks for the forum question.

    Is the emacBase address configured? I looked into the TRM and it shows that "the memory-mapped registers for the EMAC. The base address for these registers is 0xFCF78000."

    Regards,

    Kevin Lavery

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Cristiano Werner Araujo
    Posted by Cristiano Werner Araujo
    on May 09 2012 22:49 PM
    Intellectual280 points

    yes, I have used the HalCoGen 3.0 code ,the dp83640 phy code , the hdkif.c from the lwip port and the Programming Sequence using HALCoGen generated drivers.

    Since in the lwport the order was not the same, I believe some things could be executed in diferent orders without any problem. I've put a debug on my code to check the exact order and how many times each function from the 3 API(MDIO,EMAC and DP83640) are called . So my Init sequence stays this way 

    EMACInit( EMAC_CTRL_BASE, EMAC_BASE)
    MDIOInit(MDIO_0_BASE,MDIO_FREQ_INPUT,MDIO_FREQ_OUTPUT )
    EMACRxBroadCastEnable(EMAC_BASE,0)
    EMACMACSrcAddrSet(EMAC_BASE, __mac__emacAddress)
    EMACMACAddrSet(EMAC_BASE, channel,__mac__emacAddress, EMAC_MACADDR_MATCH) // 8 times
    phyID = Dp83640IDGet(MDIO_0_BASE, __mac__emacPhyAddress)
    MDIOPhyAliveStatusGet(MDIO_0_BASE) >> __mac__emacPhyAddress) & 0x01
    Dp83640LinkStatusGet(MDIO_0_BASE, __mac__emacPhyAddress, 0xFFFF)
    Dp83640AutoNegotiate(MDIO_0_BASE, __mac__emacPhyAddress,(DP83640_100BTX | DP83640_100BTX_FD | DP83640_10BT | DP83640_10BT_FD)) == TRUE
    Dp83640PartnerAbilityGet(MDIO_0_BASE, __mac__emacPhyAddress,&partnr_ablty)
    EMACDuplexSet(EMAC_BASE, phyduplex)
    EMACCoreIntAck(EMAC_BASE, EMAC_INT_CORE0_RX)
    EMACCoreIntAck(EMAC_BASE, EMAC_INT_CORE0_TX)
    EMACRxUnicastSet(EMAC_BASE, 0)
    EMACNumFreeBufSet(EMAC_BASE, 0, 1)
    EMACTxEnable(EMAC_BASE)
    EMACRxEnable(EMAC_BASE)
    EMACRxHdrDescPtrWrite(EMAC_BASE, (uint32_t)rx_buffer, 0)
    EMACMIIEnable(EMAC_BASE)
    EMACTxIntPulseEnable(EMAC_BASE, EMAC_CTRL_BASE, 0, 0)
    EMACRxIntPulseEnable(EMAC_BASE, EMAC_CTRL_BASE, 0, 0)
    EMACTxHdrDescPtrWrite(MDIO_0_BASE, (unsigned int)(tx_buffer), 0)

    Until here it runs without any problem and the exit from the functions are OK.  I've changed the tx_buffer to a static buffer :

    volatile mac_rx_bd_t tx_buffer[80] = (mac_rx_bd_t*)EMAC_CTRL_RAM_BASE;

    volatile mac_rx_bd_t rx_buffer[80] = (mac_rx_bd_t*)(EMAC_CTRL_RAM_BASE + SIZE_EMAC_CTRL_RAM / 2);

    acessing it with   tx_buffer[0] instead of tx_buffer

    I saw also that I was calling 

    EMACTxHdrDescPtrWrite(MDIO_0_BASE, (unsigned int)(tx_buffer), 1);

    instead of

    EMACTxHdrDescPtrWrite(EMAC_BASE, (unsigned int)(tx_buffer), 1);

    this was causing the data abort.

    but I haven't seen any packet on my computer ( I'm running a sniffer in the interface connected to hercules ).

    I didn't finded the mac destiny mac address, I've to assembly the entire eth packet or just write the payload in the buffer descriptor.

    Thanks,

    Cristiano

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pramod Bhardwaj
    Posted by Pramod Bhardwaj
    on May 24 2012 23:48 PM
    Prodigy450 points

    Cristiano,

    From the debugger IDE, Can you check if the EMAC address space is accessible? Eg., TXREVID register should have 0x4EC0020D value. If the value does not match then likely your initialization code is not correct. In this case, how are you generating the initialization code?

    Regards,
    Pramod 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Cristiano Werner Araujo
    Posted by Cristiano Werner Araujo
    on May 28 2012 21:08 PM
    Intellectual280 points

    Pramod,

    The value in the TXREVID( address 0xFCF78000 ) register is "0x4EC0020D".

    I'm generating the code using the sequence from in LWIP webpage.

    I've used the phy driver directly from the lwip project, and wroted my own code for the EMAC based in the demo/page.

    Thanks,

    Cristiano

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use