Skip to content

Sending fails if started in event receivingFinished #14

@mateusz-banaszek

Description

@mateusz-banaszek

To reproduce the problem:

  1. Initiate receiving
  2. In event receivingFinished initiate sending (startSending())
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions