openthread: [nrf52] What could cause `NRF_802154_TX_ERROR_TIMESLOT_DENIED` in `nrf_802154_transmit_raw_at`?
I’m doing some experiment with CSL on nrf52840 dk. Now I get OT_ERROR_CHANNEL_ACCESS_FAILURE in otPlatRadioTxDone after using nrf_802154_transmit_raw_at to transmit a frame. I used some trick to get the detailed nrf error code. The error in nrf_802154_transmit_failed is NRF_802154_RX_ERROR_DELAYED_TIMESLOT_DENIED. What could be the possible reason for this?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 32 (32 by maintainers)
@Irving-cl I would like to make sure I understood correctly. When you use
nrf_802154_transmit_raw_atfunction, you receivenrf_802154_transmit_failederror with error code 7 that translates toNRF_802154_TX_ERROR_TIMESLOT_DENIED, notNRF_802154_RX_ERROR_DELAYED_TIMESLOT_DENIED. Am I correct?NRF_802154_TX_ERROR_TIMESLOT_DENIEDcan be raised in following conditions:nrf_802154_receive()and during such call timer IRQ fires. Critical section is already taken bynrf_802154_receive()and scheduled transmission cannot happen. Such race condition should happen very rarely, unless your code calls 802.15.4 radio driver API in a loop. You can verify if critical section is taken checkingm_nested_critical_section_counter: https://github.com/openthread/openthread/blob/f7e16fec240439f54998463f6d8ab2945edbe5b3/third_party/NordicSemiconductor/drivers/radio/nrf_802154_critical_section.c#L55 . If its value is greater than 0, critical section is taken.m_approvied_priosvariable captured when the problem occurs (you must stop execution with a debugger on the problem, because content of this variable would change in dozens of microseconds): https://github.com/openthread/openthread/blob/f7e16fec240439f54998463f6d8ab2945edbe5b3/third_party/NordicSemiconductor/drivers/radio/rsch/nrf_802154_rsch.c#L55m_approved_prios.I hope these details are good hints to move debugging process forward.
Datasheet of the crystal you use should define its startup time. You can use this value, try to add some margin and verify if it works correctly.
The side effect is increased power consumption because the crystal is powered longer than necessary.
That’s one way to go, but be aware that crystal properties vary between each particular component, it changes with temperature and time. Because of that I would recommend to add some safety margin. The cost would be a little higher power consumption, but the risk that the device would stop working correctly after some time or when the temperature changes would be lowered.
Follow up:
The reason seems to be transition from sleep to TX. I disabled the capability of
OT_RADIO_CAPS_SLEEP_TO_TXon nrf so that inSubMac::BeginTransmitso that it is enforced to do receiving before transmission, then the transmission was successful: