Skip to content

STM32: Ethernet: Workaround for STM32_F767 revA #5411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ static sys_mutex_t tx_lock_mutex;
/* function */
static void _eth_arch_rx_task(void *arg);
static void _eth_arch_phy_task(void *arg);
#if defined (TARGET_NUCLEO_F767ZI)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As indicated in the Errata sheet, the RMII issue concerns all STM32F76xxx and TM32F77xxx,
So maybe we should increase this define test ?

static void _rmii_watchdog(void *arg);
#endif

#if LWIP_IPV4
static err_t _eth_arch_netif_output_ipv4(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr);
Expand Down Expand Up @@ -372,6 +375,35 @@ static void _eth_arch_phy_task(void *arg)
}
}

#if defined (TARGET_NUCLEO_F767ZI)
/**
* workaround for the ETH RMII bug in STM32F769 Cut1.0
*
* \param[in] netif the lwip network interface structure
*/
static void _rmii_watchdog(void *arg)
{
while(1) {
/* some good packets are received */
if (EthHandle.Instance->MMCRGUFCR > 0) {
/* RMII Init is OK - would need service to terminate or suspend
* the thread */
while(1) {
/* don't do anything anymore */
osDelay(0xFFFFFFFF);
}
} else if (EthHandle.Instance->MMCRFCECR > 10) {
/* ETH received too many packets with CRC errors, resetting RMII */
SYSCFG->PMC &= ~SYSCFG_PMC_MII_RMII_SEL;
SYSCFG->PMC |= SYSCFG_PMC_MII_RMII_SEL;
EthHandle.Instance->MMCCR |= ETH_MMCCR_CR;
} else {
osDelay(100);
}
}
}
#endif

/**
* This function is the ethernet IPv4 packet send function. It calls
* etharp_output after checking link status.
Expand Down Expand Up @@ -465,6 +497,10 @@ err_t eth_arch_enetif_init(struct netif *netif)
/* initialize the hardware */
_eth_arch_low_level_init(netif);

#if defined (TARGET_NUCLEO_F767ZI)
sys_thread_new("stm32_rmii_watchdog", _rmii_watchdog, netif, DEFAULT_THREAD_STACKSIZE, osPriorityLow);
#endif

return ERR_OK;
}

Expand Down