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++
12604 Discussions

Problems with Web Server(RGMII) template (it keeps restarting!)

Altera_Forum
Honored Contributor II
1,236 Views

Hi all,  

 

I am working on a custom board which has a Stratix iv FPGA and a Micrel KSZ9021 ethernet phy. 

The hardware design is the same as the triple speed ethernet example which includes TSE MAC, SGDMA, and DDR3. 

As to the Nios II code, I use the web server(RGMII) template and modify it a little bit. 

The modification I did is: 1. hard coded the MAC address(instead of reading from flash) and use static IP 

2. comment out the LED tasks and so on to simply test the ethernet connection 

3. wrote a driver for the phy and plug it in the altera_avalon_tse.c 

 

Everything compiles fine and initialization is successful as the outputs below shows: 

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

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:8f:12 

Static IP Address is 172.16.8.207 

prepped 1 interface, initializing... 

[tse_mac_init] 

INFO : TSE MAC 0 found at address 0x20012000 

INFO : PHY MICREL KSZ9021 found at PHY address 0x07 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 

micrel : Enable RGMII Timing Control 

micrel : 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=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 : 172.16.8.207 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

Created "web server" task (Prio: 4) 

 

 

Web Server starting up 

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

However, the strange thing is when I ping the IP, the host receives the first reply, misses the second one, then receives the third one and so on. 

And I find the problem behind it is that every time the program receives a ping, the main function restarts and everything gets re-initialized including the phy! 

I've tried to trace the whole program in debug mode but couldn't locate the problem. 

I have to admit I'm pretty new to micro-OS and InterNiche and need suggestions in solving this problem. 

 

Thank you in advance! 

Neal
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
491 Views

Dear Neal, 

I'm working on the DE1-SoC board, and I have to make a driver to initialize the ethernet controller, I have the same controller that you are using. I'm very grateful if you can share the driver of the micrel KSZ9021 

 

Thank you 

Gianluca 

 

 

--- Quote Start ---  

Hi all,  

 

I am working on a custom board which has a Stratix iv FPGA and a Micrel KSZ9021 ethernet phy. 

The hardware design is the same as the triple speed ethernet example which includes TSE MAC, SGDMA, and DDR3. 

As to the Nios II code, I use the web server(RGMII) template and modify it a little bit. 

The modification I did is: 1. hard coded the MAC address(instead of reading from flash) and use static IP 

2. comment out the LED tasks and so on to simply test the ethernet connection 

3. wrote a driver for the phy and plug it in the altera_avalon_tse.c 

 

Everything compiles fine and initialization is successful as the outputs below shows: 

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

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:8f:12 

Static IP Address is 172.16.8.207 

prepped 1 interface, initializing... 

[tse_mac_init] 

INFO : TSE MAC 0 found at address 0x20012000 

INFO : PHY MICREL KSZ9021 found at PHY address 0x07 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 

micrel : Enable RGMII Timing Control 

micrel : 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=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 : 172.16.8.207 

Created "Inet main" task (Prio: 2) 

Created "clock tick" task (Prio: 3) 

Created "web server" task (Prio: 4) 

 

 

Web Server starting up 

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

However, the strange thing is when I ping the IP, the host receives the first reply, misses the second one, then receives the third one and so on. 

And I find the problem behind it is that every time the program receives a ping, the main function restarts and everything gets re-initialized including the phy! 

I've tried to trace the whole program in debug mode but couldn't locate the problem. 

I have to admit I'm pretty new to micro-OS and InterNiche and need suggestions in solving this problem. 

 

Thank you in advance! 

Neal 

--- Quote End ---  

0 Kudos
Reply