Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

simple socket server example on cyclone II dev kit

Hi,

I want to use the simple socket server example with the cyclone II dev kit. I compiled it and then I run it. In the file simple_socket_server.h I defined the IP-adress like this:


#define IPADDR0 192# define IPADDR1 168# define IPADDR2 1# define IPADDR3 234
 
#define GWADDR0 192 # define GWADDR1 168 # define GWADDR2 1 # define GWADDR3 1 
 
#define MSKADDR0 255# define MSKADDR1 255# define MSKADDR2 255# define MSKADDR3 0
 

The IP-Adress of my PC is 192.168.1.1 with the same subnet adress. Then I connected the Board directly via Ethernet to my PC.

In the console I can read the following:

 
Your Ethernet MAC address is 00:07:ed:0f:b4:14
prepped 1 interface, initializing...
Created "Inet main" task (Prio: 2)
Created "clock tick" task (Prio: 3)
smsc91c111 Auto-negotiation: 100 Mbps, Full Duplex
SMSC ethernet Rev: 0x3392, ram: 8192
IP address of et1 : 0.1.1.234
DHCP timed out, going back to default IP address(es)
Simple Socket Server starting up
 Simple Socket Server listening on port 30
Created "simple socket server" task (Prio: 4)

But now I can't reach the board by a ping (icmp-request) and of course I can't connect via TCP to the board. I wonder why it says that the IP-adress is 0.1.1.234:

1. This is no valid ip-adress, because it includes a zero...

2. It's not the same as I defined it in simple_socket_server.h

Who can help? :)

Regards,

Stefan

P.S.: When I press "run" it takes ~5 minutes until it's really running...

10 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello,

    Idon't know what to say about your post but I can give you an example of I have done for Stratix 3 development board.

    In the file simple_socket_server.h I defined the IP-adress like this:

    IP: 137.57.123.58

    GW: 137.57.123.200

    MASK: 255.255.255.0

    in my pc : IP: 137.57.123.55

    MASK: 255.255.255.0

    GW: 137.57.123.200

    under cmd window : ping 137.57.123.58 -t

    I hope this will be helpfull.

    Best regards,

    Jeremy.

    Press enter to look up in Wiktionary or ctrl+enter to look up in Wikipedia
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi jjeerreemmyy,

    did you connect your board directly to the pc? did you use a special cable?

    and what was the console output when you launch the application?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I connected the board with the "usb blaster cable" .

    I used the example that uses triple speed ethernet. This example is included with the design kit but it's targetting cyclone ii family. However, you can use it I think.

    So, to answer to your second question (if I well understood):

    The output of the console was : " Reply from 137.57.123.58: bytes=32 time<1ms TTL=64 " .This show that the connection is established.

    Regards,

    Jeremy.

    Press enter to look up in Wiktionary or ctrl+enter to look up in Wikipedia
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I connected the board with the "usb blaster cable" .

    --- Quote End ---

    And no ethernet cable?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    And what was the console output in NIOS II IDE when you launched the application?

    ________

    NIOS II IDE is very strange...

    Sometimes there is a build error and sometimes not. Also if I don't change the code.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Which version of Quartus are you using? In 8.0 there was a bug in the IP4_ADDR macro in network_utilites.c. It should have an extra pair of brackets, and should look like this:

    #define IP4_ADDR(ipaddr, a,b,c,d) ipaddr = 
        htonl((((alt_u32)(a & 0xff) << 24) | ((alt_u32)(b & 0xff) << 16) | 
              ((alt_u32)(c & 0xff) << 8) | (alt_u32)(d & 0xff)))
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, I am trying to use simple socket server example on cyclone II dev kit.

    It seems to work BUT :

    when i send over 41 characters through ethernet (crossed câble) , dev kit goes to malfunction.

    I receive random characters and communication hangs.

    It is like there is too many characters. Too much work to do for Nios II + IP stack + microC/OS II.

    Have you faced to this problem ?

    Is there an example of Simple Socket server PLus (that enables FTP, TFTP, ...) for Cyclone II dev kit ?

    EDIT :

    --- Quote Start ---

    [SSS]: Attempted to post to a full message queue.

    --- Quote End ---