From 9e4ba387ca7d11cafe8a4dfa2e8703fee4d27293 Mon Sep 17 00:00:00 2001 From: Georg von Zengen <vonzengen@ibr.cs.tu-bs.de> Date: Fri, 5 Jun 2015 14:36:41 +0200 Subject: [PATCH] dw1000: enter rx mode after tx ready --- Src/dw1000.c | 3 ++- Src/dw1000_hal.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Src/dw1000.c b/Src/dw1000.c index 3fe78b4..207394f 100644 --- a/Src/dw1000.c +++ b/Src/dw1000.c @@ -38,6 +38,7 @@ int dw1000_sendFrame(uint8_t *payload, uint16_t len) { // set up a complete config for the register // the bits are cleared automatically after the transmission and need to be set up for the next transmission again! uint32_t sys_ctrl = 0; + dw1000Hal_readRegister(SYS_CTRL_ID, &sys_ctrl, 4); sys_ctrl |= SYS_CTRL_TRXOFF; // Immediately cancel all RX and TX operations, bring radio to IDLE state dw1000Hal_writeRegister(SYS_CTRL_ID, &sys_ctrl, 4); sys_ctrl = 0; @@ -47,7 +48,7 @@ int dw1000_sendFrame(uint8_t *payload, uint16_t len) { // TXDLYS not set -> no delayed transmission // CANSFCS not set (only useful when starting transmission before uploading payload) // TRXOFF not set (this would turn off the transmitter immediately) - sys_ctrl |= SYS_CTRL_WAIT4RESP; // turn on receiver after transmission to receive a response (ACK) + //sys_ctrl |= SYS_CTRL_WAIT4RESP; // turn on receiver after transmission to receive a response (ACK) // RXENAB not set (this would enter receive mode) // RXDLYE not set (used for delayed reception) // HRBPT not set (chooses receive buffer) diff --git a/Src/dw1000_hal.c b/Src/dw1000_hal.c index 1542cdf..a7330ad 100644 --- a/Src/dw1000_hal.c +++ b/Src/dw1000_hal.c @@ -334,6 +334,10 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) if (event & SYS_STATUS_RXDFR){ // Frame sent event_clear |= SYS_STATUS_RXDFR; //clear interrupt + uint32_t sys_ctrl = 0; + dw1000Hal_readRegisterFromIsr(SYS_CTRL_ID, (uint8_t*)&sys_ctrl, SYS_CTRL_LEN); // switch to rx mode + sys_ctrl |= SYS_CTRL_RXENAB; + dw1000Hal_writeRegisterFromIsr(SYS_CTRL_ID, (uint8_t*)&sys_ctrl, SYS_CTRL_LEN); } if (event & SYS_STATUS_CLKPLL_LL){ // Frame sent -- GitLab