This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSCNCD28388D: enet_lwip fails when changing IP and MAC address

Part Number: TMDSCNCD28388D
Other Parts Discussed in Thread: C2000WARE

Hi Team,

Posting on behalf of our customer.

I am running the enet_lwip example code on the TMDSCNCD28388D using C2000Ware_6_00_01_00. The example works properly with the default dynamic IP / MAC settings, but stops working after I change the IP address and MAC address.

OBSERVED:

C:\Users\gpc3>ping 192.168.1.190

Pinging 192.168.1.190 with 32 bytes of data:
Reply from 192.168.1.53: Destination host unreachable.
Reply from 192.168.1.53: Destination host unreachable.
Reply from 192.168.1.53: Destination host unreachable.
Reply from 192.168.1.53: Destination host unreachable.

Ping statistics for 192.168.1.190:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

 

//###########################################################################
//
// FILE:   enet_lwip.c
//
// TITLE:  lwIP based Ethernet Example.
//
//###########################################################################
// $TI Release: $
// $Release Date: $
// 
// C2000Ware v6.00.01.00
//
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
//
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions 
// are met:
// 
//   Redistributions of source code must retain the above copyright 
//   notice, this list of conditions and the following disclaimer.
// 
//   Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the 
//   documentation and/or other materials provided with the   
//   distribution.
// 
//   Neither the name of Texas Instruments Incorporated nor the names of
//   its contributors may be used to endorse or promote products derived
//   from this software without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################

#include <string.h>

#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_emac.h"

#include "driverlib_cm/ethernet.h"
#include "driverlib_cm/gpio.h"
#include "driverlib_cm/interrupt.h"
#include "driverlib_cm/flash.h"

#include "driverlib_cm/sysctl.h"
#include "driverlib_cm/systick.h"

#include "utils/lwiplib.h"
#include "driver/device.h"
#include "driver/ethernet.h"
#include "board_drivers/pinout.h"

#include "lwip/apps/httpd.h"

#include "lwipopts.h"
//*****************************************************************************
//
//! \addtogroup master_example_list
//! <h1>Ethernet with lwIP (enet_lwip)</h1>
//!
//! This example application demonstrates the operation of the F2838x
//! microcontroller Ethernet controller using the lwIP TCP/IP Stack. Once
//! programmed, the device sits endlessly waiting for ICMP ping requests. It
//! has a static IP address. To ping the device, the sender has to be in the
//! same network. The stack also supports ARP.
//!
//! For additional details on lwIP, refer to the lwIP web page at:
//! savannah.nongnu.org/.../
//
//*****************************************************************************

#define MAKE_IP_ADDRESS(a0,a1,a2,a3) (((a0<<24) & 0xFF000000) | ((a1<<16) & 0x00FF0000) | ((a2<<8)  & 0x0000FF00) | (a3 & 0x000000FF) )

#define RX_ISR_BIT  1
#define TX_ISR_BIT  4

#define RX_ISR_MASK (1 << RX_ISR_BIT)
#define TX_ISR_MASK (1 << TX_ISR_BIT)

/*
g_uiISRsignal variable signals the Interrupt.
*/
uint32_t g_uiISRsignal = 0;


const unsigned long IPAddr =  0xC0A801BE; // 0xC0A80004; //192.168.1.190
const unsigned long NetMask = 0xFFFFFF00;
const unsigned long GWAddr = 0x00000000;

Ethernet_Handle emac_handle;
Ethernet_InitConfig *pInitCfg;
extern Ethernet_Device Ethernet_device_struct;

/*
systick Timer acts as source for lwip timer,
125000 implies 1ms.
*/
const uint32_t systickPeriodValue = 125000;


/***********************************************************************************************
 * Ethernet_transmitISRCustom
 * 
 * This function is a custom interrupt service routine (ISR) for handling Ethernet
 * transmission interrupts. It is called when a packet is succesfully transmitted.
 * 
 ************************************************************************************************/
void Ethernet_transmitISRCustom(void);
/************************************************************************************************
 * Ethernet_receiveISRCustom
 * 
 * This function is a custom interrupt service routine (ISR) for handling Ethernet
 * reception interrupts. It is called when a packet is received.
 * 
************************************************************************************************/
void Ethernet_receiveISRCustom(void);
//*****************************************************************************
//
//  This function is a callback function called by the example to
//  get a Packet Buffer. Has to return a Ethernet_Pkt_Desc Structure.
//  Rewrite this API for custom use case.
//
//*****************************************************************************
Ethernet_Pkt_Desc* Ethernet_getPacketBufferCustom(void)
{
    Ethernet_Pkt_Desc* pktPtr = lwIP_getFreePacket();
    ENET_DRIVER_STATS_INC(RXgetPacketBuffer);
    return (pktPtr);
}

//*****************************************************************************
//
//  This is a hook function and called by the driver when it receives a
//  packet. Application is expected to replenish the buffer after consuming it.
//  Has to return a ETHERNET_Pkt_Desc Structure.
//  Rewrite this API for custom use case.
//
//*****************************************************************************
Ethernet_Pkt_Desc* Ethernet_receivePacketCallbackCustom(
        Ethernet_Handle handleApplication,
        Ethernet_Pkt_Desc *pPacket)
{

	Ethernet_Pkt_Desc* temp_eth_pkt;
    
    ENET_DRIVER_STATS_INC(RXPacketCallback);

      temp_eth_pkt=lwIPEthernetIntHandler(pPacket);

      return temp_eth_pkt;
}

void Ethernet_releaseTxPacketBufferCustom(
        Ethernet_Handle handleApplication,
        Ethernet_Pkt_Desc *pPacket)
{
    //
    // Once the packet is sent, reuse the packet memory to avoid
    // memory leaks. Call this interrupt handler function which will take care
    // of freeing the memory used by the packet descriptor.
    //
    lwIPEthernetIntHandler(pPacket);


    ENET_DRIVER_STATS_INC(TXreleasePacket);
}

void
Ethernet_init(const unsigned char *mac)
{

    Ethernet_InitInterfaceConfig initInterfaceConfig;
    uint32_t macLower;
    uint32_t macHigher;
    uint8_t *temp;

    initInterfaceConfig.ssbase = EMAC_SS_BASE;
    initInterfaceConfig.enet_base = EMAC_BASE;
    initInterfaceConfig.phyMode = ETHERNET_SS_PHY_INTF_SEL_MII;

    //
    // Assign SoC specific functions for Enabling,Disabling interrupts
    // and for enabling the Peripheral at system level
    //
    initInterfaceConfig.ptrPlatformInterruptDisable =
                                                    &Platform_disableInterrupt;
    initInterfaceConfig.ptrPlatformInterruptEnable =
                                                     &Platform_enableInterrupt;
    initInterfaceConfig.ptrPlatformPeripheralEnable =
                                                    &Platform_enablePeripheral;
    initInterfaceConfig.ptrPlatformPeripheralReset =
                                                     &Platform_resetPeripheral;

    //
    // Assign the peripheral number at the SoC
    //
    initInterfaceConfig.peripheralNum = SYSCTL_PERIPH_CLK_ENET;

    //
    // Assign the default SoC specific interrupt numbers of Ethernet interrupts
    //
    initInterfaceConfig.interruptNum[0] = INT_EMAC;
    initInterfaceConfig.interruptNum[1] = INT_EMAC_TX0;
    initInterfaceConfig.interruptNum[2] = INT_EMAC_TX1;
    initInterfaceConfig.interruptNum[3] = INT_EMAC_RX0;
    initInterfaceConfig.interruptNum[4] = INT_EMAC_RX1;

    pInitCfg = Ethernet_initInterface(initInterfaceConfig);

    Ethernet_getInitConfig(pInitCfg);
    pInitCfg->dmaMode.InterruptMode = ETHERNET_DMA_MODE_INTM_MODE2;

    //
    // Assign the callbacks for Getting packet buffer when needed
    // Releasing the TxPacketBuffer on Transmit interrupt callbacks
    // Receive packet callback on Receive packet completion interrupt
    //
    pInitCfg->pfcbRxPacket = &Ethernet_receivePacketCallbackCustom;
    pInitCfg->pfcbGetPacket = &Ethernet_getPacketBufferCustom;
    pInitCfg->pfcbFreePacket = &Ethernet_releaseTxPacketBufferCustom;

    pInitCfg->numChannels = 1U;

    //
    // The Application handle is not used by this application
    // Hence using a dummy value of 1
    //
    Ethernet_getHandle((Ethernet_Handle)1, pInitCfg , &emac_handle);

    //
    // Disable transmit buffer unavailable and normal interrupt which
    // are enabled by default in Ethernet_getHandle.
    //
    Ethernet_disableDmaInterrupt(Ethernet_device_struct.baseAddresses.enet_base,
                                 0, (ETHERNET_DMA_CH0_INTERRUPT_ENABLE_TBUE |
                                     ETHERNET_DMA_CH0_INTERRUPT_ENABLE_NIE));

    //
    // Enable the MTL interrupt to service the receive FIFO overflow
    // condition in the Ethernet module.
    //
    Ethernet_enableMTLInterrupt(Ethernet_device_struct.baseAddresses.enet_base,0,
                                ETHERNET_MTL_Q0_INTERRUPT_CONTROL_STATUS_RXOIE);

    //
    // Disable the MAC Management counter interrupts as they are not used
    // in this application.
    //
    HWREG(Ethernet_device_struct.baseAddresses.enet_base + ETHERNET_O_MMC_RX_INTERRUPT_MASK) = 0xFFFFFFFF;
    HWREG(Ethernet_device_struct.baseAddresses.enet_base + ETHERNET_O_MMC_IPC_RX_INTERRUPT_MASK) = 0xFFFFFFFF;
	HWREG(Ethernet_device_struct.baseAddresses.enet_base + ETHERNET_O_MMC_TX_INTERRUPT_MASK) = 0xFFFFFFFF;
    //
    //Do global Interrupt Enable
    //
    (void)Interrupt_enableInProcessor();

    //
    //Assign default ISRs
    //
    Interrupt_registerHandler(INT_EMAC_TX0, Ethernet_transmitISRCustom);
    Interrupt_registerHandler(INT_EMAC_RX0, Ethernet_receiveISRCustom);
    Interrupt_registerHandler(INT_EMAC, Ethernet_genericISRCustom);
    

    //
    // Convert the mac address string into the 32/16 split variables format
    // that is required by the driver to program into hardware registers.
    // Note: This step is done after the Ethernet_getHandle function because
    //       a dummy MAC address is programmed in that function.
    //
    temp = (uint8_t *)&macLower;
    temp[0] = mac[0];
    temp[1] = mac[1];
    temp[2] = mac[2];
    temp[3] = mac[3];

    temp = (uint8_t *)&macHigher;
    temp[0] = mac[4];
    temp[1] = mac[5];

    //
    // Program the unicast mac address.
    //
    Ethernet_setMACAddr(EMAC_BASE,
                        0,
                        macHigher,
                        macLower,
                        ETHERNET_CHANNEL_0);

    Ethernet_clearMACConfigurationCustom(Ethernet_device_struct.baseAddresses.enet_base,ETHERNET_MAC_CONFIGURATION_RE);
    Ethernet_setMACConfigurationCustom(Ethernet_device_struct.baseAddresses.enet_base,ETHERNET_MAC_CONFIGURATION_RE);

    (&Ethernet_device_struct.dmaObj.txDma[ETHERNET_DMA_CHANNEL_NUM_0])->descCount = 0;

}
void httpLEDToggle(void);
void(*ledtoggleFuncPtr)(void) = &httpLEDToggle;

//*****************************************************************************
//
// The interrupt handler for the SysTick interrupt.
//
//*****************************************************************************
void
SysTickIntHandler(void)
{
    //
    // Call the lwIP timer handler.
    //
    lwIPTimer(1);
}

//*****************************************************************************
//
// This example demonstrates the use of the Ethernet Controller.
//
//*****************************************************************************
int
main(void)
{
    unsigned long ulUser0, ulUser1;
    unsigned char pucMACArray[8];

    //
    // User specific IP Address Configuration.
    // Current implementation works with Static IP address only.
    //
    unsigned long IPAddr = 0xC0A801BE;
    unsigned long NetMask = 0xFFFFFF00;
    unsigned long GWAddr = 0x00000000;

    //
    // Initializing the CM. Loading the required functions to SRAM.
    //
    CM_init();

    SYSTICK_setPeriod(systickPeriodValue);
    SYSTICK_enableCounter();
    SYSTICK_registerInterruptHandler(SysTickIntHandler);
    SYSTICK_enableInterrupt();

    //
    // Enable processor interrupts.
    //
    Interrupt_enableInProcessor();
        
    // Set user/company specific MAC octets
    // (for this code we are using A8-63-F2-00-3C-5C)
    // 0x00 MACOCT3 MACOCT2 MACOCT1
    ulUser0 = 0x00F263A8;

    // 0x00 MACOCT6 MACOCT5 MACOCT4
    ulUser1 = 0x005C3C00;

    //
    // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
    // address needed to program the hardware registers, then program the MAC
    // address into the Ethernet Controller registers.
    //
    pucMACArray[0] = ((ulUser0 >>  0) & 0xff);
    pucMACArray[1] = ((ulUser0 >>  8) & 0xff);
    pucMACArray[2] = ((ulUser0 >> 16) & 0xff);
    pucMACArray[3] = ((ulUser1 >>  0) & 0xff);
    pucMACArray[4] = ((ulUser1 >>  8) & 0xff);
    pucMACArray[5] = ((ulUser1 >> 16) & 0xff);

    Interrupt_enable(INT_EMAC_TX0);
    Interrupt_enable(INT_EMAC_RX0);
    Interrupt_enable(INT_EMAC);

    //
    // Initialze the lwIP library, using DHCP.
    //
    lwIPInit(0, pucMACArray, IPAddr, NetMask, GWAddr, IPADDR_USE_STATIC);

    //
    // Initialize ethernet module.
    //
    Ethernet_init(pucMACArray);

    //
    // Initialize the netif and start lwIP
    //
    lwIPStart(0);

    //
    // Initialize the HTTP webserver daemon.
    //
    httpd_init();

    //
    // Loop forever. All the work is done in interrupt handlers.
    //
    while(1)
    {
        uint32_t uiISRsignal = g_uiISRsignal;

        if((uiISRsignal & RX_ISR_MASK) != 0)
        {
            Ethernet_removePacketsFromRxQueueCustom(
                (Ethernet_DescCh*)&Ethernet_device_struct.dmaObj.rxDma[ETHERNET_DMA_CHANNEL_NUM_0], ETHERNET_COMPLETION_NORMAL);

            ETHERNET_DISABLE_INTERRUPTS();    
            g_uiISRsignal &= (~RX_ISR_MASK);
            ETHERNET_ENABLE_INTERRUPTS();
        }

        if((uiISRsignal & TX_ISR_MASK) != 0)
        {
            Ethernet_removePacketsFromTxQueueCustom(
                (Ethernet_DescCh*)&Ethernet_device_struct.dmaObj.txDma[ETHERNET_DMA_CHANNEL_NUM_0], ETHERNET_COMPLETION_NORMAL);

            ETHERNET_DISABLE_INTERRUPTS();    
            g_uiISRsignal &= (~TX_ISR_MASK);
            ETHERNET_ENABLE_INTERRUPTS();
        }
    }
}

void Ethernet_transmitISRCustom(void)
{

    ENET_DRIVER_STATS_INC(TXinterrupt);

    Ethernet_clearDMAChannelInterrupt(
            Ethernet_device_struct.baseAddresses.enet_base,
            ETHERNET_DMA_CHANNEL_NUM_0,
            ETHERNET_DMA_CH0_STATUS_TI);

    g_uiISRsignal |= TX_ISR_MASK;
}

void Ethernet_receiveISRCustom(void)
{

    ENET_DRIVER_STATS_INC(RXinterrupt);

    Ethernet_clearDMAChannelInterrupt(
            Ethernet_device_struct.baseAddresses.enet_base,
            ETHERNET_DMA_CHANNEL_NUM_0,
            ETHERNET_DMA_CH0_STATUS_RI);

    g_uiISRsignal |= RX_ISR_MASK;
}


//*****************************************************************************
//
// Called by lwIP Library. Toggles the led when a command is received by the
// HTTP webserver.
//
//*****************************************************************************
void httpLEDToggle(void)
{
    //
    // Toggle the LED D1 on the control card.
    //
    GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
}


//*****************************************************************************
//
// Called by lwIP Library. Could be used for periodic custom tasks.
//
//*****************************************************************************
void lwIPHostTimerHandler(void)
{

}

Regards,

Danilo

  • Hi Team,

    Our customer also added,

    I am facing a issue while using the ethernet_lwip example project. when i add a breakpoint at httpd_init(), i observed unexpected behaviour in the ARP table. Before stepping over the httpd_init(), the ARP table is C:\Windows\system32>arp -a
    Interface: 192.168.1.53 --- 0xc
    Internet Address Physical Address Type
    192.168.1.1 40-33-06-3a-6f-8e dynamic
    192.168.1.61 74-56-3c-72-53-5f dynamic
    192.168.1.71 74-56-3c-72-53-c5 dynamic
    192.168.1.175 a8-63-f2-00-3c-5c dynamic
    192.168.1.202 00-be-43-18-ac-d1 dynamic
    192.168.1.255 ff-ff-ff-ff-ff-ff static
    224.0.0.22 01-00-5e-00-00-16 static
    224.0.0.251 01-00-5e-00-00-fb static
    224.0.0.252 01-00-5e-00-00-fc static
    239.255.255.250 01-00-5e-7f-ff-fa static
    255.255.255.255 ff-ff-ff-ff-ff-ff static
    After stepping over httpd_init(), the ARP entry of the device is disappears

    Regards,

    Danilo

  • Hi Danilo,

    Based on the ARP table output, i believe these are the issues:

    Issue Summary

    Issue #1: Variable Shadowing (Code Quality Issue, NOT causing your ping problem)
    - Lines 100-102: Global const variables defined (unused)
    - Lines 342-344: Local variables in main() with same names
    - The local variables are what actually get used by lwIPInit(), so both have value 0xC0A801BE
    - This is NOT breaking your ping - it's just poor code organization

    Issue #2: Stale Binary (THIS IS YOUR ACTUAL PROBLEM)
    - Your code says 0xC0A801BE (192.168.1.190)
    - ARP table shows 192.168.1.175 (0xC0A801AF)
    - These don't match = old binary is still on the device

    What Needs to Be Fixed

    To fix the ping issue (REQUIRED):
    1. Clean and rebuild in CCS
    2. Flash the new binary
    3. Reset the board

    To fix code quality (OPTIONAL):
    - Remove the unused global variables at lines 100-102
    - They serve no purpose and create confusion

    Regards,
    Shaunak

  • Hi Shaunak,

    Thank you for this solution. Please see our customer's response below.

    I have removed the global const variables and tested with the updated code. Unfortunately, the issue persists and the code is still not functioning as expected.

    Regards,

    Danilo

  • Hi Danilo,

    Can you please confirm if the right binary is being built and flashed, With the above, the customer should be able to see the changed IP address. Can you clean the project, delete the pre-built files, confirm if the new build passes and a new binary is generated and flashed.

    Regards,
    Shaunak

  • Hi Shaunak,

    Here is our customer's response.

    Yes iam able to see the Changed IP address in watch variables of netif_list. Iam using the SDK version is C2000_6_01_00_00 and CCS version is 20.4.1 

    Regards,

    Danilo

  • Hi Danilo, 

    I have tried reproducing the same locally.

    Ping works fine for me with modified IP.

    Can you give me more context here for me to understand the issue. 

    Can you conform the that correct interface have been connected to the board? Also can you check whether packets have reached the board by creating breakpoint at function 'Ethernet_receiveISRCustom'

  • Hi Shaunak and Gouri,

    I have shared this E2E thread to our customer and he will reply shortly.

    Thank you for your support!

    Regards,

    Danilo

  • Dear Shaunak,

    I directly cloned the project from the C2000_6_01_00_00 SDK version into my workspace. After modifying only the IP and MAC addresses to match my device configuration, the Ethernet connection failed to establish. Before running a ping test, the interface appeared in the ARP table, though the Green LED remained off. However, once the ping test was performed, the interface disappeared from the ARP table entirely.

  • Hi ,

    I have tried the same changes locally. (Changes IP address to 192.168.1.190 and mac address to a8-63-f2-00-3c-5c)

    I was able to ping and get responce from the board. 

    Could you please provide me with more info about your setup ? 

    If possible can you conform the packets are routed to the correct interface using Wireshark/tshark dump and share it ?

  • Hi,

    The setup consists of an Ethernet switch, with one Ethernet cable connecting it to the TMDSCNCD28388D and another connecting it to the PC.

  • Hi, 
    Could you provide me with wireshark/tshark log on the particular interface on PC. And can you confirm there are only two connections out from the switch.

    Also can you create a breakpoint on function 'Ethernet_receiveISRCustom' to confirm packets have been transferred by DMA.

  • Wireshark or tshark is not installed on my PC. There are other PCs connected to the same Ethernet switch. I also tried a direct connection using a single Ethernet cable from the TMDSCNCD28388D to my PC, but I am still experiencing the exact same issue

  • Hi, 

    I established a direct connection using a single Ethernet cable from the TMDSCNCD28388D to my PC. Based on the device configuration, I updated the IP address to 169.254.0.190 and the MAC address to A8-63-F2-00-8C-5C. After calling lwIPStart(), I checked the ARP table using the Windows Command Prompt.

    Whenever checking the ping test 169.254.0.190 I am getting like this 

    Again i am checked the arp table when the interface connection is missing

  • Hi ,

    I want to make sure the ping packets are routed through the correct interface or not. Could you provide me with output of 'ipconfig /all'?

  • Hi, 

    Output of ipconfig /all

  • Hi, 

    Since the PC's IP is not under the Subnet of Boards IP , the tcpip stack could reject the packet.

    But still it should respond for ARP packets.

    I want to confirm that packets is routed through the correct interface. Is there any other interface is configured under same subnet causes the packet to route through(IP under same subnet)?

    Also can you build the binary with ETHERNET_DEBUG defined and share the content of structure 'g_uiEnetStats'.

  • Hi,

    Content of g_uiEnetStats

  • Hi ,

    Can I know the rate at which you are trying to send packets to the board?

    Also can you try applying the following patch?

    diff --git a/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c b/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c
    index a2e40df0..5ec976cc 100644
    --- a/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c
    +++ b/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c
    @@ -681,68 +681,9 @@ interrupt void Ethernet_genericISRCustom(void)
                         ETHERNET_DMA_CH0_STATUS_AIS |
                         ETHERNET_DMA_CH0_STATUS_RBU);
     
    -            /*
    -           *Recover from Receive Buffer Unavailable (and hung DMA)
    -           *
    -           * All descriptor buffers are owned by the application, and
    -           * in result the DMA cannot transfer incoming frames to the
    -           * buffers (RBU condition). DMA has also entered suspend
    -           * mode at this point, too.
    -           *
    -           * Drain the RX queues
    -           */
    -
    -            /* Upon RBU error, discard all previously received packets */
    -            if(Ethernet_device_struct.initConfig.pfcbDeletePackets != NULL)
    -                (*Ethernet_device_struct.initConfig.pfcbDeletePackets)();
    -
    -            rxChan =
    -               &Ethernet_device_struct.dmaObj.rxDma[ETHERNET_DMA_CHANNEL_NUM_0];
    -            txChan=
    -               &Ethernet_device_struct.dmaObj.txDma[ETHERNET_DMA_CHANNEL_NUM_0];
    -
    -            /*
    -            * Need to disable multiple interrupts, so protect the code to do so within
    -            * a global disable block (to prevent getting interrupted in between)
    -            */
    -
    -            if(NULL!= Ethernet_device_struct.ptrPlatformInterruptDisable)
    -            {
    -                (*Ethernet_device_struct.ptrPlatformInterruptDisable)(
    -                    Ethernet_device_struct.interruptNum[
    -                        ETHERNET_RX_INTR_CH0 + rxChan->chInfo->chNum]);
    -
    -                (*Ethernet_device_struct.ptrPlatformInterruptDisable)(
    -                    Ethernet_device_struct.interruptNum[
    -                        ETHERNET_GENERIC_INTERRUPT]);
    -            }
    -            /* verify we have full capacity in the descriptor queue */
    -            if(rxChan->descQueue.count < rxChan->descMax) {
    -              /* The queue is not at full capacity due to OOM errors.
    -              Try to fill it again */
    -                Ethernet_addPacketsIntoRxQueue(rxChan);
    -            }
    -
    -            Ethernet_initRxChannel(
    -                    &Ethernet_device_struct.initConfig.chInfo[ETHERNET_CH_DIR_RX][0]);
    -
    -            Ethernet_writeRxDescTailPointer(
    -                Ethernet_device_struct.baseAddresses.enet_base,
    -                0,
    -                (&Ethernet_device_struct.rxDesc[
    -                 ((uint32_t)ETHERNET_DESCRIPTORS_NUM_RX_PER_CHANNEL) *
    -                  (0 + (uint32_t)1U)]));
    -
    -            if(NULL!= Ethernet_device_struct.ptrPlatformInterruptEnable)
    -            {
    -                (*Ethernet_device_struct.ptrPlatformInterruptEnable)(
    -                    Ethernet_device_struct.interruptNum[
    -                        ETHERNET_RX_INTR_CH0 + rxChan->chInfo->chNum]);
    -                (*Ethernet_device_struct.ptrPlatformInterruptEnable)(
    -                    Ethernet_device_struct.interruptNum[
    -                        ETHERNET_GENERIC_INTERRUPT]);
    -            }
    -
    +            Ethernet_disableDmaInterrupt(Ethernet_device_struct.baseAddresses.enet_base,
    +                                 0, (ETHERNET_DMA_CH0_STATUS_AIS |
    +                                     ETHERNET_DMA_CH0_STATUS_RBU));
     
         }
         if(0U != (HWREG(Ethernet_device_struct.baseAddresses.enet_base +
    @@ -883,6 +824,10 @@ void Ethernet_removePacketsFromRxQueueCustom(Ethernet_DescCh *channelDescPtr,
                     }
                 }
             }
    +        if((HWREG(channelDescPtr->devicePtr->baseAddresses.enet_base + (channelDescPtr->chInfo->chNum * ETHERNET_CHANNEL_OFFSET) + ETHERNET_O_DMA_CH0_INTERRUPT_ENABLE) & ETHERNET_DMA_CH0_STATUS_RBU) ==  0U)
    +        {
    +            Ethernet_enableDmaInterrupt(channelDescPtr->devicePtr->baseAddresses.enet_base,channelDescPtr->chInfo->chNum, (ETHERNET_DMA_CH0_STATUS_AIS|ETHERNET_DMA_CH0_STATUS_RBU));
    +        }
     }
     
     /***********************************************************************************************
    

  • Hi,

    I have not modified the bitrate in the ethernet_lwip example code.

  • Hi,

    The interface is operating at a bitrate of 10 Mbps, as indicated by the FES bit being cleared (0) within the MAC_CONFIGURATION register.

  • https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/171/enet_5F00_lwip_5F00_cm.out

    Hi Can you try this binary and check whether this is working for you?

    IP Address - 169.254.0.190

    Subnet Mask - 255.255.0.0

    MAC address - A8-63-F2-00-8C-5C

  • Hi,

    I tried using the code modifications, but I am facing the same issue. After lwIPStart(), the interface connection appears in the ARP table, but the green LED does not blink

    Furthermore, when I attempt a ping test, the connection drops entirely.

  • Hi Phani,

    By any chance do you have another EVM or Test Setup?

    At this point it would be difficult to support since we dont see any issue in the TI software or EVM. We have been able to consistently get this working with the provided binary on two different setups. 
    This looks like a local setup issue.

    Regards,

    Shaunak

  • Hi,

    We don't have another EVM or test setup available at the moment. We'll need to arrange a new setup, and we'll get back to you once it's ready.