From 7a847bab1e448c428ecd5d1ad1b7c66b70009587 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Fri, 7 Apr 2023 17:34:15 +0200 Subject: [PATCH] samd/main: Fix sercom deinit ordering in soft-reset. If sockets were open when calling soft reset, gc_sweep_all() would try to close them. In case of e.g. the NINA WiFi handler, connected through SPI, spi_transfer() would be called for command exchange with the NINA module. But at that time SerCom was already disabled. Moving sercom_deinit_all() behind gc_sweep_all() solves this issue. Signed-off-by: robert-hh --- ports/samd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/samd/main.c b/ports/samd/main.c index bc0e45ee64..1e30df13d4 100644 --- a/ports/samd/main.c +++ b/ports/samd/main.c @@ -84,9 +84,9 @@ void samd_main(void) { adc_deinit_all(); pin_irq_deinit_all(); pwm_deinit_all(); - sercom_deinit_all(); soft_timer_deinit(); gc_sweep_all(); + sercom_deinit_all(); mp_deinit(); } }