Forum Discussion
Altera_Forum
Honored Contributor
15 years agoWORKING: DE2-115 Simple Socket Server
Hi,
It seems difficult to get help on these forums so I want to pass on what i learnt for others. I've struggled to learn FPGAs over the past few weeks and I have finally got a simple socket server working for the DE2-115. I'll quickly post my findings so someone else can take this and learn from it and not have to struggle on their own as i did. procedure I'll make this brief:- I used updated versions for everything as of 4/4/11. 10.1 Sp1.
- Download and install the Knowledge base update to prevent nios from crashing. http://www.altera.com/support/kdb/solutions/rd12222010_317.html
- Take the Quartus DE2_115 webserver example for Enet0 RGMII that comes on the CD and use quartus flash programmer to program.
- Get this PDF and follow its instructions "http://www.altera.com/literature/tt/tt_nios2_tcpip.pdf?gsa_pos=1&wt.oss_r=1&wt.oss=simple socket server example nios edition socket server example nios edition" NOTE it includes the spaces (wierd). do everything the same except the part mentioned in my next step.
- Instead of copying the files from the tutorial.zip; copy the ones that i have attached to this post. (the .c and .h files including the eeprom folder)
- This example will now work as explained in the pdf.
- The original example code in the tutorial does not have the correct method for gettig the MAC address on the DE2-115. I have deleted the majority of the original MAC code and replaced it with code i got from the DE2-115 webserver example. This includes the flashgetoffset function.
- The LED_PIO_BASE in the original is an invalid for the DE2-115. I replaced it with the LEDG (green leds), you could replace it with red if you wished. This has been done by modifying the led.c file.
66 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I used a cross-over cable and set the computer's IP address to 192.168.10.235, and the subnet mask and the gateway to the same value as the socket server. Then, if you ping the Board's IP address 192.168.10.234, it should be successful. Where do you have troubles? --- Quote End --- Thanks for your reply,I have do the job as you say,but ping meet the problems as follows: ************************************************* Pinging 192.168.10.234 with 32 bytes of data: reply from 192.168.10.235 :Can not access the target host reply from 192.168.10.235 :Can not access the target host reply from 192.168.10.235 :Can not access the target host reply from 192.168.10.235 :Can not access the target host Ping statistics for 192.168.10.234 : Packets :Sent = 4, Received = 4, Lost = 0(0% loss), ************************************************* at the same time, telnet still failed at the port 30. Have you ever change the code in simple_socket_server.c or something else(especially the code about DHCP)? - Altera_Forum
Honored Contributor
Can you post the full output of NIOS? Does it say: "Auto-negotiation Failed" or "...Passed"?
- Altera_Forum
Honored Contributor
I changed the http_send_file() function and I added the code that you gave me,however when I open the webpage it is generating the following error on the console: Error_handle_receive: error preparing response and on the webpage it is giving me:
error 324 (net::err_empty_response): the server closed the connection without sending any data. And one more question please: why did the following statement generate error on tse (undefined variable): strncpy(IP_Stat.MAC_Address,sprint_macaddr(macaddress),IP_ADDR_SIZE); Thank you so much for your help! - Altera_Forum
Honored Contributor
--- Quote Start --- Can you post the full output of NIOS? Does it say: "Auto-negotiation Failed" or "...Passed"? --- Quote End --- The output of NIOS II is: *************************************************************** 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:ff:61:06 Static IP Address is 192.168.10.234 prepped 1 interface, initializing... [tse_mac_init] INFO : TSE MAC 0 found at address 0x0b442000 INFO : PHY Marvell 88E1111 found at PHY address 0x10 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 = 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 : 192.168.10.234 Created "Inet main" task (Prio: 2) Created "clock tick" task (Prio: 3) Simple Socket Server starting up [sss_task] Simple Socket Server listening on port 30 Created "simple socket server" task (Prio: 4) ******************************************************** It seems that it should work, but the ping & telnet can't work, and the error i have show you previously. - Altera_Forum
Honored Contributor
--- Quote Start --- Can you post the full output of NIOS? Does it say: "Auto-negotiation Failed" or "...Passed"? --- Quote End --- Dear David, the ping and telnet are succeed when I use the DHCP server, but when I connect the board and PC with a cross-over cable, I failed. DHCP in the BSPEditor is diabled, and I change some codes in Quartus II,as follows: *********************************** // ===== SOPC control signal defing assign set_1000_to_the_tse_mac = 1'b1; assign set_10_to_the_tse_mac = 1'b0; *********************************** hope for your reply. - Altera_Forum
Honored Contributor
I don't know what's going on. I think best would be, if you opened a new thread.
- Altera_Forum
Honored Contributor
--- Quote Start --- I don't know what's going on. I think best would be, if you opened a new thread. --- Quote End --- Hi,David I open a new thread, and I meet the same problem. I can send words or command via Telnet or Ping, when I use a router. However, I always failed when I directly connect the board and PC with a cross-over cable. I am really confused, I hope that you could help me. Can you send your software project to my email, then I can compare our code. My email --- [email protected] Have a good day! - Altera_Forum
Honored Contributor
--- Quote Start --- Thanks for posting your design. I cannot get your design running. When I implement your design, I get the error: undefined reference to 'tse_mac_device' Specifically, the error lies in these two lines of code are indicated in the file altera_avalon_tse.c: if(tse_mac_device.tse_mac_base == p_driver_data->hw_mac_base_addr) {psys_info = &tse_mac_device; Does anyone know how I can handle this error? I can't see how I should build my own socket server, when the examples are not working. I can also use the DE4 board if that is easier. Thanks --- Quote End --- --- Quote Start --- Hi,David I open a new thread, and I meet the same problem. I can send words or command via Telnet or Ping, when I use a router. However, I always failed when I directly connect the board and PC with a cross-over cable. I am really confused, I hope that you could help me. Have a good day! --- Quote End --- Hi, David and bjtuxuxu, I'm facing the same problem now and really confused about how to make the telnet client access the cable connected to the board. My program just keeps listening but nerver get the request...... Could you please give me some suggestions about how to solve the problem ? Really thanks for your help!!
- Altera_Forum
Honored Contributor
You should set your PC to 1000Mbps full duplex.
And if you failed at ethernet0, then try ethernet1. Good luck ! - Altera_Forum
Honored Contributor
Hi all
after 2 weeks I can run the SSS application thanks for providing the modified version for DE2-115 and thanks for all post , it was very helpful for me especially is my first nios II application ! but I cant only run the application with the DHCP if I disable DHCP I get the following errors and the application won't build 1- void SSSInitialTask(void *task_data) { INT8U error_code; system_dhcp_hostname = "NEEK_1"; wait_on_phy(); /* * Register new DHCP "IP attained" callback function. * If DHCP is acquired, ws_ipset will be called instead of dhc_main_ipset(). */ dhc_set_callback( 0, ws_ipset ); // error 2- void SSSMonitorPhyTask(void *task_data) { // // // dhc_set_state( 0, dhcs_initreboot );// errorany idea how to fix these 2 errors to connect FPGA directly to my PC many thanks in advance