Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1174 Discussions

Simple Socket Server on DE2 w/Davicom DM9000A

Altera_Forum
Honored Contributor II
5,043 Views

updated. 

Altera's Simple Socket Server demo running on a DE2 board with the Davicom DM9000a driver. 

 

here it is....zipped downloaded project source for sss on the de2 board. 

download link currently unavailable. 

 

Includes: 

- Hardware design (TLD in schematic block diagram format) 

- Programmable .SOF (time-limited, as developed in Quartus Web Edition v9.2) 

- SOPC builder system file 

- DM9000A driver for Nichestack TCP/IP stack / Altera HAL environment (courtesy of Columbia Uni) 

- Simple socket server software 

 

Simply... 

- (1) Download the .SOF in Quartus Programmer 

 

- (2) Open the software workspace in the "/software" directory in Nios II Build Tools (Eclipse IDE) 

 

- (3) Open Run >> Run Configurations. Delete the current configuration. Create a new launch configuration selecting the project name under the Project Tab. Ensure your DE2 board is plugged into USB. Check the target connection tab and make sure it is present. 

 

- (4) Plug into your local network (DHCP is enabled, or app will default to static IP) 

 

- (5) View the Nios II console for debugging information (via JTAG UART) 

 

- (6) Telnet into the board from a pc: telnet <ip address> 30. Enjoy the simple socket server demo from Altera! 

 

Questions/comments? Fire away below!
0 Kudos
98 Replies
Altera_Forum
Honored Contributor II
437 Views

hi friends, 

I am trying to build Simple Socket Server on Altera DE2-70 Board, everything seem fine, but when I run it, it showed me the error. I searched around the internet, but seem none of solution work for me. Please help me with it. 

 

Here is my error message 

 

Copyright 1996-2008 by InterNiche Technologies. All rights reserved.  

prepped 0 interfaces, initializing... 

inet startup error: unable to find any working interfaces 

panic: IP 

dtrap - needs breakpoint 

 

Please help 

 

Thank you so much!
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Good day. I have been running the simple socket server now with no issues on the DE2-70. Thanks for providing. I have been able to modify my system in sopc, add components as necessary and rebuild a working system. Now I would like to be able to detect the status of the ethernet link for display on a front panel. Does anyone know how to access the link status. 

 

JT
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

 

--- Quote Start ---  

Good day. I have been running the simple socket server now with no issues on the DE2-70. Thanks for providing. I have been able to modify my system in sopc, add components as necessary and rebuild a working system. Now I would like to be able to detect the status of the ethernet link for display on a front panel. Does anyone know how to access the link status. 

 

JT 

--- Quote End ---  

 

 

could you please show me how you do it? I still stuck in the SSS , there is still the error about initialize the DM9000A chip
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Is it possible to upload the files? It could really help.

0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Hi Guys, 

 

I follow everything from your suggestion. After i run it, the following message appear at my console and it look good. 

 

But when i telnet from my PC to the board, it doesnt work. 

 

I direct connect UTP LAN cable from my PC to the board. 

 

Can someone advise me? Thanks. 

 

This software project uses an unlicensed version of the NicheSta=============== Software License Reminder ================ 

This software project uses an unlicensed version of the NicheStack TCP/IP 

Network Stack - Nios II Edition. If you want to ship resulting object 

code in your product, you must purchase a license for this software from 

Altera. For information go to: "http://www.altera.com/nichestack

===================================================== 

InterNiche Portable TCP/IP, v3.1  

Copyright 1996-2008 by InterNiche Technologies. All rights reserved.  

Your Ethernet MAC address is 00:07:ed:ff:92:78 

Static IP Address is 192.168.1.234 

prepped 1 interface, initializing... 

dm9ka_init 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

mctest init called 

IP address of et1 : 192.168.1.234 

Simple Socket Server starting up 

[sss_task] Simple Socket Server listening on port 30 

Created "simple socket server" task (Prio: 4)
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Hi Sir, 

 

I do everything that i know. But i could not telnet my board. I think my board doesn't really have the ethernet connection up. 

 

Can you send me your project file? my email add is cafukarfoo@yahoo.com

 

I will really appreciate your help. I am struggling here. 

 

Thanks. 

 

=============== Software License Reminder ================ 

This software project uses an unlicensed version of the NicheStack TCP/IP 

Network Stack - Nios II Edition. If you want to ship resulting object 

code in your product, you must purchase a license for this software from 

Altera. For information go to: "http://www.altera.com/nichestack

===================================================== 

InterNiche Portable TCP/IP, v3.1  

Copyright 1996-2008 by InterNiche Technologies. All rights reserved.  

Your Ethernet MAC address is 00:07:ed:ff:92:78 

prepped 1 interface, initializing... 

dm9ka_init 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

mctest init called 

IP address of et1 : 192.168.1.234 

Acquired IP address via DHCP client for interface: et1 

IP address : 192.168.1.103 

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)
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Hi Guys, 

 

I think i am missing this part. I attached the picture here. 

 

Can someone help here? 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Just a couple of responses to your questions. 

 

Congratulations "cafukarfoo". You are definately are on the right track. The fact your DE2 board is acquiring an IP over DHCP means the ethernet connection is up and operational. Remember...you can only telnet into the board when a server socket is setup and listening on a particular protocol/port. Try testing your SSS by pinging the DE2 board. If the board reply's to a ICMP packet (ping), then everthing is working and ready for you to implement socket comms. 

 

Well done also to "shenlung". I believe you can access the link status through a memory register on the Davicom DM9000A controller device. You will need to check the datasheet and modify the ethernet driver accordingly. 

 

A few notes also to those who have asked: 

- Yes, project was build on Quartus Web edition. 

- Once running, found the SSS to be extremely stable. Wrote a C library to facilitate socket comms between the DE2 and a Win32 console app. Found the link to be stable and capable of transferring a large amount of data between the DE2<-->PC with no errors.
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Hi tnn design, 

 

I try to ping the board, but no response from my PC. Telnet also not working. 

 

Do you have any idea what happen here? 

 

I use wireshack to check the LAN connection. There is no data coming out from the DE2 board. 

 

Can you give me some hint how i should debug from here? Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

Hi,i have a problem that i can't download the file DE2_SimpleSocketServer.zip,it says that the download now is unavilable 

could you send me a copy to the mail"lengyuetp@163.com",thank you in advance
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

I can't download the file:"DE2_SimpleSocketServer.zip". 

May you send me an email that include the file. 

My email is :410052384@qq.com  

Thank you !
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

I can't download the file:"DE2_SimpleSocketServer.zip". 

May you send me an email that include the file. 

My email is :chenyong41005@163.com  

Thank you !
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

 

--- Quote Start ---  

Just a couple of responses to your questions. 

 

Congratulations "cafukarfoo". You are definately are on the right track. The fact your DE2 board is acquiring an IP over DHCP means the ethernet connection is up and operational. Remember...you can only telnet into the board when a server socket is setup and listening on a particular protocol/port. Try testing your SSS by pinging the DE2 board. If the board reply's to a ICMP packet (ping), then everthing is working and ready for you to implement socket comms. 

 

Well done also to "shenlung". I believe you can access the link status through a memory register on the Davicom DM9000A controller device. You will need to check the datasheet and modify the ethernet driver accordingly. 

 

A few notes also to those who have asked: 

- Yes, project was build on Quartus Web edition. 

- Once running, found the SSS to be extremely stable. Wrote a C library to facilitate socket comms between the DE2 and a Win32 console app. Found the link to be stable and capable of transferring a large amount of data between the DE2<-->PC with no errors. 

--- Quote End ---  

 

 

Good day tnndesign thanks for your comment. I did not implement as part of driver, I implemented a task to read the PHY. This worked except occasionally would lock up the socket communication, I initially had the task priority at a lower number than the simple socket server task, but it occurred to me perhaps the PHY task was being executed mid low level driver activity, mucking up the driver, so I changed the task priority number above the SSS task. It now appears to work but I will test it more. This obviously is not implemented at the driver level but I would like to do so as you suggested. What is involved to implement at the driver level yet keep the function from clobbering the socket communication. 

 

Thanks 

shenlung 

 

 

 

# define LINK_DOWN ((Enables & 0xc) | 0x1) 

# define LINK_UP ((Enables & 0xc) | 0x2) 

 

void SSSMonitorPhyTask(void *task_data) 

INT16U status; 

int disconnect_count; 

int data; 

int Enables; 

 

disconnect_count=0; 

while(1) 

/* Run task once a second */ 

OSTimeDlyHMSM(0,0,1,0); 

/* Read PHY */ 

data = 0x41; /* PHY Regester offset into EPAR Bit 4..0, PHY address into EPAR Bit 7..6 */ 

dm9000a_iow(0xC, data); /* write to dm9000a */ 

usleep(5); /* 5uS max delay */ 

data = 0x0c; /* Write 0x0c into EPCR reg 0x08 to start PHY + READ operation */ 

dm9000a_iow(0xb, data); 

usleep(5); 

data = 0x08; /* Write 0x08 into EPCR reg 0x0b to clear READ command */ 

dm9000a_iow(0xb, data); 

usleep(5); 

status = dm9000a_ior(0xd); /* Read PHY low byte from EPDRL reg */ 

printf("\n%x\n", status); 

if(!(status & 0x4)) //Link Down set front panel LED red 

Enables = IORD_ALTERA_AVALON_PIO_DATA(PIO_ENABLES_BASE); 

/* Set BiColor LED red */ 

IOWR_ALTERA_AVALON_PIO_DATA(PIO_ENABLES_BASE, LINK_DOWN); 

disconnect_count++; 

if(disconnect_count > MAX_CABLE_DOWN ) 

printf("\nPHY ERROR: Ethernet Cable Disconnected!\n"); 

else // Link Good set front panel LED Green 

Enables = IORD_ALTERA_AVALON_PIO_DATA(PIO_ENABLES_BASE); 

IOWR_ALTERA_AVALON_PIO_DATA(PIO_ENABLES_BASE, LINK_UP); 

 

}
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

hi 

I can't download the file:"DE2_SimpleSocketServer.zip". 

Media fire link is damaged too. 

May you send me an email that include the file. 

My email is :saeed.n.m@gmail.com  

Thank you !!
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

I can't download the file:"DE2_SimpleSocketServer.zip". 

May you send me an email that include the file. 

My email is :rromerson@gmail.com  

Thank you !!
0 Kudos
Altera_Forum
Honored Contributor II
437 Views

I have the same problem ..... 

I can't download neither the file:"DE2_SimpleSocketServer.zip" or VOIP.tgz 

Could someone send me an email that include the file(s). 

My email is : piripispulo AT cekanet.com 

Please, replace AT with @. 

Thank you !!
0 Kudos
Altera_Forum
Honored Contributor II
438 Views

execuse me,would you please give me your successful project,I am a new comer,thankyou very much,my email:892312492@qq.com,892312492ygl@163.com

0 Kudos
Altera_Forum
Honored Contributor II
428 Views

 

--- Quote Start ---  

Enjoy................................... 

 

http://www.mediafire.com/?75wlgv51dyhqq56 

 

this is the original zip file shared by tnnDesign 

 

regards 

hasi86 

--- Quote End ---  

 

 

link is not available . kindly upload again
0 Kudos
Altera_Forum
Honored Contributor II
428 Views

Hello tnndesign, 

does your project support tcp/ip protocols? if not is there any way to make DE2 (cyclone II - c35) support tcp/ip?  

regards,
0 Kudos
Altera_Forum
Honored Contributor II
428 Views

Hi all, 

Is it possible to share the zip file again please? 

 

Thanks,
0 Kudos
Altera_Forum
Honored Contributor II
428 Views

 

--- Quote Start ---  

Hi all, 

Is it possible to share the zip file again please? 

 

Thanks, 

--- Quote End ---  

 

 

hi @sypend  

this is the file u request. inform me if there is problem with download 

 

http://www.mediafire.com/?o9k58t93qbd5oai 

regards
0 Kudos
Reply