FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
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.
5878 Discussions

MAC Address on altera de2 board

Altera_Forum
Honored Contributor I
881 Views

Helo, 

 

i am using the altera de2 board and sending a packet via DM9000A ethernet controler .  

i need the MAC address of the board , how knows in Which sector can i find it in the Flash memory. 

 

thanks
0 Kudos
4 Replies
Altera_Forum
Honored Contributor I
109 Views

Hope this can help you (it is a portion of the attached zip file): 

 

/* * get_board_mac_addr * * Read the MAC address in a board specific way * */ error_t get_board_mac_addr(unsigned char mac_addr) { error_t error = 0; alt_u32 signature; alt_u32 mac_addr_ptr = EXT_FLASH_BASE + ETHERNET_OPTION_BITS; /* This last_flash_sector region of flash is examined to see if * valid network settings are present, indicated by a signature of 0x00005afe at * the first address of the last flash sector. This hex value is chosen as the * signature since it looks like the english word "SAFE", meaning that it is * safe to use these network address values. */ /* Get the flash sector with the MAC address. */ signature = IORD_32DIRECT(mac_addr_ptr, 0); if (signature != 0x00005afe) { error = generate_and_store_mac_addr(); } if (!error) { mac_addr = IORD_8DIRECT(mac_addr_ptr, 4); mac_addr = IORD_8DIRECT(mac_addr_ptr, 5); mac_addr = IORD_8DIRECT(mac_addr_ptr, 6); mac_addr = IORD_8DIRECT(mac_addr_ptr, 7); mac_addr = IORD_8DIRECT(mac_addr_ptr, 8); mac_addr = IORD_8DIRECT(mac_addr_ptr, 9); printf("Your Ethernet MAC address is %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr, mac_addr, mac_addr, mac_addr, mac_addr, mac_addr); } return error; }
Altera_Forum
Honored Contributor I
109 Views

Thenks for your help, 

 

i have another Question, so the address of the MAC is the first address of the last flash sector in the de2 board ( 0x00005AFE). 

 

so How can i know in this way the IP? 

 

tnx
Altera_Forum
Honored Contributor I
109 Views

I think the first address of the last flash sector is only a signature, the MAC address is found where mac_addr_ptr is pointing. 

 

The IP address is defined in simple_socket_server.h 

 

/* * The IP, gateway, and subnet mask address below are used as a last resort * if no network settings can be found, and DHCP (if enabled) fails. You can * edit these as a quick-and-dirty way of changing network settings if desired. * * Default IP addresses are set to all zeros so that DHCP server packets will * penetrate secure routers. If DHCP will not be used, select valid static * IP addresses here, for example: * IP: 192.168.1.234 * Gateway: 192.168.1.1 * Subnet Mask: 255.255.255.0 */# define IPADDR0 192# define IPADDR1 168# define IPADDR2 1# define IPADDR3 234
Altera_Forum
Honored Contributor I
109 Views

thanks, it's really helpful

Reply