Skip to content
Snippets Groups Projects
Commit 1c304399 authored by Keno Garlichs's avatar Keno Garlichs
Browse files

dw1000: fixes readSubregisterFromISR function. crashed before

parent f40fcf28
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __dw1000_H #define __dw1000_H
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include <stdint.h> #include <stdint.h>
#include "cmsis_os.h"
//DECA:DW1000 SLEEP and WAKEUP configuration parameters //DECA:DW1000 SLEEP and WAKEUP configuration parameters
#define DWT_LOADLDO 0x1000 // ONW_LLDO - on wakeup load the LDO tune value #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 #define DWT_LOADUCODE 0x0800 // ONW_LLDE - on wakeup load the LDE ucode
......
...@@ -75,7 +75,7 @@ int dw1000Hal_readSubRegisterFromIsr(uint8_t regID, uint16_t offset, ...@@ -75,7 +75,7 @@ int dw1000Hal_readSubRegisterFromIsr(uint8_t regID, uint16_t offset,
int ret; int ret;
//portENTER_CRITICAL(); //portENTER_CRITICAL();
if ((spiSema != NULL) if ((spiSema != NULL)
&& (xSemaphoreTake(spiSema, ( TickType_t ) DW1000HAL_SPI_TIMEOUT) && (xSemaphoreTakeFromISR(spiSema, ( TickType_t ) DW1000HAL_SPI_TIMEOUT)
== pdTRUE)) { == pdTRUE)) {
if (len <= 127) { if (len <= 127) {
dummy[0] = regID & 0x3f; //set the first two bit 0 (read access, no subregister) 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, ...@@ -97,7 +97,7 @@ int dw1000Hal_readSubRegisterFromIsr(uint8_t regID, uint16_t offset,
dw1000Hal_chipDeselect(); dw1000Hal_chipDeselect();
while (hspi->State != HAL_SPI_STATE_READY) while (hspi->State != HAL_SPI_STATE_READY)
; ;
xSemaphoreGive(spiSema); xSemaphoreGiveFromISR(spiSema, pdFALSE);
} else { } else {
ret = HAL_LOCKED; ret = HAL_LOCKED;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment