Forum Discussion

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

troubles on nichestack tcpip example

hi, I follow the nichestack tcpip example(http://www.altera.com.cn/literature/tt/tt_nios2_tcpip.pdf), however it do not work, i do not know why, if the development board do not support(my board is dsp cyclone iii development kit)

the message as follow:

PHY INFO: [phyid] 0x12 141 cc2

PHY INFO: Issuing PHY Reset

PHY INFO: waiting on PHY link...

PHY INFO: PHY link detected, allowing network to start.

SSS INFO: Connecting...

InterNiche Portable TCP/IP, v3.1

Copyright 1996-2008 by InterNiche Technologies. All rights reserved.

prep_tse_mac 0

Can't read the MAC address from your board (this probably means

that your flash was erased). We will assign you a MAC address and

static network settings

Please enter your 9-digit serial number. This is printed on a

label under your Nios dev. board. The first 3 digits of the

label are ASJ and the serial number follows this.

-->Created "Inet main" task (Prio: 2)

Created "clock tick" task (Prio: 3)

http://www.alteraforum.com/forum/attachment.php?attachmentid=10056&stc=1

2 Replies

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

    The software needs to program the ethernet MAC with a MAC address.

    The software expects to read a nonvolatile memory (flash or EEPROM), obtain the MAC address, and program the ethernet MAC with it.

    The example software is prompting you to enter your board serial number so that it can initialize the flash/EEPROM with the MAC address for the first time (because when it already tried to read it, it saw that it wasn't there).

    Try entering your board serial number and see if it all starts working.

    If it doesn't work (or if it keeps asking you this question every time it starts up), you will need to modify the software to get the MAC address from somewhere else.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    thank you. I have solved this problem, i changed the code ----get_board_mac_addr() in iniche_init.c, so i can assign the mac value directly,then it works. the changed code as follow:

    changing code:

    /*

    * get_board_mac_addr

    *

    * Read the MAC address in a board specific way

    *

    */

    error_t get_board_mac_addr(unsigned char mac_addr[6])

    {

    error_t error = 0;

    alt_u32 signature;

    /* Get the flash sector with the MAC address. */

    error = FindLastFlashSectorOffset(&last_flash_sector_offset);

    if (!error)

    last_flash_sector = EXT_FLASH_BASE + last_flash_sector_offset;

    /* This last_flash_sector region of flash is examined to see if

    * valid network settings are present, indicated by a signature of 0x00005afe at

    * the first address of the last flash sector. This hex value is chosen as the

    * signature since it looks like the english word "SAFE", meaning that it is

    * safe to use these network address values.

    */

    /* //delete this code

    if (!error)

    {

    signature = IORD_32DIRECT(last_flash_sector, 0);

    if (signature != 0x00005afe)

    {

    error = generate_and_store_mac_addr();

    }

    }

    */ //delete this code

    if (!error)

    {

    mac_addr[0] = IORD_8DIRECT(last_flash_sector, 4);

    mac_addr[1] = IORD_8DIRECT(last_flash_sector, 5);

    mac_addr[2] = IORD_8DIRECT(last_flash_sector, 6);

    mac_addr[3] = IORD_8DIRECT(last_flash_sector, 7);

    mac_addr[4] = IORD_8DIRECT(last_flash_sector, 8);

    mac_addr[5] = IORD_8DIRECT(last_flash_sector, 9);

    printf("Your Ethernet MAC address is %02x:%02x:%02x:%02x:%02x:%02x\n",

    mac_addr[0],

    mac_addr[1],

    mac_addr[2],

    mac_addr[3],

    mac_addr[4],

    mac_addr[5]);

    }

    return error;

    }