summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2015-08-04 23:36:01 -0700
committerDamien George <damien.p.george@gmail.com>2015-08-05 23:42:05 +0100
commit8a1a5c236d1fc07596a1f23f73e26f24c0e5b540 (patch)
tree457a726e6e1535b64f092158acd44e8e90cf04e0
parent5e11d2b349bffe92c539649799b27c946c2ff17b (diff)
downloadmicropython-8a1a5c236d1fc07596a1f23f73e26f24c0e5b540.tar.gz
micropython-8a1a5c236d1fc07596a1f23f73e26f24c0e5b540.zip
stmhal: Fix hardfault when configured as a SPI slave
-rw-r--r--stmhal/spi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stmhal/spi.c b/stmhal/spi.c
index 311f176b31..b1aacfd0b7 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.c
@@ -546,7 +546,9 @@ STATIC mp_obj_t pyb_spi_recv(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
if (status == HAL_OK) {
status = spi_wait_dma_finished(self->spi, args[1].u_int);
}
- dma_deinit(&tx_dma);
+ if (self->spi->hdmatx != NULL) {
+ dma_deinit(&tx_dma);
+ }
dma_deinit(&rx_dma);
}