UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer pavankvvd
Observer
4,620 Views
Registered: ‎06-16-2010

Configuring MAC address in lwip v3.0

Hi

My problem is how to assign mac address to my board

Here is what i m using...

I am using Virtex 4 ML403 with "XPS_ethernetlite" HW version 2.00bperipheral

Ethernet_MAC instance and emaclite driver.

I m using Lwip v3.0 with Xilkernel v4.0 in EDK 10.1 SP3.

They are no documents pertaining to lwip 3.0 and emaclite.

I have gone through lwipv2.0 document but it did not help me in

configuring the mac address.

 

Here are the statements how i m trying to assign macaddress.

getMacAddr(macaddr);
    XEmacLite_SetMacAddress(0, (u8_t *)macaddr);

 

macaddr contains the macaddress.

 

My code runs well upto here and stops after this line and doesn't do anything.

One more important thing whenever i connect my board to the LAN via ethernet cable

the TX LED doesn't blink. Only the RX DUP and 100 blink. Is this a problem???

 

Please correct me if i am wrong.

 

Any help is appreciated

thanks in advance

I m attaching the MHS file

and

Here is the MSS file..

 


 PARAMETER VERSION = 2.2.0


BEGIN OS
 PARAMETER OS_NAME = xilkernel
 PARAMETER OS_VER = 4.00.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER stdin = RS232_Uart
 PARAMETER stdout = RS232_Uart
 PARAMETER sysintc_spec = xps_intc_0
 PARAMETER systmr_dev = xps_timer_1
 PARAMETER config_time = true
 PARAMETER max_tmrs = 20
 PARAMETER enhanced_features = true
 PARAMETER config_yield = true
 PARAMETER config_sema = true
 PARAMETER pthread_stack_size = 8192
 PARAMETER config_pthread_mutex = true
 PARAMETER max_pthread_mutex = 30
 PARAMETER max_pthread_mutex_waitq = 30
 PARAMETER static_pthread_table = ((ClientThread,1))
END


BEGIN PROCESSOR
 PARAMETER DRIVER_NAME = cpu
 PARAMETER DRIVER_VER = 1.11.b
 PARAMETER HW_INSTANCE = microblaze_0
 PARAMETER COMPILER = mb-gcc
 PARAMETER ARCHIVER = mb-ar
 PARAMETER extra_compiler_flags = -g -lxilkernel
END


BEGIN DRIVER
 PARAMETER DRIVER_NAME = bram
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = dlmb_cntlr
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = bram
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = ilmb_cntlr
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = generic
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = lmb_bram
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = uartlite
 PARAMETER DRIVER_VER = 1.13.a
 PARAMETER HW_INSTANCE = RS232_Uart
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = gpio
 PARAMETER DRIVER_VER = 2.12.a
 PARAMETER HW_INSTANCE = LEDs_4Bit
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = mpmc
 PARAMETER DRIVER_VER = 2.00.a
 PARAMETER HW_INSTANCE = DDR_SDRAM
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = emaclite
 PARAMETER DRIVER_VER = 1.13.a
 PARAMETER HW_INSTANCE = Ethernet_MAC
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = emc
 PARAMETER DRIVER_VER = 2.00.a
 PARAMETER HW_INSTANCE = FLASH
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = tmrctr
 PARAMETER DRIVER_VER = 1.10.b
 PARAMETER HW_INSTANCE = xps_timer_1
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = generic
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = FLASH_util_bus_split_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = generic
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = clock_generator_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = uartlite
 PARAMETER DRIVER_VER = 1.13.a
 PARAMETER HW_INSTANCE = debug_module
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = generic
 PARAMETER DRIVER_VER = 1.00.a
 PARAMETER HW_INSTANCE = proc_sys_reset_0
END

BEGIN DRIVER
 PARAMETER DRIVER_NAME = intc
 PARAMETER DRIVER_VER = 1.11.a
 PARAMETER HW_INSTANCE = xps_intc_0
END


BEGIN LIBRARY
 PARAMETER LIBRARY_NAME = lwip
 PARAMETER LIBRARY_VER = 3.00.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER api_mode = SOCKET_API
 PARAMETER lwip_dhcp = true
END

BEGIN LIBRARY
 PARAMETER LIBRARY_NAME = xilmfs
 PARAMETER LIBRARY_VER = 1.00.a
 PARAMETER PROC_INSTANCE = microblaze_0
END

0 Kudos
3 Replies
Visitor mbodnar420
Visitor
4,603 Views
Registered: ‎05-01-2009

Re: Configuring MAC address in lwip v3.0

It looks like XEmacLite_SetMacAddress requires a pointer to an XEmacLite object (C struct).  You need to declare that somewhere, then probably initialize it (so the software object knows the physical address).  "0x0" is definitely not a valid pointer to an XEmacLite object.  And since there's very little C run-time support, your program just hangs rather than giving you a meaningful idea of why.

 

One thing to keep in mind is that lwIP has functions for abstracting the specific emac type from the user (see the lwIP "netif" struct), which means you don't have to call the XEmacLite functions directly (unless you want that level of interaction).  I recommend reading the driver source for the peripherals directly (copied into the SDK workspace's libsrc dir), as they often contain comments & and other useful information regarding usage.

 

HTH,

 

M

0 Kudos
Moderator
Moderator
4,574 Views
Registered: ‎09-12-2007

Re: Configuring MAC address in lwip v3.0

0 Kudos
Observer pavankvvd
Observer
4,536 Views
Registered: ‎06-16-2010

Emaclite and lwipv3.0 in implementing xapp433

I want to do an exact webserver like in Xapp433.

but it uses emac driver but i m using emaclite driver.

I dont even have liscence for lltemac.

 

So there are some 10 statements which needed to be changed.

So please help me with that.

 

 

XEmacLite_Config *xemacliteif_ptr = &XEmacLite_ConfigTable[0];

 

   //here i declared xemacliteif_ptr as the pointer

   // i think its only a pointer declaration and we can give anyname
   // correct me if i am wrong


    // Set up the MAC address for the ethernet MAC
     
   XEmacLite_SetMacAddress(0, (u8_t *)mac_addr);

 

   // the problem here is it doesn't accept 0 as the argument. its asking for an instance pointer.

   // but in xapp433 webserver.c it is passing it as 0.  Please throw somelight on this about which

   //argument to be passed here 
   
    // Read in and set the IP address, Subnet Mask, and Gateway
     
    IP4_ADDR(&ipaddr, 10,5,20,221) ;
    IP4_ADDR(&netmask, 255,255,255,0) ;
    IP4_ADDR(&gateway, 10,5,20,2 );                  

 

  // these 3lines are OK i think

    // Set up the lwIP network interface
    // Allocate and configure netif
      server_netif = mem_malloc(sizeof(struct netif));            
  
    if(server_netif == NULL)                                  
    {
        xil_printf("ERROR: netif_add(): Out of memory for default netif\n\r");
        return;
    }


// here the if loop is satisfied and its entering this loop. again dont know whats the reason. please help here also   

 

server_netif = netif_add(server_netif,
                                            &ipaddr,
                                            &netmask,
                                            &gateway,
                                            &XEmacLite_ConfigTable[0],
                                            XEmacLite_Initialize(0,XPAR_ETHERNET_MAC_DEVICE_ID),
                                            tcpip_input);    

 

                  // here the line tcpip_input gives the warning as follows

                 passing argument 6 of 'netif_add' makes pointer from integer without a cast
                          
    netif_set_default(server_netif);
    
    // Register the XEMAC interrupt handler with the controller and enable
    // interrupts within XMK
    
   register_int_handler(XPAR_XPS_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
                      (XInterruptHandler)XEmacLite_InterruptHandler,
                        xemacliteif_ptr->BaseAddress);            

 

//here i dont know what argument to pass just passed this argument according to xapp433 code and

  // saw an Error: instance_ptr is not a member of xemaclite_config structure so i passed baseaddress

  //which is a member of structure and its not giving any error. Please correct me here also if i am wrong.

 

Please dont point towards the Xapp1026. In that one also its the same emac and emaclite driver problem i am having.

 

Thanks in advance

0 Kudos