Skip to content

Commit 9e14b6e

Browse files
maje-embrlubos
authored andcommitted
esb: Rename field in esb_radio_dynamic_pdu structure and update doc
Renamed field in esb_radio_dynamic_pdu structure and updated documentation regarding selective_auto_ack When dynamic ACK is enabled in the nRf24L01+ radio the NOACK bit is inverted, compared to how it is described in the documentation. When dynamic ACK is enabled the NOACK bit is 1 if you want an ACK, and 0 if you do not want an ACK. Ref: NCSDK-36226 Signed-off-by: Marcin Jelinski <[email protected]>
1 parent cc348c5 commit 9e14b6e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

doc/nrf/protocols/esb/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ However, repeated packets will always be ACKed by the PRX, even though they are
125125

126126
A PTX can select that individual packets that are transmitted to the PRX do not require an ACK to be sent in return from the PRX.
127127
This decision is taken by the application when uploading a packet to the TX FIFO using the :c:member:`esb_payload.noack` field of the :c:struct:`esb_payload` parameter that is passed to the :c:func:`esb_write_payload` function.
128-
When the :c:member:`selective_auto_ack` field in the :c:struct:`esb_config` configuration structure is disabled, all packets will be acknowledged, ignoring the :c:member:`esb_payload.noack` field.
128+
When the :c:member:`esb_config.selective_auto_ack` field in the :c:struct:`esb_config` configuration structure is disabled, all packets will be acknowledged, ignoring the :c:member:`esb_payload.noack` field.
129+
The :c:member:`esb_config.selective_auto_ack` field must be configured with the same value on both the PTX and PRX sides to ensure consistent behavior.
129130

130131
When the PRX receives a packet that does not require an ACK, it does not send an ACK packet to the PTX.
131132
In this case, when :c:member:`esb_payload.noack` = ``true``, packet retransmission does not occur.

subsys/esb/esb.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ struct esb_radio_dynamic_pdu {
204204
uint8_t rfu0:2;
205205
#endif /* CONFIG_ESB_MAX_PAYLOAD_LENGTH > 63 */
206206

207-
/* Disable acknowledge. */
208-
uint8_t no_ack:1;
207+
/* Acknowledge. */
208+
uint8_t ack:1;
209209

210210
/* Packet ID of the last received packet. Used to detect retransmits. */
211211
uint8_t pid:2;
@@ -1127,7 +1127,7 @@ static bool rx_fifo_push_rfbuf(uint8_t pipe, uint8_t pid)
11271127
rx_fifo.payload[rx_fifo.back]->pipe = pipe;
11281128
rx_fifo.payload[rx_fifo.back]->rssi = nrf_radio_rssi_sample_get(NRF_RADIO);
11291129
rx_fifo.payload[rx_fifo.back]->pid = pid;
1130-
rx_fifo.payload[rx_fifo.back]->noack = !rx_pdu->type.dpl_pdu.no_ack;
1130+
rx_fifo.payload[rx_fifo.back]->noack = !rx_pdu->type.dpl_pdu.ack;
11311131

11321132
if (++rx_fifo.back >= CONFIG_ESB_RX_FIFO_SIZE) {
11331133
rx_fifo.back = 0;
@@ -1229,10 +1229,10 @@ static void start_tx_transaction(void)
12291229
case ESB_PROTOCOL_ESB_DPL:
12301230
memset(&pdu->type.dpl_pdu, 0, sizeof(pdu->type.dpl_pdu));
12311231
ack = !current_payload->noack || !esb_cfg.selective_auto_ack;
1232-
12331232
pdu->type.dpl_pdu.length = current_payload->length;
12341233
pdu->type.dpl_pdu.pid = current_payload->pid;
1235-
pdu->type.dpl_pdu.no_ack = current_payload->noack ? 0x00 : 0x01;
1234+
/* nRF24L01 chip inverts ACK bit */
1235+
pdu->type.dpl_pdu.ack = !current_payload->noack;
12361236

12371237
memcpy(pdu->data, current_payload->data, current_payload->length);
12381238

@@ -1657,7 +1657,7 @@ static void prepare_ack_pdu_dpl(bool retransmit_payload, struct pipe_info *pipe_
16571657
}
16581658

16591659
tx_pdu->type.dpl_pdu.pid = rx_pdu->type.dpl_pdu.pid;
1660-
tx_pdu->type.dpl_pdu.no_ack = rx_pdu->type.dpl_pdu.no_ack;
1660+
tx_pdu->type.dpl_pdu.ack = rx_pdu->type.dpl_pdu.ack;
16611661
}
16621662

16631663
static void on_radio_disabled_rx(void)
@@ -1690,7 +1690,7 @@ static void on_radio_disabled_rx(void)
16901690
pipe_info->crc = nrf_radio_rxcrc_get(NRF_RADIO);
16911691

16921692
/* Check if an ack should be sent */
1693-
if ((esb_cfg.selective_auto_ack == false) || rx_pdu->type.dpl_pdu.no_ack) {
1693+
if ((esb_cfg.selective_auto_ack == false) || rx_pdu->type.dpl_pdu.ack) {
16941694
esb_fem_for_tx_ack();
16951695

16961696
switch (esb_cfg.protocol) {

0 commit comments

Comments
 (0)