mimxrt/eth: Avoid a race condition for Ethernet.
That caused Ethernet to lock up at high data rates after ~200MByte data average in a row. Tested now with data bursts up to 10 GByte and overall data rates of ~8MByte/s at the Eth100 port.
This commit is contained in:
parent
04f92a2825
commit
4774501cab
@ -291,6 +291,7 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy
|
||||
|
||||
ENET_Init(ENET, &g_handle, &enet_config, &buffConfig[0], hw_addr, CLOCK_GetFreq(kCLOCK_IpgClk));
|
||||
ENET_SetCallback(&g_handle, eth_irq_handler, (void *)self);
|
||||
NVIC_SetPriority(ENET_IRQn, IRQ_PRI_PENDSV);
|
||||
ENET_EnableInterrupts(ENET, ENET_RX_INTERRUPT);
|
||||
ENET_ClearInterruptStatus(ENET, ENET_TX_INTERRUPT | ENET_RX_INTERRUPT | ENET_ERR_INTERRUPT);
|
||||
ENET_ActiveRead(ENET);
|
||||
@ -348,7 +349,7 @@ STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
|
||||
p = p->next;
|
||||
}
|
||||
status = eth_send_frame_blocking(ENET, &g_handle, tx_frame, length);
|
||||
}
|
||||
}
|
||||
return status == kStatus_Success ? ERR_OK : ERR_BUF;
|
||||
}
|
||||
|
||||
|
@ -169,9 +169,11 @@ uint32_t trng_random_u32(void);
|
||||
// For regular code that wants to prevent "background tasks" from running.
|
||||
// These background tasks (LWIP, Bluetooth) run in PENDSV context.
|
||||
// TODO: Check for the settings of the STM32 port in irq.h
|
||||
#define MICROPY_PY_PENDSV_ENTER uint32_t atomic_state = disable_irq();
|
||||
#define MICROPY_PY_PENDSV_REENTER atomic_state = disable_irq();
|
||||
#define MICROPY_PY_PENDSV_EXIT enable_irq(atomic_state);
|
||||
#define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003)
|
||||
#define IRQ_PRI_PENDSV NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 15, 0)
|
||||
#define MICROPY_PY_PENDSV_ENTER uint32_t atomic_state = raise_irq_pri(IRQ_PRI_PENDSV);
|
||||
#define MICROPY_PY_PENDSV_REENTER atomic_state = raise_irq_pri(IRQ_PRI_PENDSV);
|
||||
#define MICROPY_PY_PENDSV_EXIT restore_irq_pri(atomic_state);
|
||||
|
||||
// Use VfsLfs2's types for fileio/textio
|
||||
#define mp_type_fileio mp_type_vfs_lfs2_fileio
|
||||
|
Loading…
x
Reference in New Issue
Block a user