To reproduce the problem:
- Initiate receiving
- In event
receivingFinished initiate sending (startSending())
- Event
sendingFinished is signaled with status 12
RFCoreRadioPrv reports:
TXDone: status=0x2407 fsStatus=0x0000
Example log:
// startReceiving
setupIEEE
startRX
// receivingFinished
// startSending
startTX
stopRX
onLastFGCommandDone
TXDone: status=0x2407 fsStatus=0x0000
TODO: data send fail: 12
The problem can be easily reproduced by changing task sendResp() to a normal function in "CherryMoteHWTestRadioServer":
CherryMoteHWTestRadioServerPrv.nc:47
My investigation
Transmitting fails, because the hardware radio receives ABORT command, thus returns status=0x2407.
In RFCoreRadioPrv.nc:
When the radio reports successful reception, task RXDone() (RFCoreRadioPrv.nc:L1096) is executed. The task ends with:
atomic rxFrame = NULL;
atomic state = STATE_IEEE_RX_END;
call NumSuccessfulRXStat.increment(1);
signal RawFrameReceiver.receivingFinished(frame, error);
atomic {
if (state == STATE_IEEE_RX_END) {
stopRX();
tryToDoSomething();
}
}
When signalled event receivingFinished calls startSending executed is tryToDoSomething() which calls startTX(). They send receive command to the hardware radio and change fgState. However, state isn't changed.
So, when execution comes back to RXDone(), state is still STATE_IEEE_RX_END, thus stopRX() is called, which sends ABORT command to the hardware radio. This aborts pending sending.
It seems like state isn't properly handled or tryToDoSomething() and startTX() aren't prepared for situation when receivingFinished calls startSending.
@accek Can you look at it?
If you need more info, don't hesitate to write me back.
To reproduce the problem:
receivingFinishedinitiate sending (startSending())sendingFinishedis signaled with status 12RFCoreRadioPrv reports:
Example log:
The problem can be easily reproduced by changing task
sendResp()to a normal function in "CherryMoteHWTestRadioServer":CherryMoteHWTestRadioServerPrv.nc:47
My investigation
Transmitting fails, because the hardware radio receives ABORT command, thus returns status=0x2407.
In RFCoreRadioPrv.nc:
When the radio reports successful reception,
task RXDone()(RFCoreRadioPrv.nc:L1096) is executed. The task ends with:When signalled event
receivingFinishedcallsstartSendingexecuted istryToDoSomething()which callsstartTX(). They send receive command to the hardware radio and changefgState. However,stateisn't changed.So, when execution comes back to
RXDone(),stateis stillSTATE_IEEE_RX_END, thusstopRX()is called, which sends ABORT command to the hardware radio. This aborts pending sending.It seems like
stateisn't properly handled ortryToDoSomething()andstartTX()aren't prepared for situation whenreceivingFinishedcallsstartSending.@accek Can you look at it?
If you need more info, don't hesitate to write me back.