2012-12-27 05:25 AM
hello forum,
I am trying to send and receive UDP packets from my F407 to PC however as shown below I need to know MAC adress of my F407struct
eth_header{
//
ether
frameuint8_t
ether_src
[6]; ...............memcpy(frame->
ether_src
, &mymac, 6); in this line I need to have a valid MAC adress in mymac my question how can I know the MAC adress of my F407 ? thank you #mac-uip #mac2012-12-27 05:49 AM
The SMT32 does not have one, you have to assign one. You're supposed to purchase a range of MAC addresses for your own use, if you don't already own some. For development you could just pick one and hope it does not conflict with other devices on the same network (be careful where you use it). See this link for MAC address ranges.
http://standards.ieee.org/develop/regauth/oui/oui.txt If you do pick one go for one from the private ranges. NOTE: This is at your own risk and I don't take any responsibility for you not purchasing a MAC address (The ones I use have been purchased).2012-12-27 06:13 AM
thank you ,
I am trying to send UDP packets to PC using uIP stack and this F407 will only comunicate with a PC in the LAN ( not internet ) If I fill the ethernet framememcpy
(frame->
ether_src
, &mymac, 6);with a dummy MAC adress like mymac ={0x00, 0x10, 0x20, 0x30, 0x40, 0x50}
does uIP ''know'' about my MAC adressing ?
or how can I tell uIP about my MAC adress ? with a dummy MAC adress like mymac ={0x00, 0x10, 0x20, 0x30, 0x40, 0x50}does uIP ''know'' about my MAC adressing ?or how can I tell uIP about my MAC adress ?
2012-12-27 11:53 AM
I don't know.
ST's library uses this function to program the controller with a MAC address for it to recognize on the wire. /* initialize MAC address in ethernet MAC */ ETH_MACAddressConfig(ETH_MAC_Address0, netif->hwaddr);2012-12-27 01:15 PM
I've done my fair share of low level Ethernet packet handling in previous lives so perhaps some more basic information is in order here. At the PHY layer packets move around on Ethernet based on a six byte unique MAC address. When an IP stack connects to an Ethernet transport it uses ARP to try and figure out where to route packets, as the ARP table contains aged pairs of MAC and IP addresses.
As Trevor mentioned most companies developing commodity Ethernet interfaces purchase a block of MAC IDs and then assign them uniquely. This allows a customer to connect his interface to any network in the world without ambiguity. But as a practical matter for what you are trying to do, you should just make one up and use it. Take the MAC ID from your PC and swap the two high order bytes. If you attach more F407s to your development network to exchange data over UDP just make sure the lower four bytes of all MAC IDs are unique (just like you'll assign IP addresses). Dan2012-12-28 12:43 AM
Normally the MAC address is defined in main.h, you can inspire from the following example based on LwIP;
Firmware LwIP TCP/IP stack demonstration for STM32F4x7 microcontrollers: http://www.st.com/internet/mcu/product/252136.jsp Application Note AN3966: http://www.st.com/internet/mcu/product/252136.jsp