Skip to content

Commit d636b32

Browse files
committed
stm32cube: stm32f4, stm32f7: Fix errata workaround
The errata for STM32F4 says successive writes to MACCR may be ignored, and recommends reading back, waiting and rewriting as a workaround. This workaround has been done correctly for writes to TE, but has mistakenly been removed after enabling RE, which means that receiving sometimes ended up not working. The errata recommends doing multiple writes, then a final wait and rewrite at the end, which seems to work correctly. Even though this is not mentioned in the F7 errata, the same fix is required there. Fixes zephyrproject-rtos/zephyr#107024. Signed-off-by: Ole Morten Haaland <omh@ixys.no>
1 parent 39130f2 commit d636b32

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_eth.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,15 +804,15 @@ HAL_StatusTypeDef HAL_ETH_Start_IT(ETH_HandleTypeDef *heth)
804804
/* Enable the MAC transmission */
805805
SET_BIT(heth->Instance->MACCR, ETH_MACCR_TE);
806806

807+
/* Enable the MAC reception */
808+
SET_BIT(heth->Instance->MACCR, ETH_MACCR_RE);
809+
807810
/* Wait until the write operation will be taken into account :
808811
at least four TX_CLK/RX_CLK clock cycles */
809812
tmpreg1 = (heth->Instance)->MACCR;
810813
HAL_Delay(ETH_REG_WRITE_DELAY);
811814
(heth->Instance)->MACCR = tmpreg1;
812815

813-
/* Enable the MAC reception */
814-
SET_BIT(heth->Instance->MACCR, ETH_MACCR_RE);
815-
816816
/* Enable ETH DMA interrupts:
817817
- Tx complete interrupt
818818
- Rx complete interrupt

stm32cube/stm32f7xx/drivers/src/stm32f7xx_hal_eth.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,15 +804,15 @@ HAL_StatusTypeDef HAL_ETH_Start_IT(ETH_HandleTypeDef *heth)
804804
/* Enable the MAC transmission */
805805
SET_BIT(heth->Instance->MACCR, ETH_MACCR_TE);
806806

807+
/* Enable the MAC reception */
808+
SET_BIT(heth->Instance->MACCR, ETH_MACCR_RE);
809+
807810
/* Wait until the write operation will be taken into account :
808811
at least four TX_CLK/RX_CLK clock cycles */
809812
tmpreg1 = (heth->Instance)->MACCR;
810813
HAL_Delay(ETH_REG_WRITE_DELAY);
811814
(heth->Instance)->MACCR = tmpreg1;
812815

813-
/* Enable the MAC reception */
814-
SET_BIT(heth->Instance->MACCR, ETH_MACCR_RE);
815-
816816
/* Enable ETH DMA interrupts:
817817
- Tx complete interrupt
818818
- Rx complete interrupt

0 commit comments

Comments
 (0)