Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
800 Views

Simple Socket Server Template can't find mac adress?

hello, 

I am using Simple Socket Server Template for my own triple speed ethernet qsys system in which I modify the NiosII Ethernet Standard Design by replacing DDRx with ssram on my CycloneIV GX150 Development Board.I just build my simple socket server project with the template(RGMII) without anything changed except for the tse_my_system.c.When I run my projec,the NiosII Console display some information as the text below:  

 

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. We will assign you 

a MAC address. 

 

 

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) 

 

 

123456789 

123456789 

Your Ethernet MAC address is 00:07:ed:ff:cd:15 

prepped 1 interface, initializing... 

[tse_mac_init] 

INFO : TSE MAC 0 found at address 0x0800a000 

INFO : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group[0] 

INFO : PHY[0.0] - Automatically mapped to tse_mac_device[0] 

INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... 

INFO : PHY[0.0] - Auto-Negotiation PASSED 

MARVELL : Mode changed to RGMII/Modified MII to Copper mode 

MARVELL : Enable RGMII Timing Control 

MARVELL : PHY reset 

INFO : PHY[0.0] - Checking link... 

INFO : PHY[0.0] - Link not yet established, restart auto-negotiation... 

INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... 

INFO : PHY[0.0] - Auto-Negotiation PASSED 

INFO : PHY[0.0] - Link established 

INFO : PHY[0.0] - Speed = 100, Duplex = Full 

OK, x=0, CMD_CONFIG=0x00000000 

 

 

MAC post-initialization: CMD_CONFIG=0x04000203 

[tse_sgdma_read_init] RX descriptor chain desc (1 depth) created 

mctest init called 

IP address of et1 : 192.168.1.80 

Acquired IP address via DHCP client for interface: et1 

IP address : 192.168.1.104 

Subnet Mask: 255.255.255.0 

Gateway : 192.168.1.1 

 

 

Simple Socket Server starting up 

[sss_task] Simple Socket Server listening on port 30 

Created "simple socket server" task (Prio: 4) 

 

:confused:What make me confused is how could i edit the source code to solve the problem of can't find mac address from my board.Could anybody give me some advice?I'm much obliged to you for helping me.
0 Kudos
8 Replies
Altera_Forum
Honored Contributor I
72 Views

Browse the Simple Socket Server source code. 

In one of the source files (IIRC network_utilities.c) you should find a function named get_mac_addr() or get_board_mac_addr(). 

Change the function body in order to return a fixed MAC address instead of asking you to enter one. 

 

Regards
Altera_Forum
Honored Contributor I
72 Views

comment the entire code of "get_serial_number (void)" , if your board do ot have any serial number. 

 

and then in generate_and_store_mac_addr() assign to ser_num = 1;//get_serial_number(); 

and then inside if loop assign your own XX value 

/* This says the image is safe */ 

flash_content[0] = 0xfe; 

flash_content[1] = 0x5a; 

flash_content[2] = 0x0; 

flash_content[3] = 0x0; 

 

/* This is the Altera Vendor ID */ 

flash_content[4] = 0x00; 

flash_content[5] = 0x07; 

flash_content[6] = 0xED; 

 

/* Reserverd Board identifier for erase boards */ 

flash_content[7] = 0xXX;//FF; 

flash_content[8] = 0xXX;//(ser_num & 0xff00) >> 8; 

flash_content[9] = 0xXX;//ser_num & 0xff; 

 

 

once again in function generate_mac_addr(unsigned char mac_addr[6]) assign one to ser_num = 1;//get_serial_number(); and assign  

 

/* Reserverd Board identifier */ 

mac_addr[3] = 0xXX;//FF; 

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

mac_addr[5] = 0xXX;//ser_num & 0xff;
Altera_Forum
Honored Contributor I
72 Views

 

--- Quote Start ---  

Browse the Simple Socket Server source code. 

In one of the source files (IIRC network_utilities.c) you should find a function named get_mac_addr() or get_board_mac_addr(). 

Change the function body in order to return a fixed MAC address instead of asking you to enter one. 

 

Regards 

--- Quote End ---  

 

Thank you Cris!As your tips shows for me,I read the function get_mac_addr and get_board_mac_addr().Then i guess the problem may caused by the code below,is it rigth? 

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

 

But i don't know how to change the code properly.Could you give me a little tips?Thank you!
Altera_Forum
Honored Contributor I
72 Views

 

--- Quote Start ---  

comment the entire code of "get_serial_number (void)" , if your board do ot have any serial number. 

 

and then in generate_and_store_mac_addr() assign to ser_num = 1;//get_serial_number(); 

and then inside if loop assign your own XX value 

/* This says the image is safe */ 

flash_content[0] = 0xfe; 

flash_content[1] = 0x5a; 

flash_content[2] = 0x0; 

flash_content[3] = 0x0; 

 

/* This is the Altera Vendor ID */ 

flash_content[4] = 0x00; 

flash_content[5] = 0x07; 

flash_content[6] = 0xED; 

 

/* Reserverd Board identifier for erase boards */ 

flash_content[7] = 0xXX;//FF; 

flash_content[8] = 0xXX;//(ser_num & 0xff00) >> 8; 

flash_content[9] = 0xXX;//ser_num & 0xff; 

 

 

once again in function generate_mac_addr(unsigned char mac_addr[6]) assign one to ser_num = 1;//get_serial_number(); and assign  

 

/* Reserverd Board identifier */ 

mac_addr[3] = 0xXX;//FF; 

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

mac_addr[5] = 0xXX;//ser_num & 0xff; 

--- Quote End ---  

 

 

Thank you very much!Yes i get the mac address under your guide!But i also want to know how can i read the mac address from the flash.I test my boad with board_test_system which can read the mac address properly.So is it ture that the mac address still be availble without erasing?Also,i get a problem as below: 

 

Your Ethernet MAC address is 00:07:ed:1b:04:9e 

prepped 1 interface, initializing... 

[tse_mac_init] 

INFO : TSE MAC 0 found at address 0x0800a000 

INFO : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group[0] 

INFO : PHY[0.0] - Automatically mapped to tse_mac_device[0] 

INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... 

INFO : PHY[0.0] - Auto-Negotiation PASSED 

MARVELL : Mode changed to RGMII/Modified MII to Copper mode 

MARVELL : Enable RGMII Timing Control 

MARVELL : PHY reset 

INFO : PHY[0.0] - Checking link... 

INFO : PHY[0.0] - Link not yet established, restart auto-negotiation... 

INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... 

INFO : PHY[0.0] - Auto-Negotiation PASSED 

INFO : PHY[0.0] - Link established 

INFO : PHY[0.0] - Speed = 100, Duplex = Full 

OK, x=0, CMD_CONFIG=0x00000000 

 

MAC post-initialization: CMD_CONFIG=0x04000203 

[tse_sgdma_read_init] RX descriptor chain desc (1 depth) created 

mctest init called 

IP address of et1 : 0.0.0.0 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

Acquired IP address via DHCP client for interface: et1 

IP address : 192.168.1.101 

Subnet Mask: 255.255.255.0 

Gateway : 192.168.1.1 

 

Simple Socket Server starting up 

[sss_task] Simple Socket Server listening on port 30 

Created "simple socket server" task (Prio: 4) 

 

It has stopped at "simple socket server" task.Could you tell me why?Thank you!
Altera_Forum
Honored Contributor I
72 Views

 

--- Quote Start ---  

 

It has stopped at "simple socket server" task.Could you tell me why?Thank you! 

--- Quote End ---  

 

 

AFAIK this is the correct flow of SSS; there isn't any error! 

It has stopped because it has indeed nothing else to do, until a connection on port 30 will be requested by a network client.
Altera_Forum
Honored Contributor I
72 Views

 

--- Quote Start ---  

AFAIK this is the correct flow of SSS; there isn't any error! 

It has stopped because it has indeed nothing else to do, until a connection on port 30 will be requested by a network client. 

--- Quote End ---  

 

 

Thank you very much indeed! 

When I use the telnet to connect my simple socket server,it really works!
Altera_Forum
Honored Contributor I
72 Views

 

--- Quote Start ---  

AFAIK this is the correct flow of SSS; there isn't any error! 

It has stopped because it has indeed nothing else to do, until a connection on port 30 will be requested by a network client. 

--- Quote End ---  

 

 

I am sorry to disturb you again.I meet another problem when i using simple socket server.I use telnet to connect with my project.As the menu shows,When I press 0 then press retrun,I find that nothing happens with led.Could you help me to solve this problem?Because I don't know why.Thank you!
Altera_Forum
Honored Contributor I
72 Views

 

--- Quote Start ---  

hello, 

I am using Simple Socket Server Template for my own triple speed ethernet qsys system in which I modify the NiosII Ethernet Standard Design by replacing DDRx with ssram on my CycloneIV GX150 Development Board.I just build my simple socket server project with the template(RGMII) without anything changed except for the tse_my_system.c.When I run my projec,the NiosII Console display some information as the text below:  

 

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. We will assign you 

a MAC address. 

 

 

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) 

 

 

123456789 

123456789 

Your Ethernet MAC address is 00:07:ed:ff:cd:15 

prepped 1 interface, initializing... 

[tse_mac_init] 

INFO : TSE MAC 0 found at address 0x0800a000 

INFO : PHY Marvell 88E1111 found at PHY address 0x12 of MAC Group[0] 

INFO : PHY[0.0] - Automatically mapped to tse_mac_device[0] 

INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... 

INFO : PHY[0.0] - Auto-Negotiation PASSED 

MARVELL : Mode changed to RGMII/Modified MII to Copper mode 

MARVELL : Enable RGMII Timing Control 

MARVELL : PHY reset 

INFO : PHY[0.0] - Checking link... 

INFO : PHY[0.0] - Link not yet established, restart auto-negotiation... 

INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... 

INFO : PHY[0.0] - Auto-Negotiation PASSED 

INFO : PHY[0.0] - Link established 

INFO : PHY[0.0] - Speed = 100, Duplex = Full 

OK, x=0, CMD_CONFIG=0x00000000 

 

 

MAC post-initialization: CMD_CONFIG=0x04000203 

[tse_sgdma_read_init] RX descriptor chain desc (1 depth) created 

mctest init called 

IP address of et1 : 192.168.1.80 

Acquired IP address via DHCP client for interface: et1 

IP address : 192.168.1.104 

Subnet Mask: 255.255.255.0 

Gateway : 192.168.1.1 

 

 

Simple Socket Server starting up 

[sss_task] Simple Socket Server listening on port 30 

Created "simple socket server" task (Prio: 4) 

 

:confused:What make me confused is how could i edit the source code to solve the problem of can't find mac address from my board.Could anybody give me some advice?I'm much obliged to you for helping me. 

--- Quote End ---  

 

 

hi, 

i have the same problem but at the line above , "ip address of et1 : 192.168.1.80" , it gets stuck and becomes not responding. also it shows 0.0.0.0 in place of the ip address. any idea what can i do?  

also do i need to manually enter the ip address, subnet, gateway etc in the following lines: 

 

----->  

ip4_addr(*ipaddr, ipaddr0, ipaddr1, ipaddr2, ipaddr3); ip4_addr(*gw, gwaddr0, gwaddr1, gwaddr2, gwaddr3); 

ip4_addr(*netmask, mskaddr0, mskaddr1, mskaddr2, mskaddr3); 

----->
Reply