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.

TCP Server: Accept handler is not called



Hello,

I'm using the enet_ewip sample code as reference. With this project, I managed to get the TI's HTML page.

So my hardware is OK. Also tried it with static IP.

My code is:

static err_t (tcp_acceptHandler (void *arg, struct tcp_pcb *pcb, err_t err)
{

	return ERR_OK;
}

void lwIPHostTimerHandler (void)
{


}

void SysTickIntHandler (void)
{
	lwIPTimer (SYSTICKMS);
}

int main (void)
{
	ip_addr_t ipaddr;

	ui32SysClock = SysCtlClockFreqSet (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN |
                                            SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 
                                            120000000); //ui32SysClock 

	ROM_SysTickPeriodSet (ui32SysClock / SYSTICKMHZ);

	ROM_SysTickEnable ();

	ROM_SysTickIntEnable ();

	ROM_IntPrioritySet (INT_EMAC0, ETHERENT_INT_PRIOEITY);

	ROM_IntPrioritySet (INT_EMAC0, ETHERENT_INT_PRIOEITY);

	ipaddr.addr = 0xC0A80103; //192.168.1.3

	ROM_FlashUserGet (&ui32User0, &ui32User1);

	lwIPInit (ui32SysClock, pui8MACArray, ipaddr.addr, 0xFFFF0000,          
                                               0xFFFF0000,IPADDR_USE_STATIC);

	pTcp = tcp_new ();

	tcp_bind (pTcp, IP_ADDR_ANY, 6100);

	tcp_listen (pTcp);

	tcp_accept (pTcp, tcp_acceptHandler);

	while (1);
}

Upon running, SysTickIntHandler and lwIPHostTimerHandler are called constantly.  

When I tried to connect from a windows application, tcp_acceptHandler is not called.

Can you help ?

The enet_lwip sample contains also the lines:

LocatorInit ();

LocatorMACAddrSet (pui8MACArray);

What is the role of those lines ?

Thanks,

Zvika

  • Dear Members,

    I have further information:

    Upon trying to connect from a PC, using an etherent  sniffer I see an ARP request is sent to the TIVA but it is not replied.

    Thanks,

    Zvika

  • Dear Members,

    When I used the same code but IP was set using a DHCP server, it worked fine.

    I checked it also with the enet_lwip sample. When I changed the code in the sample to:

    lwIPInit (ui32SysClock, pui8MACArray, 0xC0A80103, 0xFFFF0000, 0xFFFF0000,IPADDR_USE_STATIC);

    and also changed lwipopts.h to:

    #define LWIP_DHCP       0

    #define LWIP_AUTOIP    0

    Connecting from explorer to 192.168.1.3 failed.

    Any ideas ?

    Thanks,

    Zvika

  • Hello,

    It seems I'm facing the same problem like in:

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/316375/1121524.aspx#1121524

    Thanks,

    Zvika

  • If trying to use static IP address and trying to connect from a computer.  Make sure that the IP address of the computer is also statically set and that the subnet mask is correct.

    For example Computer IP 192.168.1.10 subnet 255.255.255.0

    Connected LaunchPad IP 192.168.1.20 subnet 255.255.255.0.  For the CLP you will need to convert these decimal numbers to a single 32 bit integer and pass them to lwipInit.

    Based on your description you have not configured your computer to be on the same network as the CLP even though they are physically connected they are not logically in the same network.

    Dexter

  • Hi Dexter,

    My PC is configured to static IP (192.168.1.2) with the same subnet (255.255.0.0)

    I also tried using the enet_lwip sample and enet_io with no changes.

    The board was connected  to a switch which is connected to DHCP server.

    The TIVA gets an IP sometimes.

    Thanks,

    Zvika

  • Dear Members,

    I checked it several times.

    If I run the application using the debugger, ethernet is not working.

    If I burn the application (with CCS) and press reset (on the Eval. Board) to run it, it works fine.

    I think TI should solve this issue.

    Thanks,

    Zvika