Skip to content

Commit

Permalink
Fix multicast filtering on STM32
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Jan 26, 2025
1 parent de95a07 commit 853cee6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE,
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0U,
.HashTableLow = 0x0U,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE,
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0U,
.HashTableLow = 0x0U,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE,
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0U,
.HashTableLow = 0x0U,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE,
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0U,
.HashTableLow = 0x0U,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void _eth_config_mac(ETH_HandleTypeDef *heth)
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE,
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0,
.HashTableLow = 0x0,
Expand Down
11 changes: 4 additions & 7 deletions connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ bool STM32_EMAC::low_level_init_successful()
// Set MAC address
writeMACAddress(MACAddr, &EthHandle.Instance->MACA0HR, &EthHandle.Instance->MACA0LR);

// Enable multicast hash and perfect filter
EthHandle.Instance->MACFFR = ETH_MACFFR_HM | ETH_MACFFR_HPF;

uint32_t TempRegisterValue;
if (HAL_ETH_ReadPHYRegister(&EthHandle, 2, &TempRegisterValue) != HAL_OK) {
tr_error("HAL_ETH_ReadPHYRegister 2 issue");
Expand Down Expand Up @@ -1076,13 +1073,13 @@ void STM32_EMAC::populateMcastFilterRegs() {

#if defined(ETH_IP_VERSION_V2)
uint32_t volatile * hashRegs[] = {
&EthHandle.Instance->MACHT1R,
&EthHandle.Instance->MACHT0R
&EthHandle.Instance->MACHT0R,
&EthHandle.Instance->MACHT1R
};
#else
uint32_t volatile * hashRegs[] = {
&EthHandle.Instance->MACHTHR,
&EthHandle.Instance->MACHTLR
&EthHandle.Instance->MACHTLR,
&EthHandle.Instance->MACHTHR
};
#endif

Expand Down

0 comments on commit 853cee6

Please # to comment.