nrfxlib API 2.8.99
Loading...
Searching...
No Matches

◆ nrf_802154_transmit_raw_at()

bool nrf_802154_transmit_raw_at ( uint8_t * p_data,
uint64_t tx_time,
const nrf_802154_transmit_at_metadata_t * p_metadata )

#include <nrf_802154/common/include/nrf_802154.h>

Requests transmission at the specified time.

Note
This function is implemented in a zero-copy fashion. It passes the given buffer pointer to the RADIO peripheral.

This function works as a delayed version of nrf_802154_transmit_raw. It is asynchronous. It queues the delayed transmission using the Radio Scheduler module and performs it at the specified time.

If the delayed transmission is successfully performed, nrf_802154_transmitted_raw is called. If the delayed transmission cannot be performed ( nrf_802154_transmit_raw would return false) or the requested transmission timeslot is denied, nrf_802154_transmit_failed with the NRF_802154_TX_ERROR_TIMESLOT_DENIED argument is called.

Additional CCA attempts can be requested by the caller through p_metadata. In that case CCA procedure is repeated back-to-back either until it returns idle channel and the transmission starts, or until 1 + p_metadata->extra_cca_attempts CCA attempts are performed. The maximum allowed number of additional CCA attempts is 254 so that the total number of CCA attempts doesn't exceed 255.

This function is designed to transmit the first symbol of SHR at tx_time provided that the number of CCA attempts that will be performed is deterministic, which is only the case when no attempts are performed or when a single attempt is performed. Otherwise, the function assumes that tx_time points to a moment where the transmission would start if the first CCA attempt detected idle channel. If the first CCA detects busy channel and additional CCA attempts follow, the moment of transmission (first symbol of SHR) is delayed by the time taken by additional CCA attempts, which is a multiple of the duration of a single CCA attempt.

The below diagram shows an example sequence where two additional CCA attempts are performed. TT denotes turnaround time necessary to switch from CCA to Tx. tx_time points to a moment in time that occurs TT after the first CCA finishes.

*           tx_time           frame start
*              |                   |
*              |                   |
*              v                   v
* +---------+---------+---------+--+----------+-----+-------------------------+
* |   CCA   |   CCA   |   CCA   |TT|    SHR   | PHR | MAC Header and payload  |
* +---------+---------+---------+--+----------+-----+-------------------------+
*           |         |         |
*           v         v         v
*          BUSY      BUSY      IDLE
* 

If the requested transmission time is in the past, the function returns false and does not schedule transmission.

A successfully scheduled transmission can be cancelled by a call to nrf_802154_transmit_at_cancel.

Parameters
[in]p_dataPointer to the array with data to transmit. The first byte must contain the frame length (including FCS). The following bytes contain data. The CRC is computed automatically by the radio hardware. Therefore, the FCS field can contain any bytes.
[in]tx_timeAbsolute time used by the SL Timer, in microseconds (us).
[in]p_metadataPointer to metadata structure. Contains detailed properties of data to transmit. If NULL following metadata are used:
Field Value
frame_props NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT
cca true
channel As returned by nrf_802154_channel_get
tx_power As set with nrf_802154_tx_power_set
extra_cca_attempts 0
Return values
trueThe transmission procedure was scheduled.
falseThe driver could not schedule the transmission procedure.