Browse Source

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.
pull/9032/head
robert-hh 2 years ago
committed by Damien George
parent
commit
999b66d531
  1. 11
      extmod/network_wiznet5k.c

11
extmod/network_wiznet5k.c

@ -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) { STATIC mp_obj_t mpy_wiznet_read_int(mp_obj_t none_in) {
(void)none_in; (void)none_in;
wizchip_clrinterrupt(IK_SOCK_0); // Handle incoming data, unless the SPI bus is busy
setSn_IR(0, Sn_IR_RECV); if (mp_hal_pin_read(wiznet5k_obj.cs)) {
// Handle incoming data
wiznet5k_try_poll(); wiznet5k_try_poll();
}
return mp_const_none; return mp_const_none;
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mpy_wiznet_read_int_obj, mpy_wiznet_read_int); 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 #endif // MICROPY_PY_LWIP

Loading…
Cancel
Save