Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12596 Discussions

Help: Simple Socket Server - Stratix IV GX

Altera_Forum
Honored Contributor II
5,134 Views

Hello,  

 

I have a very basic knowledge on FPGAs and Verilog, as I only started to learn about it this semester. my final year project is quite big as I have to implement a PoE structure then make connection with the FPGa board then finally adding a sensor to system. For now I needs to build a simple socket server work on my FPGA board Stratix IV.  

 

I have looked through the forum and found this article, which explains nicely on how to build one  

 

http://www.alteraforum.com/forum/showthread.php?t=28837 

 

but there are things that I did not understand because of different board.  

 

what does this mean (DE2_115_WEB_SERVER_RGMII_ENET0 demo) ad where can I find the demo that is suitable for my board.  

 

 

honestly I don't know where to start,  

 

please any guidelines will really be helpful .  

 

Thanks You  

 

0 Kudos
27 Replies
Altera_Forum
Honored Contributor II
1,142 Views

Look on the web site of the company that made your demo board. They should have examples suitable for your board.

0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

@Galfonz  

 

I have used the web server file of the Stratix IV and I just wanted to run the Qsys file and generate it but it gives me an error though I did not change anything, knowing that the file was for version 12 but it says it can be used in letter versions also, the error is 

 

Error: eth_std_main_system.ethernet_subsystem.tse_mac: Component triple_speed_ethernet 12.0 not found or could not be instantiated 

 

my version is Quartus 15 all other components written used (version 15 instead of 12), but I did not find this component.  

 

Am new in it please guide me  

 

thank you
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

hi,  

it means that the triple speed eth 12.0 is out of date so you ll have to instantiate the newest version from qsys (quartus2 15.0 related) and make the connexions by yourself. in the search bar, look for triple speed ethernet.
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

 

--- Quote Start ---  

hi,  

it means that the triple speed eth 12.0 is out of date so you ll have to instantiate the newest version from qsys (quartus2 15.0 related) and make the connexions by yourself. in the search bar, look for triple speed ethernet. 

--- Quote End ---  

 

 

Hi I have managed to make everything work but it seems that packets are sent from the FPGA but nothing is received... !! what will possibly be wrong ? I used Putty software using Telnet connection in port 30 but nothing seems to appear. though I have no error in the program  

 

please advice
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

does a ping responds at least?

0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

 

--- Quote Start ---  

does a ping responds at least? 

--- Quote End ---  

 

 

No even the ping does not respond !!
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

post your hdl code please so i can try to help.

0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

 

--- Quote Start ---  

post your hdl code please so i can try to help. 

--- Quote End ---  

 

 

when I run the software this is what I get  

 

------------------------------------------------------------------------------------------------------------------------------------------------- 

https://www.alteraforum.com/forum/attachment.php?attachmentid=12398  

------------------------------------------------------------------------------------------------------------------------------------------------- 

 

Your Ethernet MAC address is 00:07:ed:ff:6b:c7 

prepped 1 interface, initializing... 

[tse_mac_init] 

INFO : TSE MAC 0 found at address 0x0800a000 

INFO : PHY Marvell 88E1111 found at PHY address 0x00 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 

INFO : PCS[0.0] - Configuring PCS operating mode 

INFO : PCS[0.0] - PCS SGMII mode disabled 

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

INFO : PHY[0.0] - Link established 

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

OK, x=0, CMD_CONFIG=0x00000000 

 

MAC post-initialization: CMD_CONFIG=0x0400020b 

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

mctest init called 

IP address of et1 : 0.0.0.0 

 

------------------------------------------------------------------------------------------------------------------------------------------------- 

 

I don't understand why am I getting that IP address, 

 

the software am running is from altera hardware example designs this is the code that is specifically for the IP address portion  

 

 

------------------------------------------------------------------------------------------------------------------------------------------------- 

 

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

}  

 

------------------------------------------------------------------------------------------------------------------------------------------------- 

 

 

Another thing that the software asks for the serial number to generate the mac address I couldnt find the serial number on the box so I just enetered random " 111111111111111" number. 

 

So what can I do with the IP address or should i eneter it manually since its a static IP ?
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

1-is the FPGA connected to a switch or directly to your pc? 

2-if it s connected to a switch, ask your admin to give you a mac address related to a IP/DHCP, he will it give to you. 

3- GO Qsys and disable PCS options in tse, since you re using an external phy 

4- For mac address in software, this example assumes you have this info in an external flash, but you can override it with this (network_utilities.c): 

error_t get_board_mac_addr(unsigned char mac_addr) { error_t error = 0; alt_u32 signature; mac_addr = 0x00; mac_addr = 0x07; mac_addr = 0xED; mac_addr = 0xFF; mac_addr = 0x0C; mac_addr = 0x83; return error; }  

replace with mac address you get from your sys admin. 

 

 

the problem should be resolved then
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

My FPGA is connected directly to PC, so am not using any DHCP client. 

do I have to disable the tse if its connected directly ? 

 

and about the mac address do I replace the whole code of that part (error_t get_board_mac_addr(unsigned char mac_addr[6])
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

i think you don't understand what you are doing there. If you disable tse how could your ethernet link work? 

 

 

In your case, you have to put IP address directly like this (network_utilities.c) : (i'm not sure since i use dhcp) 

int get_ip_addr(alt_iniche_dev *p_dev, ip_addr* ipaddr, ip_addr* netmask, ip_addr* gw, int* use_dhcp) { IP4_ADDR(*ipaddr, 192, 168, 1, 100); IP4_ADDR(*gw, 192, 168, 1, 254); IP4_ADDR(*netmask, 255, 255, 255, 0); /* Non-standard API: return 1 for success */ return 1; }  

 

and yes you should replace the section of code i gave to you, and this one above too. 

 

please read this before trying to continue your project, you need some basis 

ftp://ftp.altera.com/up/pub/altera_material/12.0/tutorials/de4/using_triple_speed_ethernet.pdf
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

 

--- Quote Start ---  

i think you don't understand what you are doing there. If you disable tse how could your ethernet link work? 

 

and yes you should replace the section of code i gave to you, and this one above too. 

 

please read this before trying to continue your project, you need some basis 

ftp://ftp.altera.com/up/pub/altera_material/12.0/tutorials/de4/using_triple_speed_ethernet.pdf 

--- Quote End ---  

 

 

Alright thank you, am really a beginner here.  

 

I appreciate your help
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

hi, 

one question : what is the board you re using? 

 

ps : hold on, this job is not an easy one ^^
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

 

--- Quote Start ---  

hi, 

one question : what is the board you re using? 

 

ps : hold on, this job is not an easy one ^^ 

--- Quote End ---  

 

 

I am using Stratix IV GX230, I have managed to enable the SGMII because it was showing disabled in the results. I set the (TSE_MAC_PCS_SGMII= 1), I still don't receive anything I can notice that the FPGA sends packets thru the link but nothing is received
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

you are telling me the fpga not the board. Is that a terasic board or something else or a custom board? 

disable pcs option in tse cause you re using an external phy. 

Read the manual!!! 

Are you using a copper rj45 link?
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

 

--- Quote Start ---  

you are telling me the fpga not the board. Is that a terasic board or something else or a custom board? 

disable pcs option in tse cause you re using an external phy. 

Read the manual!!! 

Are you using a copper rj45 link? 

--- Quote End ---  

 

 

It is a terasic board,, 

Yes I am using an external PHY but I thought I need an SGMII interface as shown in the manual  

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=12408  

 

and yes I am using the rj45 link
0 Kudos
Altera_Forum
Honored Contributor II
1,142 Views

can you try to force your pc to this ip address : 192.168.1.1, gateway is the same as last reply (look above), same for mask. if it still doesnt work, try to force you pc to 1Gb/s or 100M or whatever, but don't let it auto negociate speed. (i read something like this in this forum when someone tried to direct link his pc to his card) 

i can't really help you further if it doesn't work. I'm sorry. : (
0 Kudos
Altera_Forum
Honored Contributor II
1,088 Views

 

--- Quote Start ---  

can you try to force your pc to this ip address : 192.168.1.1, gateway is the same as last reply (look above), same for mask. if it still doesnt work, try to force you pc to 1Gb/s or 100M or whatever, but don't let it auto negociate speed. (i read something like this in this forum when someone tried to direct link his pc to his card) 

i can't really help you further if it doesn't work. I'm sorry. : ( 

--- Quote End ---  

 

 

Hi I have disabled the DHCP from the BSP editor. Then gave a static IP of 192.168.1.234, then I run it and here are the results,  

I have noticed that LED D23 keeps blinking and the RX LED of ENET is blinking too but what does that "yyyyyyyyyyy" mean ????!!!
0 Kudos
Reply