FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5915 Discussions

Ethernet Example Design on Cyclone III Dev Board (3C120F780)

Altera_Forum
Honored Contributor II
2,969 Views

Hi, 

 

I'm not able to get the Altera's Ethernet Example Design to work on the Cyclone III Dev. Board. I used the "Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial". 

 

PHY INFO: 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 Your Ethernet MAC address is 00:07:ed:08:xx:xx prepped 1 interface, initializing... INFO : TSE MAC 0 found at address 0x0800a000 INFO : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group INFO : PHY - Automatically mapped to tse_mac_device INFO : PHY - Restart Auto-Negotiation, checking PHY link... INFO : PHY - Auto-Negotiation PASSED INFO : PHY - Checking link... INFO : PHY - Link established INFO : PHY - Speed = 1000, Duplex = Full OK, x=48, CMD_CONFIG=0x00000000 MAC post-initialization: CMD_CONFIG=0x0400020b RX descriptor chain desc (1 depth) created mctest init called IP address of et1 : 134.130.xxx.xxx Created "Inet main" task (Prio: 2) Created "clock tick" task (Prio: 3) DHCP timed out, going back to default IP address(es) Nios II Simple Socket Server starting up. Created "monitor_phy" task (Prio: 9) Created "Nios II Simple Socket Server" task (Prio: 10) Nios II Simple Socket Server listening on port 30  

 

The DHCP isn't working, I cannot ping the board and telnet isn't working. 

In a next step I set the IP to a static one -> the same effect. 

I got the same effect for the example templates in Nios2-Eclipse. 

 

I checked the same design with the NEEK board and it runs well (naturally the .sof for the NEEK) with the original flash-file (the application selector) and the niosii_ethernet_standard_3c25.sof overloading. 

Using another flash-content, it also doesn't work like the 3C120. 

 

Any idea? 

 

Best Regards 

 

Mark
0 Kudos
19 Replies
Altera_Forum
Honored Contributor II
772 Views

Is the static IP in the same subnet as the computer you use to ping?

0 Kudos
Altera_Forum
Honored Contributor II
772 Views

yes, it is.

0 Kudos
Altera_Forum
Honored Contributor II
772 Views

 

--- Quote Start ---  

Hi, 

 

I'm not able to get the Altera's Ethernet Example Design to work on the Cyclone III Dev. Board. I used the "Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial". 

 

PHY INFO: 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 Your Ethernet MAC address is 00:07:ed:08:xx:xx prepped 1 interface, initializing... INFO : TSE MAC 0 found at address 0x0800a000 INFO : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group INFO : PHY - Automatically mapped to tse_mac_device INFO : PHY - Restart Auto-Negotiation, checking PHY link... INFO : PHY - Auto-Negotiation PASSED INFO : PHY - Checking link... INFO : PHY - Link established INFO : PHY - Speed = 1000, Duplex = Full OK, x=48, CMD_CONFIG=0x00000000 MAC post-initialization: CMD_CONFIG=0x0400020b RX descriptor chain desc (1 depth) created mctest init called IP address of et1 : 134.130.xxx.xxx Created "Inet main" task (Prio: 2) Created "clock tick" task (Prio: 3) DHCP timed out, going back to default IP address(es) Nios II Simple Socket Server starting up. Created "monitor_phy" task (Prio: 9) Created "Nios II Simple Socket Server" task (Prio: 10) Nios II Simple Socket Server listening on port 30 The DHCP isn't working, I cannot ping the board and telnet isn't working. 

In a next step I set the IP to a static one -> the same effect. 

I got the same effect for the example templates in Nios2-Eclipse. 

 

I checked the same design with the NEEK board and it runs well (naturally the .sof for the NEEK) with the original flash-file (the application selector) and the niosii_ethernet_standard_3c25.sof overloading. 

Using another flash-content, it also doesn't work like the 3C120. 

 

Any idea? 

 

Best Regards 

 

Mark 

--- Quote End ---  

 

 

seeing your output it seems that u r hardware is not taking ip address. 

go to the simple_socket_server.h file and give your IP address + if you don't have DHCP server, through network_utilities.c file disable it (*use_dhcp = 0)
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

I marked the last two bytes of the IP and the MAC with "x", because the IP is in a public subnet. 

I disabled DHCP and also tested the design in a private subnet (192.168.123.001 255.255.255.000) with no change.
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

The hardware doesn't work. I believe timing constrains are wrong or there are none.

0 Kudos
Altera_Forum
Honored Contributor II
772 Views

@Socrates: 

It's the original .sof-file from Altera. So it should work, or not? 

 

@all 

is there anyone who has an ethernet design running for the 3c120f780 Cyclone III dev board and can send it to me? 

 

Best Regards
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

Did you disable DHCP in the NicheStack properties? 

Please post again the console log with DHCP disabled.
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

I set "dhcp=0" in iniche_init.c (line line 341) 

 

again no ping. 

 

PHY INFO: 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 Your Ethernet MAC address is 00:07:ed:08:1a:2a prepped 1 interface, initializing... INFO : TSE MAC 0 found at address 0x0800a000 INFO : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group INFO : PHY - Automatically mapped to tse_mac_device INFO : PHY - Restart Auto-Negotiation, checking PHY link... INFO : PHY - Auto-Negotiation PASSED INFO : PHY - Checking link... INFO : PHY - Link established INFO : PHY - Speed = 1000, Duplex = Full OK, x=4, CMD_CONFIG=0x00000000 MAC post-initialization: CMD_CONFIG=0x0400020b RX descriptor chain desc (1 depth) created mctest init called IP address of et1 : 192.168.123.2 Created "Inet main" task (Prio: 2) Created "clock tick" task (Prio: 3) Nios II Simple Socket Server starting up. Created "monitor_phy" task (Prio: 9) Created "Nios II Simple Socket Server" task (Prio: 10) Nios II Simple Socket Server listening on port 30
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

 

--- Quote Start ---  

I set "dhcp=0" in iniche_init.c (line line 341) 

 

--- Quote End ---  

 

I'm not sure this assignment will really disable dhcp. 

You should disable it in bsp iNiche properties or remove the DHCP_CLIENT define inside ipport.h
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

Disabling DHCP-Server in BSP-Editor->Software packages results in 3 errors: 

 

Description Resource Path Location Type 

make: *** [niosII_Simple_Socket_Server_ohne_DHCP.elf] Error 1 niosII_Simple_Socket_Server_ohne_DHCP C/C++ Problem 

 

Description Resource Path Location Type 

undefined reference to `dhc_set_callback' iniche_init.c /niosII_Simple_Socket_Server_ohne_DHCP line 509 C/C++ Problem 

 

Description Resource Path Location Type 

undefined reference to `dhc_set_state' iniche_init.c /niosII_Simple_Socket_Server_ohne_DHCP line 483 C/C++ Problem
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

IIRC there is something special to do to set up the interface in rgmii mode, as it is on the 3C120 kit. I don't remember it exactly but a search on the forum could help. 

Looking in the software templates in Quartus 10.1 they seem to have created special rgmii templates, maybe you can try those.
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

Hi, 

 

I tried out the SimpleSocketServer_RGMII and this one is running. It seems so, that the 3C120 Dev Board needs a RGMII-Design in Nios. 

 

Thanks a lot to Daixiwen! You gave me the special tip. 

 

Possibly Altera adds the RGMII code to the 3c120-board tuturial.  

 

Best Regards 

 

Mark
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

To anyone who's curious, I think this was the solution: 

 

http://www.altera.com/support/kdb/solutions/rd11122009_293.html
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

This a all things you need, If it help for you. Thanks to me so much 

 

I done
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

error_t generate_mac_addr(unsigned char mac_addr[6]) 

error_t error = -1; 

alt_u32 ser_num = 0; 

 

printf("\nCan't read the MAC address from your board. We will assign you\n"); 

printf("a MAC address.\n\n"); 

 

ser_num = get_serial_number(); 

 

if (ser_num) 

/* This is the Altera Vendor ID */ 

mac_addr[0] = 0x0; 

mac_addr[1] = 0x7; 

mac_addr[2] = 0xed; 

 

/* Reserverd Board identifier */ 

mac_addr[3] = 0xFF; 

mac_addr[4] = (ser_num & 0xff00) >> 8; 

mac_addr[5] = ser_num & 0xff; 

 

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]); 

 

error = 0; 

 

return error;  

 

/* 

* 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; 

 

 

if (!error) 

signature = IORD_32DIRECT(last_flash_sector, 0); 

if (signature != 0x00005afe) 

error = generate_and_store_mac_addr(); 

 

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; 

 

/* 

* get_mac_addr 

* Read the MAC address in a board specific way 

*/ 

int get_mac_addr(NET net, unsigned char mac_addr[6]) 

error_t error = 0; 

 

error = get_board_mac_addr(mac_addr); 

 

if(error) 

/* Failed read MAC address from flash, prompt user to enter serial  

number to generate MAC address. */ 

error = generate_mac_addr(mac_addr); 

return error; 

 

/* 

* get_ip_addr() 

*  

* This routine is called by InterNiche to obtain an IP address for the 

* specified network adapter. Like the MAC address, obtaining an IP address is 

* very system-dependant and therefore this function is exported for the 

* developer to control. 

*  

* In our system, we are either attempting DHCP auto-negotiation of IP address, 

* or we are setting our own static IP, Gateway, and Subnet Mask addresses our 

* self. This routine is where that happens. 

*/ 

int get_ip_addr(alt_iniche_dev *p_dev, 

ip_addr* ipaddr, 

ip_addr* netmask, 

ip_addr* gw, 

int* use_dhcp) 

 

IP4_ADDR(*ipaddr, IPADDR0, IPADDR1, IPADDR2, IPADDR3); 

IP4_ADDR(*gw, GWADDR0, GWADDR1, GWADDR2, GWADDR3); 

IP4_ADDR(*netmask, MSKADDR0, MSKADDR1, MSKADDR2, MSKADDR3); 

 

# ifdef DHCP_CLIENT 

*use_dhcp = 1; 

# else /* not DHCP_CLIENT */ 

*use_dhcp = 0; 

 

printf("Static IP Address is %d.%d.%d.%d\n", 

ip4_addr1(*ipaddr), 

ip4_addr2(*ipaddr), 

ip4_addr3(*ipaddr), 

ip4_addr4(*ipaddr)); 

# endif /* not DHCP_CLIENT */ 

 

/* Non-standard API: return 1 for success */ 

return 1; 

 

/******************************************************************************* 

* Flash service functions. 

******************************************************************************/ 

 

# include "sys/alt_flash.h" 

# include "sys/alt_flash_dev.h" 

 

/* 

* FindLastFlashSectorOffset 

* <-- pLastFlashSectorOffset Offset of last sector in flash. 

* This function finds the offset to the last sector in flash and returns it 

* in pLastFlashSectorOffset. 

*/ 

 

int FindLastFlashSectorOffset( 

alt_u32 *pLastFlashSectorOffset) 

alt_flash_fd *fd; 

flash_region *regions; 

int numRegions; 

flash_region *pLastRegion; 

int lastFlashSectorOffset; 

int n; 

int error = 0; 

 

/* Open the flash device. */ 

fd = alt_flash_open_dev(EXT_FLASH_NAME); 

if (fd <= 0) 

error = -1; 

 

/* Get the flash info. */ 

if (!error) 

error = alt_get_flash_info(fd, &regions, &numRegions); 

 

/* Find the last flash sector. */ 

if (!error) 

pLastRegion = &(regions[0]); 

for (n = 1; n < numRegions; n++) 

if (regions[n].offset > pLastRegion->offset) 

pLastRegion = &(regions[n]); 

lastFlashSectorOffset = pLastRegion->offset 

+ pLastRegion->region_size 

- pLastRegion->block_size; 

 

/* Return results. */ 

if (!error) 

*pLastFlashSectorOffset = lastFlashSectorOffset; 

 

return (error); 

}
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

in addition, You can post up a code that you defined your IP to ping. and I can test helping for you. I'm also related to my topic.

0 Kudos
Altera_Forum
Honored Contributor II
772 Views

Above all, You should test define in "simple_socket_server.h" 

 

there a numerous at "web_server.h" 

 

in addition, I think that define for IP address have a problem.  

 

please posted full code it will show how code error.
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

Hi all, 

 

i got a NEEK 3c25 board, i've followed instructions step by step but at the end when i launch Eclipse project the console output get stuck with:  

 

PHY INFO: waiting on PHY link... 

 

and nothing happens, no IP is assigned to the board and lights on Ethernet connector of the NEEK board remains on with no blinking. 

If i attach/detach ethernet plug to NEEK board it's the same..  

 

My configuration is PC LAN with DHCP and NEEK LAN connected to a switch. 

 

I've tried also to uncheck dhcp in BSD properties but this action lead to impossility to compile eclipse project i have a lot of errors...
0 Kudos
Altera_Forum
Honored Contributor II
772 Views

Hi Mark, 

 

May be this thread is too old. But I am also stuck with the same problem now. I have a relatively old Cyclone III FPGA board, bought in 2009 I think. It could not run the "simple_socket_server_rgmii" example provided in "altera\12.1\nios2eds\examples\software". It cannot run even the recently downloaded example from: http://www.altera.com/support/examples/nios2/exm-using-nichestack.html . I added -DTSE_MY_SYSTEM flag and also commented out "IOWR(&pmac->mdio1.reg14, 0, dat); " line as suggested here: http://www.niosii.com/support/kdb/solutions/rd01042012_567.html 

 

The "tse_my_system.c" file is already provided in the recent example with the necessary code. Do you have any idea what might have gone wrong? Do I need to change any settings on my computer? 

 

Thanks,
0 Kudos
Reply