From b7c4a81702cd48bbb77617eab0817c996325c6db Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sun, 5 Nov 2017 15:05:31 +0100 Subject: [PATCH] drivers/mrf24j40: fix radio ack request enabling --- drivers/include/mrf24j40.h | 1 + drivers/mrf24j40/mrf24j40.c | 2 +- drivers/mrf24j40/mrf24j40_netdev.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/include/mrf24j40.h b/drivers/include/mrf24j40.h index cb7fe79e15..8cf6a59ff2 100644 --- a/drivers/include/mrf24j40.h +++ b/drivers/include/mrf24j40.h @@ -137,6 +137,7 @@ typedef struct { uint8_t idle_state; /**< state to return to after sending */ uint8_t tx_frame_len; /**< length of the current TX frame */ uint8_t header_len; /**< length of the header */ + uint8_t fcf_low; /**< Low 8 FCF bits of the current TX frame. */ uint8_t pending; /**< Flags for pending tasks */ uint8_t irq_flag; /**< Flags for IRQs */ uint8_t tx_retries; /**< Number of retries needed for last transmission */ diff --git a/drivers/mrf24j40/mrf24j40.c b/drivers/mrf24j40/mrf24j40.c index b700f8a0bf..0be7a5033c 100644 --- a/drivers/mrf24j40/mrf24j40.c +++ b/drivers/mrf24j40/mrf24j40.c @@ -156,7 +156,7 @@ void mrf24j40_tx_exec(mrf24j40_t *dev) */ mrf24j40_reg_write_long(dev, MRF24J40_TX_NORMAL_FIFO, dev->header_len); - if (dev->netdev.flags & NETDEV_IEEE802154_ACK_REQ) { + if (dev->fcf_low & IEEE802154_FCF_ACK_REQ) { mrf24j40_reg_write_short(dev, MRF24J40_REG_TXNCON, MRF24J40_TXNCON_TXNACKREQ | MRF24J40_TXNCON_TXNTRIG); } else { diff --git a/drivers/mrf24j40/mrf24j40_netdev.c b/drivers/mrf24j40/mrf24j40_netdev.c index 262ad61f4c..c0c74a9bb2 100644 --- a/drivers/mrf24j40/mrf24j40_netdev.c +++ b/drivers/mrf24j40/mrf24j40_netdev.c @@ -106,6 +106,8 @@ static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) len = mrf24j40_tx_load(dev, ptr->iov_base, ptr->iov_len, len); if (i == 0) { dev->header_len = len; + /* Grab the FCF bits from the frame header */ + dev->fcf_low = *(uint8_t*)(ptr->iov_base); } }