From 9d4cff48dca672bd97f2e6f51760977e61dfd66a Mon Sep 17 00:00:00 2001 From: Seth Rickard Date: Tue, 13 Oct 2020 11:37:44 -0500 Subject: [PATCH] [cc1352,cc2652] add check before claiming transmit done (#5640) Check the global state in the radio when an ack frame is found before reporting a transmit was completed. This change avoids the case where an acknowledgment frame from another transmission is mistaken for our acknowledgment frame. --- examples/platforms/cc1352/radio.c | 7 ++++++- examples/platforms/cc2652/radio.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/platforms/cc1352/radio.c b/examples/platforms/cc1352/radio.c index b8beabb39..a190cabfd 100644 --- a/examples/platforms/cc1352/radio.c +++ b/examples/platforms/cc1352/radio.c @@ -1948,10 +1948,15 @@ static void cc1352RadioProcessReceiveQueue(otInstance *aInstance) if ((receiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK) { - if (receiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET]) + if (sState == cc1352_stateTransmit && sTxCmdChainDone && + receiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET]) { + /* we found the ACK packet */ sState = cc1352_stateReceive; cc1352RadioProcessTransmitDone(aInstance, &sTransmitFrame, &receiveFrame, receiveError); + + sTransmitError = OT_ERROR_NONE; + sTxCmdChainDone = false; } } else diff --git a/examples/platforms/cc2652/radio.c b/examples/platforms/cc2652/radio.c index 345c234f0..970f13066 100644 --- a/examples/platforms/cc2652/radio.c +++ b/examples/platforms/cc2652/radio.c @@ -1929,10 +1929,15 @@ static void cc2652RadioProcessReceiveQueue(otInstance *aInstance) if ((receiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK) { - if (receiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET]) + if (sState == cc2652_stateTransmit && sTxCmdChainDone && + receiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET]) { + /* we found the ACK packet */ sState = cc2652_stateReceive; cc2652RadioProcessTransmitDone(aInstance, &sTransmitFrame, &receiveFrame, receiveError); + + sTransmitError = OT_ERROR_NONE; + sTxCmdChainDone = false; } } else