This is an automated email from the ASF dual-hosted git repository.

wes3 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 64470d8  hw/mcu/nordic/nrf52xxx: Fix possible SPI lockup
     new 0a8b781  Merge pull request #1669 from wes3/nrf52_hal_spim_lockup_fix
64470d8 is described below

commit 64470d8abcd8778e92c2f898b0fbc270c199e20f
Author: Will San Filippo <william.sanfili...@juul.com>
AuthorDate: Thu Feb 28 22:00:25 2019 -0800

    hw/mcu/nordic/nrf52xxx: Fix possible SPI lockup
    
    When switching between the blocking and non-blocking interfaces
    it is possible to lockup the SPI in hal_spi_stop_transfer() if
    the SPI master is enabled but no transfer started as setting
    TASKS_STOP will not always generate an EVENTS_STOPPED. Calling
    hal_spi_disable() will check to see if the xfr_flag is set before
    calling hal_spi_stop_transfer().
---
 hw/mcu/nordic/nrf52xxx/src/hal_spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_spi.c 
b/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
index 4a2c5b5..a203b84 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
@@ -941,9 +941,7 @@ hal_spi_txrx(int spi_num, void *txbuf, void *rxbuf, int len)
         spim = hal_spi->nhs_spi.spim;
         enabled = spim->ENABLE;
         if (enabled == SPIM_ENABLE_ENABLE_Enabled) {
-            spim->INTENCLR = NRF_SPI_IRQ_DISABLE_ALL;
-            hal_spi_stop_transfer(spim);
-            spim->ENABLE = 0;
+            hal_spi_disable(spi_num);
             enabled = 0;
         }
 

Reply via email to