extmod/network_wiznet5k: Schedule clearing of interrupt flags.
Avoiding conflicts between the IRQ and an active transfers. Before this change the device could lock up in heavy traffic situations. Fix found and code supplied by @omogenot.
This commit is contained in:
parent
73699a846c
commit
999b66d531
|
@ -177,11 +177,10 @@ STATIC void wiznet5k_lwip_init(wiznet5k_obj_t *self);
|
|||
|
||||
STATIC mp_obj_t mpy_wiznet_read_int(mp_obj_t none_in) {
|
||||
(void)none_in;
|
||||
wizchip_clrinterrupt(IK_SOCK_0);
|
||||
setSn_IR(0, Sn_IR_RECV);
|
||||
|
||||
// Handle incoming data
|
||||
wiznet5k_try_poll();
|
||||
// Handle incoming data, unless the SPI bus is busy
|
||||
if (mp_hal_pin_read(wiznet5k_obj.cs)) {
|
||||
wiznet5k_try_poll();
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mpy_wiznet_read_int_obj, mpy_wiznet_read_int);
|
||||
|
@ -343,6 +342,10 @@ void wiznet5k_poll(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
wizchip_clrinterrupt(IK_SOCK_0);
|
||||
#if _WIZCHIP_ == W5100S
|
||||
setSn_IR(0, Sn_IR_RECV); // W5100S driver bug: must write to the Sn_IR register to reset the IRQ signal
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // MICROPY_PY_LWIP
|
||||
|
|
Loading…
Reference in New Issue