Skip to content

Commit 5fa960c

Browse files
iabdalkaderdpgeorge
authored andcommitted
stm32/spi: Retain the state of special SPI buses on soft reboot.
Reserved and static SPI buses must remain initialized during a soft reboot as they may be used for SPI flash storage or XIP. Signed-off-by: iabdalkader <[email protected]>
1 parent a82fc71 commit 5fa960c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/stm32/spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ void spi_deinit(const spi_t *spi_obj) {
548548
void spi_deinit_all(void) {
549549
for (int i = 0; i < MP_ARRAY_SIZE(spi_obj); i++) {
550550
const spi_t *spi = &spi_obj[i];
551-
if (spi->spi != NULL) {
551+
if (spi->spi != NULL && !MICROPY_HW_SPI_IS_RESERVED(i + 1) && !MICROPY_HW_SPI_IS_STATIC(i + 1)) {
552552
spi_deinit(spi);
553553
}
554554
}

0 commit comments

Comments
 (0)