Skip to content

Commit 4875769

Browse files
author
Cruz Monrreal
authored
Merge pull request #6720 from marcuschangarm/fix-sdk-spi
Fix bug in Nordic SDK 14.2 SPI driver
2 parents 9d6d8c7 + cba7e0d commit 4875769

File tree

1 file changed

+14
-5
lines changed
  • targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_14_2/drivers_nrf/spi_master

1 file changed

+14
-5
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_14_2/drivers_nrf/spi_master/nrf_drv_spi.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ static void spi_xfer(NRF_SPI_Type * p_spi,
447447

448448
nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY);
449449

450+
/**
451+
* 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
452+
* Interrupts must be enabled before transmitting the first byte in asynchronous mode.
453+
*/
454+
if (p_cb->handler)
455+
{
456+
nrf_spi_int_enable(p_spi, NRF_SPI_INT_READY_MASK);
457+
}
458+
450459
// Start the transfer by writing some byte to the TXD register;
451460
// if TX buffer is not empty, take the first byte from this buffer,
452461
// otherwise - use over-run character.
@@ -471,11 +480,11 @@ static void spi_xfer(NRF_SPI_Type * p_spi,
471480
// and a new incoming byte was moved to the RXD register) and continue
472481
// transaction until all requested bytes are transferred.
473482
// In non-blocking mode - IRQ service routine will do this stuff.
474-
if (p_cb->handler)
475-
{
476-
nrf_spi_int_enable(p_spi, NRF_SPI_INT_READY_MASK);
477-
}
478-
else
483+
/**
484+
* 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
485+
* Interrupts must be enabled before transmitting the first byte in asynchronous mode.
486+
*/
487+
if (p_cb->handler == NULL)
479488
{
480489
do {
481490
while (!nrf_spi_event_check(p_spi, NRF_SPI_EVENT_READY)) {}

0 commit comments

Comments
 (0)