I’m trying to find out to set the MAC address and IP address.
In NetworkInterface.c function BaseType_t xNetworkInterfaceInitialise( void )
the MAC address is obtained by calling:
xETH.Init.MACAddr = ( uint8_t * ) FreeRTOS_GetMACAddress();
There is a function in FreeRTOS_IP.c
const uint8_t * FreeRTOS_GetMACAddress( void )
{
return ipLOCAL_MAC_ADDRESS;
}
That makes use of a define in FreeRTOS_IP_Private.h
#define ipLOCAL_MAC_ADDRESS ( xDefaultPartUDPPacketHeader.ucBytes )
In turn the xDefaultPartUDPPacketHeader is defined in FreeRTOS_UDP_IP.c
UDPPacketHeader_t xDefaultPartUDPPacketHeader =
{
/* .ucBytes : */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Ethernet source MAC address. */
0x08, 0x00, /* Ethernet frame type. */
ipIP_VERSION_AND_HEADER_LENGTH_BYTE, /* ucVersionHeaderLength. */
0x00, /* ucDifferentiatedServicesCode. */
0x00, 0x00, /* usLength. */
0x00, 0x00, /* usIdentification. */
0x00, 0x00, /* usFragmentOffset. */
ipconfigUDP_TIME_TO_LIVE, /* ucTimeToLive */
ipPROTOCOL_UDP, /* ucProtocol. */
0x00, 0x00, /* usHeaderChecksum. */
0x00, 0x00, 0x00, 0x00 /* Source IP address. */
}
};
Should I just replace
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Ethernet source MAC address. */
by the MAC address.
Somehow this does not seem right.
The STM32F767 seems to have a UID register that provides a Unique ID number.
Could I use this? How?
And in respect with the IP address. If I’m not using DHCP how can I define an IP address?
I see
#define ipLOCAL_IP_ADDRESS_POINTER ( ( uint32_t * ) &( xDefaultPartUDPPacketHeader.ulWords[ 20U / sizeof( uint32_t ) ] ) )
in FreeRTOS_IP_Private.h which suggests the same way…
thanks