at86rf2xx/Check at86rf2xx state before changing phy#7207
at86rf2xx/Check at86rf2xx state before changing phy#7207biboc wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
44a4e76 to
f3df570
Compare
thomaseichinger
left a comment
There was a problem hiding this comment.
@biboc Could you please elaborate on what this change is actually fixing? Is there a bug associated with this?
Also please give this PR a descriptive title.
|
Yes when trying to change channel with OpenThread, at86rf2xx_configure_phy is called. |
|
@thomaseichinger, better? |
| _set_state(dev, AT86RF2XX_STATE_TRX_OFF, state); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
I can't see how moving this block helps. at86rf2xx_configure_phy uses AT86RF2XX_STATE_TRX_OFF not AT86RF2XX_STATE_FORCE_TRX_OFF thus it shouldn't have an effect.
|
@biboc Thanks for changing the title. Could you help me understand by telling me which loop the driver gets stuck in? |
|
Related #7115
…On 19 Jun 2017 18:19, "biboc" ***@***.***> wrote:
Yes when trying to change channel with OpenThread, at86rf2xx_configure_phy
is called.
The driver saves current state, set state to AT86RF2XX_STATE_TRX_OFF,
configure PHY and re-set latest state.
Problem is that we can't change at86rf2xx state if it is in
AT86RF2XX_STATE_IN_PROGRESS state so with this PR we make sure transceiver
is in the right state before changing it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7207 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAdFRFpR2wsQ7HwVflK_zr1UBjc1R04xks5sFp-ogaJpZM4N-aKp>
.
|
|
AT86RF212B Datasheet Extract : "Do not try to initiate a further state change while the radio transceiver is in STATE_TRANSITION_IN_PROGRESS state. " During a channel setting we use : /* To prevent a possible race condition when changing to dev->state = state; if (state == AT86RF2XX_STATE_FORCE_TRX_OFF) { Blocks inversion should not have any effect. #7115 answers to the second change (inverting the two blocks in get/set file) but not to my first problem "update phy". Is it clearer @thomaseichinger ? |
|
@biboc Thanks for your explanation. I think however that #7115 actually also handles the first part of your problem because it waits for the module to be in a "reachable" state (no busy or transition state) and returns the state the hardware is in just after that. The problem is two fold, (i) trying to return to an unreachable state and (ii) a race between getting the state and then setting it. (i) is handled by waiting and only return reachable states and (ii) should be handled by storing the state the module is in just after assuring (i). With those changes we can actually remove some of the extra checks before calling Unless I am totally missing something, I'd appreciate if you could test #7115 (including DipSwitch#6) and see if that fixes your problem. |
|
Merge DipSwitch#6 inside #7115 and I'll try |
|
We've tested your branch @thomaseichinger, it works! Apart from a missing definition in a .h so I close this PR and let you merge the other PR with your changes |
at86rf2xx: Changing phy involve to save current transceiver state, set transceiver to OFF and set it back again to its previous state. This PR avoids to save transceiver state AT86RF2XX_STATE_IN_PROGRESS and wait that transceiver is in stable state