Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

Tcp_ip, Sopc

Altera_Forum
Honored Contributor II
1,662 Views

hello, 

 

i have a bord STRATIX II EP2S60, i use quartus 2 v7.2.  

i would like to use nichestack tcp/ip for nios 2, I don't know if i must use the MicroC/OS for this or i can avoid it (i don't know if i have the choice or no). 

 

thanks.
0 Kudos
14 Replies
Altera_Forum
Honored Contributor II
805 Views

Yes you can run the InterNiche Stack in Superloop mode. That is how we currently use the stack for our products. Altera does not support this so there are a few minor hacks you have to make. Here is a good place to start: 

 

http://nioswiki.jot.com/wikihome/nichestack/%22super%20loop%22%20nichestack (http://nioswiki.jot.com/wikihome/nichestack/%22super%20loop%22%20nichestack

 

Note that the patch available in the link is for 7.1. There are some minor differences between 7.1 and 7.2 that will require you to make some manual changes.  

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

thanks for your reply, it's very nice of you. 

 

i will try to this with microC/OS 

maybe after, i can try it without microC/OS. 

 

thanks
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Hi jakobjones, 

 

I am using the quartus-II v7.2 and my custom board is Nios-II/stratix-II edition. I tried to configure the NicheStack for superLoop mode using the instructions posted on the nios wiki. But i got the following errors.[probably due to the version difference] 

 

[SOPC Builder]$ sh superloop_run_me.sh 

---Backing up UCOSII to UCOSII_71_OLD 

---Disabling Permissions 

---Creating virtual link from HAL to UCOSII 

---Patching source files... 

patching file UCOSII/src/component.mk 

patching file UCOSII/src/downloads/30src/h/nios2/superloop/ipport.h 

patching file UCOSII/src/downloads/30src/nios2/brdutils.c 

patching file UCOSII/src/downloads/30src/nios2/osport.h 

patching file UCOSII/src/downloads/30src/nios2/osportco.c 

patching file UCOSII/src/downloads/30src/nios2/targnios.c 

Hunk# 1 FAILED at 1. 

1 out of 1 hunk FAILED -- saving rejects to file UCOSII/src/downloads/30src/nios 

2/targnios.c.rej 

 

I thought the 'targnios.c' file is not patched, so I manually modified the 'targnios.c' file using the superloop.patch(present in the zip file). Then i built the 'socket_server_no_rtos' example in the NIOS-II IDE, the built was successful, but when i run the application on my target board, i got the following errors. 

 

InterNiche Portable TCP/IP, v3.0 

 

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

prepared 0 interfaces, initializing... 

inet startup error: unable to find any working interfaces 

dtrap - needs breakpoint 

panic: IP 

 

As you mentioned, you already used the Nichestack in superloop mode, please let me know what are the changes required to be done, in the v7.1 patch, to use with the quartus-II v7.2 

 

Thanks, 

veenu
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Veenu, 

The patch fails because the files are different between 7.1 and 7.2. I applied the patch on a 7.1 directory than manually compared the files between 7.2 and 7.1 and manually made any pertinent changes on the 7.2 branch. 

 

Now I haven't seen your particular error before. But I'm sure we can narrow it down. Obviously the error indicates that no Ethernet interfaces are being initialized.  

 

What MAC/PHY are you using? 

Does everything work using the UCOSII Simple Socket Server example? 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Hi jakobjones, 

 

Thanks for your reply. 

 

My custom board is having the SMSC's lan91c111 MAC/PHY chip. And I am able to run the UCOS-II simple socket server example without any issues. But I dont know why it is 'unable to find any working interfaces' in the superLoop mode with simple_socket_server_no_rtos application. 

 

Since I dont have version 7.1 Quartus-II softwares, please let me know what are the pertinent changes you made on the 7.2 branch. And are you able to run the 'simple_socket_server_no_rtos application' on version 7.2, after doing required changes. 

 

And please let me know, is there any documentation available for configuring the NicheStack in SuperLoop mode. 

 

 

Thanks, 

Veenu.
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Veenu, 

We use an external PHY in all our designs. In some of our designs we use the Altera TSE MAC and some we use the Avalon OpenCores MAC. Yes we can run the simple_socket_server_no_rtos example. 

 

The reason the Interniche Stack is not finding any interfaces is because there are none. The LAN91C111 software driver provided by Altera only supports UCOSII. It's found here: 

 

C:\altera\72\ip\sopc_builder_ip\altera_avalon_lan91c111\UCOSII 

 

We had the same problem with the TSE MAC driver. I have not worked with the LAN91C111 specifically so I can't give you details on the driver but here is what you need to do. You basically need to create a HAL version of the LAN91C111 driver. 

 

1 - Copy all of the driver files from the driver's UCOSII folder to the HAL folder. You'll then do all of your changes on the HAL subfolder. 

2 - You'll need to edit any component.mk files to make sure they are correct (call out HAL instead of UCOSII) 

3 - I highly suspect that the driver doesn't really make any UCOSII function calls except for OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL(). You'll want to leave all of those calls in. The superloop version of the Interniche stack redefines those calls. 

4 - You'll need to edit all of the driver source files to make sure there are no UCOSII dependencies. 

 

Again, not knowing the LAN91C111 driver intimately, I'm not sure what issues you'll run into. I don't suspect you'll have too many issues. For the TSE MAC, all we really had to do was remove the "#include" directives at the top of the driver files that had anything to do with UCOSII. 

 

I noticed that someone recently posted a modified version of the Stack in the IP section of the NIOS forum. You might look at that for tips on modifications to the actual stack. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Hi Jakob, 

 

I checked the the driver files(smsc91x.c, smsc_mem.c, smsc_phy.c), and they are not calling any UCOS-II functions. I copied the 'altera_avalon_lan91c111' directory from the superloop zip file(downloaded from nios wiki) to 72\quartus\sopc_builder\components\. And i think this it will create the HAL folder with lan91c111 driver files. 

 

I debugged to find why it is unable to locate any working interfaces, and I came to know that the error is occuring due to the function iniche_devices_init( ). As part of netmain_init, the iniche_devices_init( ) function will be called and in this function, it seems the 'alt_iniche_dev_list' is not having any 'alt_iniche_dev' nodes, that is why it is returning the 'if_count'(interfaces found) as 0. In the following function, when i printed p_dev, p_dev_list_end, both are printed as same values. So it is not entering into the while loop and if_count=0. 

 

int iniche_devices_init( int if_count) 

alt_iniche_dev *p_dev; 

alt_iniche_dev *p_dev_list_end; 

 

/* Get the InterNiche device list. */ 

p_dev = (alt_iniche_dev *) (alt_iniche_dev_list.next); 

p_dev_list_end = (alt_iniche_dev *) (&(alt_iniche_dev_list.next)); 

 

printf("p_dev=0x%x\n",p_dev); 

printf("p_dev_list_end=0x%x\n",p_dev_list_end); 

 

/* Initialize each InterNiche device. */ 

while (p_dev != p_dev_list_end) 

/* Initialize the InterNiche device data record. */ 

........ 

........ 

 

/* Perform device specific initialization. */ 

(*(p_dev->init_func))(p_dev); 

 

/* Get the interface IP address. */ 

.............. 

.............. 

 

/* Initialize next device. */ 

if_count++; 

p_dev = (alt_iniche_dev *) p_dev->llist.next; 

 

return (if_count); 

 

The 'alt_iniche_dev' node should be inserted into the 'alt_iniche_dev_list' as part of the alt_sys_init( ), which will be called before the application main( ) function. The alt_sys_init( ) calls the ALTERA_AVALON_LAN91C111_INIT( LAN91C111, lan91c111 ); macro to register the lan91c111 driver(by adding to the 'alt_iniche_dev_list'). 

So it seems the registering of lan91c111 is not happening properly. 

 

Thanks, 

-Veenu
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Hi, 

 

I try to use "SuperLoop" InterNiche because of its small memory footprint (< 1MB). 

With very intrusive modification, manipulations, patch... I have the same results :  

 

--- Quote Start ---  

prepared 0 interfaces, initializing... 

inet startup error: unable to find any working interfaces 

dtrap - needs breakpoint 

panic: IP 

--- Quote End ---  

 

 

You say  

--- Quote Start ---  

The 'alt_iniche_dev' node should be inserted into the 'alt_iniche_dev_list' as part of the alt_sys_init( ), which will be called before the application main( ) function. The alt_sys_init( ) calls the ALTERA_AVALON_LAN91C111_INIT( LAN91C111, lan91c111 ); macro to register the lan91c111 driver(by adding to the 'alt_iniche_dev_list'). 

So it seems the registering of lan91c111 is not happening properly. 

--- Quote End ---  

 

How did you do that ?
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Please provide the contents of your alt_sys_init.c file from your system library. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Hi, 

I made a "search file" in my project in NiosIDE, so I am not sure if this is the good one. 

/* alt_sys_init.c - HAL initialisation source * * Machine generated for a CPU named "cpu" as defined in: * c:\altera\72\nios2eds\examples\vhdl\niosII_cycloneII_2c35\full_featured\software\test_iniche_without_rtos_syslib\..\..\NiosII_cycloneII_2c35_full_featured_sopc.ptf * * Generated: 2008-09-18 09:45:50.456 * */ /* DO NOT MODIFY THIS FILE Changing this file will have subtle consequences which will almost certainly lead to a nonfunctioning system. If you do modify this file, be aware that your changes will be overwritten and lost when this file is generated again. DO NOT MODIFY THIS FILE */ /****************************************************************************** * * * License Agreement * * * * Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * * All rights reserved. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the "Software"), * * to deal in the Software without restriction, including without limitation * * the rights to use, copy, modify, merge, publish, distribute, sublicense, * * and/or sell copies of the Software, and to permit persons to whom the * * Software is furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * * DEALINGS IN THE SOFTWARE. * * * * This agreement shall be governed in all respects by the laws of the State * * of California and by the laws of the United States of America. * * * ******************************************************************************/ # include "system.h" # include "sys/alt_sys_init.h" # include <stddef.h> /* * device headers * */ # include "altera_avalon_timer.h" # include "altera_avalon_sysid.h" # include "altera_avalon_jtag_uart.h" # include "altera_avalon_cfi_flash.h" # include "altera_avalon_lan91c111.h" # include "altera_avalon_lcd_16207.h" # include "altera_avalon_uart.h" # include "altera_avalon_performance_counter.h" # include "altera_avalon_epcs_flash_controller.h" # include "altera_avalon_dma.h" /* * Allocate the device storage * */ ALTERA_AVALON_TIMER_INSTANCE( SYS_CLK_TIMER, sys_clk_timer ); ALTERA_AVALON_SYSID_INSTANCE( SYSID, sysid ); ALTERA_AVALON_JTAG_UART_INSTANCE( JTAG_UART, jtag_uart ); ALTERA_AVALON_TIMER_INSTANCE( HIGH_RES_TIMER, high_res_timer ); ALTERA_AVALON_CFI_FLASH_INSTANCE( EXT_FLASH, ext_flash ); ALTERA_AVALON_LAN91C111_INSTANCE( LAN91C111, lan91c111 ); ALTERA_AVALON_LCD_16207_INSTANCE( LCD_DISPLAY, lcd_display ); ALTERA_AVALON_UART_INSTANCE( UART1, uart1 ); ALTERA_AVALON_PERFORMANCE_COUNTER_INSTANCE( PERFORMANCE_COUNTER, performance_counter ); ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INSTANCE( EPCS_CONTROLLER, epcs_controller ); ALTERA_AVALON_DMA_INSTANCE( DMA, dma ); /* * Initialise the devices * */ void alt_sys_init( void ) { ALTERA_AVALON_TIMER_INIT( SYS_CLK_TIMER, sys_clk_timer ); ALTERA_AVALON_TIMER_INIT( HIGH_RES_TIMER, high_res_timer ); ALTERA_AVALON_SYSID_INIT( SYSID, sysid ); ALTERA_AVALON_JTAG_UART_INIT( JTAG_UART, jtag_uart ); ALTERA_AVALON_CFI_FLASH_INIT( EXT_FLASH, ext_flash ); ALTERA_AVALON_LAN91C111_INIT( LAN91C111, lan91c111 ); ALTERA_AVALON_LCD_16207_INIT( LCD_DISPLAY, lcd_display ); ALTERA_AVALON_UART_INIT( UART1, uart1 ); ALTERA_AVALON_PERFORMANCE_COUNTER_INIT( PERFORMANCE_COUNTER, performance_counter ); ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT( EPCS_CONTROLLER, epcs_controller ); ALTERA_AVALON_DMA_INIT( DMA, dma ); }
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

Hi, on an other project, I try to use InterNiche Stack in superloop mode and I have the same problem noticed in http://www.alteraforum.com/forum/showpost.php?p=9433&postcount=8 (post# 8) but with a DP83848C PHY. 

 

 

--- Quote Start ---  

prepped 0 interfaces, initializing... 

inet startup error: unable to find any working interfaces 

panic: IP 

dtrap - needs breakpoint 

--- Quote End ---  

 

 

Do I need to use ETH_OCM_INSTANCE() elsewhere ? 

 

i use quartus and nios ii ide 9.0sp2 , internichestack in superloop mode, ethernet opencore mac (and dp83848c phy)
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

I found the mistake : :D  

I use a crossed cable between PC <-> board and DHCP was enabled. 

simply disable dhcp and it seems to work.
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

 

--- Quote Start ---  

I found the mistake : :D  

I use a crossed cable between PC <-> board and DHCP was enabled. 

simply disable dhcp and it seems to work. 

--- Quote End ---  

 

 

Hi, how can you make it work. And what do you mean disable DHCP. I tried to make it by set the variable  

 

*use_dhcp = 0; 

 

but it didn't work for me. I am still getting the error 

 

inet startup error: unable to find any working interfaces (using cross cable PC and DE2-70 board) 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
805 Views

I am using the 13.1 version of both NIOS-II EDS and the Quartus-II Programmer. I am also seeing the same problem described in this thread. Ethernet device is not being detected. The version of BSP that I have calls "ALTERA_AVALON_SGDMA_INIT" from "alt_sys_init()" which looks like a ethernet subsystem but I still don't see any ethernet devices. 

 

Has this issue been resolved by anybody? Can somebody provide me with some pointers? 

 

Thanks, 

-Srinath
0 Kudos
Reply