diff --git a/Inc/dw1000.h b/Inc/dw1000.h
index 4e395b96610db4a362d98b5204762e4289a286dd..4e1a4d59cef92a54224f44fdf0e751a098b7c87d 100644
--- a/Inc/dw1000.h
+++ b/Inc/dw1000.h
@@ -2,6 +2,7 @@
 #define __dw1000_H
 #include "FreeRTOS.h"
 #include <stdint.h>
+#include "cmsis_os.h"
 //DECA:DW1000 SLEEP and WAKEUP configuration parameters
 #define DWT_LOADLDO              0x1000                                          // ONW_LLDO - on wakeup load the LDO tune value
 #define DWT_LOADUCODE    0x0800                      // ONW_LLDE - on wakeup load the LDE ucode
diff --git a/Src/dw1000_hal.c b/Src/dw1000_hal.c
index 398ae9b6ad9ee495105465b20648d6bde5625727..1d81a8d74e3a538435cd7076a31b504972f3b35f 100644
--- a/Src/dw1000_hal.c
+++ b/Src/dw1000_hal.c
@@ -75,7 +75,7 @@ int dw1000Hal_readSubRegisterFromIsr(uint8_t regID, uint16_t offset,
 	int ret;
 	//portENTER_CRITICAL();
 	if ((spiSema != NULL)
-			&& (xSemaphoreTake(spiSema, ( TickType_t ) DW1000HAL_SPI_TIMEOUT)
+			&& (xSemaphoreTakeFromISR(spiSema, ( TickType_t ) DW1000HAL_SPI_TIMEOUT)
 					== pdTRUE)) {
 		if (len <= 127) {
 			dummy[0] = regID & 0x3f; //set the first two bit 0 (read access, no subregister)
@@ -97,7 +97,7 @@ int dw1000Hal_readSubRegisterFromIsr(uint8_t regID, uint16_t offset,
 		dw1000Hal_chipDeselect();
 		while (hspi->State != HAL_SPI_STATE_READY)
 			;
-		xSemaphoreGive(spiSema);
+		xSemaphoreGiveFromISR(spiSema, pdFALSE);
 	} else {
 		ret = HAL_LOCKED;
 	}