Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12455 Discussions

altera_avalon_tse.h and _TIMEOUT_THRESHOLD #defines

Altera_Forum
Honored Contributor II
971 Views

Hello, 

 

We are using NIOS2 with uCOS2 and the NicheStack and need to be able to 

run our embedded app even if we don't have a network connection. 

We noticed with the below default altera_avalon_tse.h settings, 

the processor hangs up and seems to hold interrupts causing the app 

to have issues loading. 

# define ALTERA_AUTONEG_TIMEOUT_THRESHOLD 250000# define ALTERA_CHECKLINK_TIMEOUT_THRESHOLD 1000000# define ALTERA_NOMDIO_TIMEOUT_THRESHOLD 1000000# define ALTERA_DISGIGA_TIMEOUT_THRESHOLD 5000000 

 

I tried these settings and it allowed to progress without a network connection fine, 

but this seems like overkill.  

 

Is there another Altera# define or code block that would allow obtaining the IP in  

a lower priority task/thread ? 

 

# define ALTERA_AUTONEG_TIMEOUT_THRESHOLD 2500# define ALTERA_CHECKLINK_TIMEOUT_THRESHOLD 1000# define ALTERA_NOMDIO_TIMEOUT_THRESHOLD 10000# define ALTERA_DISGIGA_TIMEOUT_THRESHOLD 50000
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
173 Views

Is the below change an appropriate fix ? 

 

I found that I needed to change the below code in  

BSP\drivers\src\altera_avalon_tse.c 

in the alt_tse_phy_restart_an() function. 

 

Adding a 1 second sleep in this while loop allows background tasks (we use uCOS2) to have some cpu cycles. A timeout of 10 seconds would be sufficient. 

The iNiche network initialization (again initialization only) is also on a task as well.  

 

while(alt_tse_phy_rd_mdio_reg(pphy, TSE_PHY_MDIO_STATUS, TSE_PHY_MDIO_STATUS_AN_COMPLETE, 1) == 0 ) 

usleep(1000000); /* sleep for 1 second */ 

 

/* change to time out after 10 seconds */ 

if(timeout++ > 10 /*timeout_threshold*/) { 

tse_dprintf(4, "WARNING : PHY[%d.%d] - Auto-Negotiation FAILED\n", mac_group_index, mac_info_index); 

 

/* Restore previous MDIO address */ 

alt_tse_phy_wr_mdio_addr(pphy, mdioadd_prev); 

 

return TSE_PHY_AN_NOT_COMPLETE; 

}
Reply