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

LAN91C111 Drivers, LWIP, and multicore systems

Altera_Forum
Honored Contributor II
1,248 Views

Dear all, 

 

I have a question related to multicore systems with Altera HAL, LANC91C111 components, and LWIP Standalone for Nios II. 

 

 

 

 

In particular, the question is about the ALTERA_AVALON_LAN91C111_INIT function in  

components\altera_avalon_lan91c111\HAL\inc\altera_avalon_lan91c111.h 

 

Let me describe three scenarios, the third one is the one that reports an error. 

 

 

 

FIRST SCENARIO: single CPU, NO LWIP 

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

Consider a single CPU system without LWIP installed. 

 

here is a snippet of the file: 

 

#define ALTERA_AVALON_LAN91C111_INIT(name, dev) while(0)     

 

Everything is fine (No LWIP, no driver). 

 

 

 

SECOND SCENARIO: single CPU, with Standalone LWIP installed 

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

In this case, the file become 

 

#define ALTERA_AVALON_LAN91C111_INIT(name, dev)                            if (name##_IRQ == ALT_IRQ_NOT_CONNECTED)                                  {                                                                          ALT_LINK_ERROR ("Error: Interrupt not connected for "# dev ". "                          "The ALTERA Avalon lan91c111 driver requires that an "                    "interrupt is connected. Please select an IRQ for "                      "this device in SOPC builder.");                        }                                                                        else if (name##_LAN91C111_DATA_BUS_WIDTH != 32)                          {                                                                          ALT_LINK_ERROR ("Error: Invalid configuration for "# dev ". "                            "The ALTERA Avalon lan91c111 driver currently only "                      "supports the configuration of MAC/PHY on the "                          "development board. Please select this option  "                          "in SOPC builder.");                                    }                                                                        else                                                                      {                                                                          alt_ethernet_dev_reg(dev);                                              }                                                                       \ 

 

Considering the following scenario,  

- single CPU 

- LANC91C111 connected to a 32 bit bus 

- LANC91C111 connected to the IRQ bus 

 

... then everything is fine. 

 

 

THIRD SCENARIO: multiple Nios II CPUs, with Standalone LWIP installed 

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

 

In this case, suppose a standard multicore CPU like the one that can be created using the Altera Multiprocessor Tutorial (see Figure 9 page 34 of the tutorial). 

 

In this case, the ext_ram_bus is connected to all CPUs, because the CPUs need to use the external ram and flash to access code and data. 

 

having the ext_ram bus connected to all the CPUs means also that the lanc91c111 component is connected to all the cpus (Is that wrong? the component should be attached to only one CPU???) 

 

Note that the LANC91C111 has an interrupt line FOR EACH CPU, but only one is connected, because the LANC91C111 is used only by the first CPU. 

 

Then, the behavior of the system is the following: 

- If no LWIP is installed, everything works fine; 

- If LWIP is installed, then the code I cited before will fail on the CPUs that have the LANC91C111 IRQ line not connected, and in particular they will fail on the line 

 

if (name##_IRQ == ALT_IRQ_NOT_CONNECTED) 

 

The problem can be simply reproduced creating an hello_world project related to a CPU that has the IRQ pin not connected. 

 

Does anyone every experienced this problem? 

 

Paolo
0 Kudos
0 Replies
Reply