heinbali01 wrote on Saturday, February 21, 2015:
Salut Pascal,
Thank you for the PCAP. Could it be that your STM32 does not receive any packets at all? Is this firmware able to respond to pings? If not, try without DHCP first :
`#define ipconfigUSE_DHCP 0`
If it can not receive data, you might want to check the GPIO settings of the pins involved, especially for the RX path. Remember that various pins can perform the same function, depending on the hardware design.
I just made that mistake, I trusted on the library to set all GPIO’s properly. They were set very properly, but not for my board
There are about 13 pins that need to get the peripheral ETH function 0x0b and maybe some pin that provide a 25MHZ clock for the PHY.
In the function ETH_MACAddressConfig(), I changed one line and I also made the function public:
-static void ETH_MACAddressConfig(ETH_HandleTypeDef *heth,
- uint32_t MacAddr, uint8_t *Addr)
+void ETH_MACAddressConfig(ETH_HandleTypeDef *heth,
+ uint32_t MacAddr, uint8_t *Addr)
{
uint32_t tmpreg;
/* Check the parameters */
assert_param( IS_ETH_MAC_ADDRESS0123( MacAddr ) );
/* Calculate the selected MAC address high register */
- tmpreg = ( ( uint32_t )Addr[ 5 ] << 8) | (uint32_t)Addr[ 4 ];
+ tmpreg = 0x80000000ul | ( ( uint32_t )Addr[ 5 ] << 8) | (uint32_t)Addr[ 4 ];
/* Load the selected MAC address high register */
( * ( __IO uint32_t * ) ( ( uint32_t ) ( ETH_MAC_ADDR_HBASE + MacAddr ) ) ) = tmpreg;
It will set the MO bit (nr 31) which should always be a ‘1’.
In the debugger I saw that a particular MAC address did not receive any messages. After setting bit 31, it did receive messages.
Correction: for ETH_MACA1HR (2HR and 3HR), it is called:
`Bit 31 AE: Address enable`
Note that if you want to use LLMNR, you have to activate the LLMNR multicast address:
#if( ipconfigUSE_LLMNR == 1 )
static const uint8_t llmnr_mac_address[] =
{ 0x01, 0x00, 0x5E, 0x00, 0x00, 0xFC };
/* Program the LLMNR address at index 1.
Index 0 is occupied by the main MAC address. */
ETH_MACAddressConfig( &heth, ETH_MAC_ADDRESS1,
( unsigned char *)llmnr_mac_address
#endif /* ipconfigUSE_LLMNR */
);
and provide an LMNNR callback function:
BaseType_t xApplicationDNSQueryHook( const char *pcName )
{
return strcasecmp( pcName, "STM32F407" ) == 0 || strcasecmp( pcName, "my_device" ) == 0;
}
LLMNR allows you to give your devices logical names, like ‘STM32F407’ or 'my_device", any name without a dot.
This name will be looked-up by ping, ftp clients and ALL browsers.
E.g. I ping my ST-board with this command:
ping my_device
Pinging 192.168.2.111 with 32 bytes of data:
Reply from 192.168.2.111: bytes=32 time=1ms TTL=64
Or surf the the same device on http://my_device/index.html
Regards,
Hein