cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
harshalrode
Contributor
Contributor
7,721 Views
Registered: ‎10-01-2009

problem in Echo server on spartan 3E starter kit

I have created a system using BSB for Spartan 3E starter kit. Then I exported the design to SDK.

In SDK, I have created a platform for standalone alongwith lwip. 

Then using 'managed make c application project' example designs, I selected lwip echo server.

I changed the host IP settings to

IP:192.168.1.100

subnet:255.255.255.0

gateway:192.168.1.1

 

 

When I download the application and run it, on hyperterminal screen(9600,8 bit, 1 stop bit COM1) I see following message

 

-----lwIP TCP echo server ------
TCP packets sent to port 6001 will be echoed back
Board IP: 192.168.1.10
Netmask : 255.255.255.0
Gateway : 192.168.1.1
tcp echo server started @ port 7

 

but when I try to do "telnet 192.168.1.10 7" on bash shell in SDK

 

It says

 

$ telnet 192.168.1.10 7
Connecting To 192.168.1.10...Could not open connection to the host, on port 7: C
onnect failed

 

 

 

What is the problem I don't understand.

 

Later, I configured my host PC ethernet to 10MB full

and lwip physical link speed to CONFIG_LINKSPEED10.

Then also it is not working.

 

Normally ethernet cable shows light when we connect it to PC. But it is not shwing any light when connected to board and application is running.

 

My heap and stack are A000 and A000.

 

What is the problem??

 

 Am I forgetting some settings??

 

 

0 Kudos
14 Replies
prateek_bhatt
Scholar
Scholar
7,713 Views
Registered: ‎08-21-2008

Hello.

Are you sure that the link(10 or 100) is established between your board and PC. You said that there was no LED glowing when you connect your board and PC through RJ45 cable. You should check what those LEDs are meant for.

There can be various mappings to those LEDs.

Normally we map Link Up signal to one LED and Activity (send or receive data) to activity LED. You should confirm whats at your end.

If connection is not established then you cannot connect.

On the contrary if connection is well established then you should see that your board is in your network domain in order to connect.

Also keep the IP Addresses of both (board and PC) at a difference of One from each other. Like 192.168.1.100 and 192.168.1.101

Also try to ping at the address of your board.

Open CMD and type       <ping 192.168.1.10 -t>   Ignore the signs.

See if receive any reply from the remote peer.

Try these things and come back.

Best of luck.
--
Unlimited in my Limits.
0 Kudos
harshalrode
Contributor
Contributor
7,697 Views
Registered: ‎10-01-2009

Hi

 

Yes. When we connect ethernet cable to internet; led near the cable lights ( I think that one led is always glowing and the other blinks while data is being transferred ).

But when I connect the cable to board and  PC, it is neither glowing nor blinking.

 

I tried with host IP settings as

 

IP : 192.168.1.11 ( board IP is 192.168.1.10 according to README.txt alongwith source and I checked it)

subnet : 255.255.255.0

gateway : 192.168.1.1 ( gateway of board is the same 192.168.1.1)

 

Still nothing happens.

 

When I tried "ping 192.168.1.10 -t" it says "Destination host unreachable "

 

Peripheral test application passes the etherenet PHY test.

 

I suspect that there could be a problem with connection as I am expecting the LED to glow as soon as I am connecting PC and board using RJ45. ( LED glows when we connect ethernet cable from PC to internet )

 

Thank you

Harshal

 

 

 

Message Edited by harshalrode on 11-20-2009 12:04 AM
0 Kudos
prateek_bhatt
Scholar
Scholar
7,693 Views
Registered: ‎08-21-2008

Hello.

If ping is not happening and its saying that "Destination host unreachable" then link up is not taking place.

Your PHY may not be configured properly.

Check your reset polarity as well.

Also read datasheet of your PHY and configure properly.

See if you are missing any important signal or may be giving wrong input to some signal.

By the way which PHY are you using.

And is your board standard one or some custom board of your own. 

Also remember that setting the IP address has nothing to do with link establishment.

I told you that 'coz i thought that your link is established but you are unable to connect.

Message Edited by prateek_bhatt on 11-20-2009 12:45 AM
Best of luck.
--
Unlimited in my Limits.
0 Kudos
harshalrode
Contributor
Contributor
7,690 Views
Registered: ‎10-01-2009

Hi

 

I am using Spartan 3E starter kit (rev D). It has Standard Microsystems LAN83C185
10/100 Ethernet physical layer (PHY) interface and an RJ-45 connector.

 

Yes. Link is not taking place. I will see the datasheet and try to configure it in XPS and EDK.

How do I check reset polarity?

 

 

 

0 Kudos
prateek_bhatt
Scholar
Scholar
7,685 Views
Registered: ‎08-21-2008

Hello.

Check the datasheet of your PHY and if there is any reset pin in your PHY then which polarity is it in your datasheet.

Then check that from your code or from your hardware what is going to that pin.

If the polarity is reversed then nothing will happen as it will keep the PHY in reset mode.

Best of luck.
--
Unlimited in my Limits.
0 Kudos
harshalrode
Contributor
Contributor
7,643 Views
Registered: ‎10-01-2009

Hi

 

Earlier LEDs at halo connector were not glowing due to pin fualt at the connector.

One of the pin had bent and gone inside. I pulled it out and now when I connect LEDs glow and blink also.

 

But telnet connection is not happening.

 

When I ping the host

I get "Request timed out" error.

 

My board IP is 192.168.1.10 and  and host IP is 192.168.1.11

Gateway for both is 192.168.1.1

 

I searched the datasheet of PHY, it has active low reset. But what is going to it I am yet to figure out (Is it still necessary to check reset polarity as LEDs are glowing now)

 

What could be the problem??

 

I have kept Link speed at host PC as AUTODETECT and at board software platform settings also as CONFIG LINK SPEED AUTO.

I get the message at PC as 100.0 MBPS LAN detected.

But ping is not happening?


 

0 Kudos
prateek_bhatt
Scholar
Scholar
7,621 Views
Registered: ‎08-21-2008

Hello.

If your link is established and you are unable to connect then your MAC may not be configured properly.

Keep your heap and stack to at least 0x20000.

Rest i don't think there will be any problem. 

Best of luck.
--
Unlimited in my Limits.
0 Kudos
harshalrode
Contributor
Contributor
7,603 Views
Registered: ‎10-01-2009

Hi

 

I changed heap and stack to 0x20000,  still "request timed out" error when pinged. even 0x40000 is not helpful.

 

I think my MAC may not be correctly configured.

 

I configured MAC in XPS ethenet lite IP configuration parameters.

 

And other place where we can configure it is in LWIP library parameters.

 

But I did not change any parameter, I thought that the default values are correct.

 

How else can we configure  MAC?

Do we need to check mac address of both PC and board(in software)?

 

Is there any problem in code??

 

Thank you

Harshal

 

 

0 Kudos
prateek_bhatt
Scholar
Scholar
7,601 Views
Registered: ‎08-21-2008

Hello.

What you can do is you can debug using network protocol analyzer like ethreal...

And you can try read the registers of your MAC also to see if it is configured correctly.

Best of luck.
--
Unlimited in my Limits.
0 Kudos
harshalrode
Contributor
Contributor
5,376 Views
Registered: ‎10-01-2009

Hi

 

Do I need to change the  following (red)parameteres defined in this platform.c file of echo server application for different clock frequency.

 


#include "arch/cc.h"

#include "platform.h"
#include "platform_config.h"

#include "xenv_standalone.h"
#include "xparameters.h"
#include "xintc.h"

#ifdef __MICROBLAZE__
#include "mb_interface.h"
#include "xtmrctr_l.h"
#elif __PPC__
#include "xexception_l.h"
#include "xtime_l.h"
#endif

#ifdef PLATFORM_STDOUT_IS_16550
#include "xuartns550_l.h"
#endif

#include "lwip/tcp.h"

void
timer_callback()
{
        /* we need to call tcp_fasttmr & tcp_slowtmr at intervals specified by lwIP.
         * It is not important that the timing is absoluetly accurate.
         */
    static int odd = 1;
    tcp_fasttmr();

    odd = !odd;
    if (odd)
        tcp_slowtmr();
}

#ifdef __MICROBLAZE__
void
xadapter_timer_handler(void *p)
{
    unsigned *timer_base = (unsigned *)PLATFORM_TIMER_BASEADDR;
    unsigned tcsr = 0;

    timer_callback();

        /* Load timer, clear interrupt bit */
        XTmrCtr_mSetControlStatusReg(PLATFORM_TIMER_BASEADDR, 0, XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK);
    XTmrCtr_mSetControlStatusReg(PLATFORM_TIMER_BASEADDR, 0,
            XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK
            | XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK);

    XIntc_mAckIntr(XPAR_XPS_INTC_0_BASEADDR, PLATFORM_TIMER_INTERRUPT_MASK);
}

#define MHZ (66)
#define TIMER_TLR (25000000*((float)MHZ/100))


void
platform_setup_timer()
{
    /* set the number of cycles the timer counts before interrupting */
    /* 100 Mhz clock => .01us for 1 clk tick. For 100ms, 10000000 clk ticks need to elapse  */
    XTmrCtr_mSetLoadReg(PLATFORM_TIMER_BASEADDR, 0, TIMER_TLR);


    /* reset the timers, and clear interrupts */
    XTmrCtr_mSetControlStatusReg(PLATFORM_TIMER_BASEADDR, 0, XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK );

    /* start the timers */
    XTmrCtr_mSetControlStatusReg(PLATFORM_TIMER_BASEADDR, 0,
            XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK
            | XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK);

    /* Register Timer handler */
    XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR,
            PLATFORM_TIMER_INTERRUPT_INTR,
            (XInterruptHandler)xadapter_timer_handler,
            0);

    XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, PLATFORM_TIMER_INTERRUPT_MASK);
}
#else
#define MHZ 400
#define PIT_INTERVAL (250*MHZ*1000)

void
xadapter_timer_handler(void *p)
{
    timer_callback();

    XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
}

void
platform_setup_timer()
{
#ifdef XPAR_CPU_PPC440_CORE_CLOCK_FREQ_HZ
        XExc_RegisterHandler(XEXC_ID_DEC_INT, (XExceptionHandler)xadapter_timer_handler, NULL);

        /* Set DEC to interrupt every 250 mseconds */
        XTime_DECSetInterval(PIT_INTERVAL);
        XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
        XTime_DECEnableAutoReload();
#else
    XExc_RegisterHandler(XEXC_ID_PIT_INT, (XExceptionHandler)xadapter_timer_handler, NULL);

    /* Set PIT to interrupt every 250 mseconds */
    XTime_PITSetInterval(PIT_INTERVAL);
    XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL);
    XTime_PITEnableAutoReload();
    XTime_PITEnableInterrupt();
#endif
}
#endif

void platform_enable_interrupts()
{
#ifdef __MICROBLAZE__
    microblaze_enable_interrupts();
#elif  __PPC__
        XExc_mEnableExceptions(XEXC_NON_CRITICAL);
#endif
}

static XIntc intc;

void platform_setup_interrupts()
{
    XIntc *intcp;
    intcp = &intc;

        XIntc_Initialize(intcp, XPAR_XPS_INTC_0_DEVICE_ID);
    XIntc_Start(intcp, XIN_REAL_MODE);

    /* Start the interrupt controller */
    XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR);

#ifdef __PPC__
       XExc_Init();
        XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT,
                         (XExceptionHandler)XIntc_DeviceInterruptHandler,
                         (void*) XPAR_XPS_INTC_0_DEVICE_ID);
#elif __MICROBLAZE__
    microblaze_register_handler((XInterruptHandler)XIntc_InterruptHandler, intcp);
#endif

#ifdef XPAR_ETHERNET_MAC_IP2INTC_IRPT_MASK
    /* Enable timer and EMAC interrupts in the interrupt controller */
    XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR,
#ifdef __MICROBLAZE__
            PLATFORM_TIMER_INTERRUPT_MASK |
#endif
                XPAR_ETHERNET_MAC_IP2INTC_IRPT_MASK);
#endif
}

void
enable_caches()
{
#ifdef __PPC__
    XCache_EnableICache(CACHEABLE_REGION_MASK);
    XCache_EnableDCache(CACHEABLE_REGION_MASK);
#elif __MICROBLAZE__
#ifdef XPAR_MICROBLAZE_USE_ICACHE
    microblaze_invalidate_icache();
    microblaze_enable_icache();
#endif
#ifdef XPAR_MICROBLAZE_USE_DCACHE
    microblaze_invalidate_dcache();
    microblaze_enable_dcache();
#endif
#endif

 

 

 

 

 

 

How to read PHY registers to debug?

 

Thank you

Harshal

 

0 Kudos
prateek_bhatt
Scholar
Scholar
5,373 Views
Registered: ‎08-21-2008

Hello.

I think you read the registers of MAC only and leave PHY registers 'coz PHY is well configured as you are able to establish 100 Mbps full duplex link, isn't it.

For checking MAC registers you study the datasheet of mac that you have used.

It will tell you everything.

Problem is with MAC i suppose.

What you can do is you can make a user friendly code by adding an input which is external to FPGA.

You start reading MAC registers after you get 1 or 0 from this external input depending upon your liking.

This is necessary 'coz register data may change after configuration of FPGA with Bitstream.

So after downloading your code and establishing link you give that input and display the registers values on hyperterminal.

Hope you understand what i mean to say.

Best of luck.
--
Unlimited in my Limits.
0 Kudos
ravics
Observer
Observer
4,559 Views
Registered: ‎08-26-2010

Thanks a lot. I had the same problem on Spartan 3AN using the Reference design of lwIP.


The echo server was not responding while giving the telnet command.


After giving a difference of 1 (one) in the IP address of board & PC(host) it worked.


Thanks again.

0 Kudos
n5ac
Participant
Participant
4,555 Views
Registered: ‎10-29-2008

Are you aware that at the start of the output is mentions port 6001 and a the end it mentions port 7?  Did you change the port number?  You might try telnetting to port 6001 instead of 7.

 

Steve

0 Kudos
aarunach
Visitor
Visitor
4,224 Views
Registered: ‎04-25-2011

Hi,

 

We are trying to establish a connection between the host computer and Spartan 3E Starter kit (Rev D) using the in-built lwIP stack.

 

The IP addresses of the the host computer and the FPGA has been changed appropriately (192.168.1.10 for FPGA and 192.168.1.11 for PC). When the application is run on SDK, we get the following message on Hyperterminal:

 

 

-----lwIP TCP echo server ------
TCP packets sent to port 6001 will be echoed back
Board IP: 192.168.1.10
Netmask : 255.255.255.0
Gateway : 192.168.1.1
tcp echo server started @ port 7

 

 

The LED on either end seem to glow properly. However, we consistently get a "Destination host unreachable" message when we try to ping or telnet to FPGA's IP address 192.168.1.10.

 

We haven't changed any of the Phy or Mac configurations.

Could you please let us know what could be the problem? Really appreciate your help in this regard.

 

Thanks!

0 Kudos