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
Hi Sir,
In my run i couldnt see the [tse_mac_init]. Do you know why? I able to reach where Simple Socket Server starting up [sss_task] Simple Socket Server listening on port 30 Created "simple socket server" task (Prio: 4) But my telnet doesnt work. Thanks. InterNiche Portable TCP/IP, v3.1 Copyright 1996-2008 by InterNiche Technologies. All rights reserved. prep_tse_mac 0 Static IP Address is 192.168.1.234 prepped 1 interface, initializing... [tse_mac_init] INFO : TSE MAC 0 found at address 0x08004000 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 INFO : PHY[0.0] - Checking link... INFO : PHY[0.0] - Link established INFO : PHY[0.0] - Speed = 100, Duplex = Full OK, x=1, CMD_CONFIG=0x00000000 MAC post-initialization: CMD_CONFIG=0x04000203 [tse_sgdma_read_init] RX descriptor chain desc (1 depth) created - Altera_Forum
Honored Contributor
Only issue I had that I could help with is, the MAC address.
If you've done other examples on your board, you've likely erased the flash. You need to hard code your MAC, there is a place for that in the code. See the attached code on the 1st post. - Altera_Forum
Honored Contributor
Im in the phone posting so I can't see code. There are some# define constants called hc_Mac or something like that. Pretty sure they are in iniche. So track there use and ensure they get used to make the Mac. Just trim away all the other junk
- Altera_Forum
Honored Contributor
thanks, i did successfully, but i want to move the nios program to sram instead of sdram and i coudnt it. The error happens when i try to run the program in the FPGA:
"Hardware configuration' has encountered a problem. Downloading ELF Process failed" i have changed reset vector, exception vector(SOPC) and the linker region(BSP editor)) any idea? thanks - Altera_Forum
Honored Contributor
Do you have other error messages in the console, such as a verify fail? Did you run a memory test program on the SRAM?
- Altera_Forum
Honored Contributor
--- Quote Start --- "Hardware configuration' has encountered a problem. Downloading ELF Process failed" --- Quote End --- Hi PeFarina, Another thing to check is that the folder for your software project has sharing permissions. Part of the process of downloading the ELF file involves changing file attributes which cannot be accomplished if Eclipse does not have sharing privileges with the project folder. On my Windows 7 system I right-click on the project folder and select Share with > Homegroup (Read/Write). Your procedure may vary slightly depending on your system. Good luck! - Altera_Forum
Honored Contributor
--- Quote Start --- Do you have other error messages in the console, such as a verify fail? Did you run a memory test program on the SRAM? --- Quote End --- After that the download is completed (it gets 100%) i have a window saying "Hardware configuration' has encountered a problem. Downloading ELF Process failed" but in the warnings tab are two errors: Error launching external scanner info generator (sh -c 'g++ -E -P -v -dD C:/Users/Anónimo/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp ') Error launching external scanner info generator (sh -c 'gcc -E -P -v -dD C:/Users/Anónimo/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c ') both files, specs.cpp and specs.c, seem empty i didnt run a memory test program on the SRAM. i dont know how i can do it. could you show a example? thanks - Altera_Forum
Honored Contributor
--- Quote Start --- After that the download is completed (it gets 100%) i have a window saying "Hardware configuration' has encountered a problem. Downloading ELF Process failed" but in the warnings tab are two errors: Error launching external scanner info generator (sh -c 'g++ -E -P -v -dD C:/Users/Anónimo/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp ') Error launching external scanner info generator (sh -c 'gcc -E -P -v -dD C:/Users/Anónimo/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c ') both files, specs.cpp and specs.c, seem empty i didnt run a memory test program on the SRAM. i dont know how i can do it. could you show a example? thanks --- Quote End --- Based on this and your previous post it appears that your primary problem is with the SRAM and the warning messages are a separate issue. I would check the SRAM first to be sure it is connected and working properly. The Memory Test program that Daixiwen refers to is an example app in the Nios II Software Build Tools for Eclipse that runs on the Nios II processor. You must create, build, and run this app in Eclipse, and it must be downloaded to different memory than you are trying to test. If you have enough on-chip memory you can put it there, but in my case I did not. In fact in my custom system I don't have enough memory anywhere except the SRAM I want to test, so this test is ineffective. A better way to see if your SRAM is working is to use the System Console. This tests memory at a very fundamental level that does not require the Nios II processor to be running. You still need a Nios II in the Qsys design to have access to the JTAG Debug Module. I attached a text file that provides a step-by-step procedure for test SRAM in this manner. I would like to know your results, so please post again. - Altera_Forum
Honored Contributor
thanks fheineman, i cant see your attached text file.Could you post again?
im using Quartus II 11.0sp1 Web Edition (32-Bit) - Altera_Forum
Honored Contributor
--- Quote Start --- thanks fheineman, i cant see your attached text file.Could you post again? im using Quartus II 11.0sp1 Web Edition (32-Bit) --- Quote End --- Sorry, not sure what happened there. I'll just put the text below. Good luck... 1. Launch your FPGA design in Quartus II 11.0 sp1 2. Open the Quartus II Programmer and program your FPGA with the current .sof file. 3. Open Qsys and load your Qsys design 4. Under Tools menu select System Console 5. Expand the Tcl Console window as this is the only window you will need. 6. At the % prompt type (or cut and paste this):
 "set mypath [ lindex [ get_service_paths master ] 0 ]" 

You should get a path statement something like this:
 "/connections/USB-Blaster on localhost [USB-0]/EP3C25|EP4CE22@1/[MFG:70 ID:34 INST:0 VER:3]/cpu" 

 This establishes the JTAG UART connection path to the Nios II processor. If you don't see this then the JTAG UART connection is broken. That is another can of worms not addressed by this document. You must fix that before proceeding. This is often due to timing issues in your Quartus design. TimeQuest is the tool for that...
 7. At the % prompt type (or cut and paste this): "
open_service master $mypath" 

 This opens the connection to the Nios II processor.
 8. At the % prompt type (or cut and paste this): "
processor_stop $mypath

" This stops the Nios II processor so it is now out of the picture.
 9. At the % prompt type (or cut and paste this): "
master_write_memory $mypath 0x01000000 [ list 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 ]" 

 This writes 80 bytes of 8-bit Hex data to the address specified. this example uses 0x01000000 as the SRAM address. You MUST set this to an address within the range of the memory in your system that you want to test. 
 10. At the % prompt type (or cut and paste this): "
master_read_memory $mypath 0x01000000 80

" This reads back the data that you wrote to memory in the previous step. Don't forget to change the address to the same as the previous step.
 11. You should see this:
 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 There are many other commands that you can use with the System Console to test the memory and other hardware functions in your system such as master_write_16 and master_write_32. At the % prompt type: "help help" to get a list of all the commands. For more information of any command type "help <command name>" at the % prompt. Happy Testing !!!