From a357a7b1f05e25c5991188699a789b6e2aa8bb2e Mon Sep 17 00:00:00 2001 From: Mike Walters Date: Sat, 5 Jan 2019 00:49:33 +0000 Subject: [PATCH] Fix hang in w25q80bv_write_enable This line is meant to wait for the WEL bit to be set, to signify that the WRITE_ENABLE command has finished. The previous code didn't do any masking, so would hang if any other status bits were set. --- firmware/common/w25q80bv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/common/w25q80bv.c b/firmware/common/w25q80bv.c index 5397354c..bc19e2f6 100644 --- a/firmware/common/w25q80bv.c +++ b/firmware/common/w25q80bv.c @@ -113,7 +113,7 @@ void w25q80bv_write_enable(w25q80bv_driver_t* const drv) uint8_t data[] = { W25Q80BV_WRITE_ENABLE }; spi_bus_transfer(drv->bus, data, ARRAY_SIZE(data)); - while (w25q80bv_get_status(drv) ^ W25Q80BV_STATUS_WEL); + while (!(w25q80bv_get_status(drv) & W25Q80BV_STATUS_WEL)); } void w25q80bv_chip_erase(w25q80bv_driver_t* const drv)