@@ -83,24 +83,16 @@ LOG_MODULE_REGISTER(esb, CONFIG_ESB_LOG_LEVEL);
8383/* NRF5340 Radio high voltage gain. */
8484#define NRF5340_HIGH_VOLTAGE_GAIN 3
8585
86- /* Fast switching is available for the nRF54H20 SoC.
87- * The nRF54H20 is a non-RSSISTOP device.
88- */
8986#if defined(RADIO_SHORTS_DISABLED_RSSISTOP_Msk )
90- #define RADIO_SHORTS_COMMON \
91- (NRF_RADIO_SHORT_READY_START_MASK | ESB_SHORT_DISABLE_MASK | \
92- NRF_RADIO_SHORT_ADDRESS_RSSISTART_MASK | NRF_RADIO_SHORT_DISABLED_RSSISTOP_MASK)
87+ #define RADIO_RSSI_SHORTS \
88+ (NRF_RADIO_SHORT_ADDRESS_RSSISTART_MASK | NRF_RADIO_SHORT_DISABLED_RSSISTOP_MASK)
9389#else
9490/* Devices without RSSISTOP task will stop RSSI measurement after specific period. */
95- #define RADIO_SHORTS_FAST_SWITCHING_NO_RSSISTOP (NRF_RADIO_SHORT_ADDRESS_RSSISTART_MASK)
96- #define RADIO_SHORTS_NO_FAST_SWITCHING_NO_RSSISTOP \
97- (NRF_RADIO_SHORT_READY_START_MASK | ESB_SHORT_DISABLE_MASK | \
98- NRF_RADIO_SHORT_ADDRESS_RSSISTART_MASK)
91+ #define RADIO_RSSI_SHORTS (NRF_RADIO_SHORT_ADDRESS_RSSISTART_MASK)
92+ #endif /* !defined(RADIO_SHORTS_DISABLED_RSSISTOP_Msk) */
9993
100- #define RADIO_SHORTS_COMMON \
101- (IS_ENABLED(CONFIG_ESB_FAST_SWITCHING) ? RADIO_SHORTS_FAST_SWITCHING_NO_RSSISTOP : \
102- RADIO_SHORTS_NO_FAST_SWITCHING_NO_RSSISTOP)
103- #endif /* !defined(RADIO_SHORTS_DISABLED_RSSISTOP_Msk) */
94+ #define RADIO_NORMAL_SW_SHORTS \
95+ (RADIO_RSSI_SHORTS | NRF_RADIO_SHORT_READY_START_MASK | ESB_RADIO_SHORT_END_DISABLE)
10496
10597#if defined(CONFIG_SOC_SERIES_NRF54LX )
10698#define RADIO_SHORTS_MONITOR \
@@ -305,7 +297,6 @@ static volatile uint32_t retransmits_remaining;
305297static volatile uint32_t last_tx_attempts ;
306298static volatile uint32_t wait_for_ack_timeout_us ;
307299
308- static uint32_t radio_shorts_common = RADIO_SHORTS_COMMON ;
309300static const bool fast_switching = IS_ENABLED (CONFIG_ESB_FAST_SWITCHING );
310301
311302static const mpsl_fem_event_t rx_event = {
@@ -1288,13 +1279,13 @@ static void start_tx_transaction(void)
12881279 memcpy (pdu -> data , current_payload -> data , current_payload -> length );
12891280
12901281 if (fast_switching ) {
1291- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
1282+ nrf_radio_shorts_set (NRF_RADIO , (RADIO_RSSI_SHORTS |
12921283 NRF_RADIO_SHORT_TXREADY_START_MASK ));
12931284 nrf_radio_event_clear (NRF_RADIO , ESB_RADIO_EVENT_END );
12941285 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
12951286 } else {
1296- nrf_radio_shorts_set (NRF_RADIO ,
1297- ( radio_shorts_common | NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
1287+ nrf_radio_shorts_set (NRF_RADIO , ( RADIO_NORMAL_SW_SHORTS |
1288+ NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
12981289 }
12991290 nrf_radio_int_enable (NRF_RADIO , NRF_RADIO_INT_DISABLED_MASK );
13001291
@@ -1317,13 +1308,15 @@ static void start_tx_transaction(void)
13171308 /* Handling ack if noack is set to false or if selective auto ack is turned off */
13181309 if (ack ) {
13191310 if (fast_switching ) {
1320- nrf_radio_shorts_set (NRF_RADIO ,
1321- (radio_shorts_common | NRF_RADIO_SHORT_TXREADY_START_MASK ));
1311+ nrf_radio_shorts_set (
1312+ NRF_RADIO ,
1313+ (RADIO_RSSI_SHORTS | NRF_RADIO_SHORT_TXREADY_START_MASK ));
13221314 nrf_radio_event_clear (NRF_RADIO , ESB_RADIO_EVENT_END );
13231315 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
13241316 } else {
13251317 nrf_radio_shorts_set (NRF_RADIO ,
1326- (radio_shorts_common | NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
1318+ (RADIO_NORMAL_SW_SHORTS |
1319+ NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
13271320 }
13281321
13291322 /* Configure the retransmit counter */
@@ -1332,8 +1325,8 @@ static void start_tx_transaction(void)
13321325 esb_state = ESB_STATE_PTX_TX_ACK ;
13331326 nrf_radio_int_enable (NRF_RADIO , NRF_RADIO_INT_DISABLED_MASK );
13341327 } else if (IS_ENABLED (CONFIG_ESB_NEVER_DISABLE_TX )) {
1335- nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common &
1336- ~ ESB_SHORT_DISABLE_MASK );
1328+ nrf_radio_shorts_set (
1329+ NRF_RADIO , ( RADIO_RSSI_SHORTS | NRF_RADIO_SHORT_READY_START_MASK ) );
13371330 nrf_timer_shorts_set (esb_timer .p_reg ,
13381331 (NRF_TIMER_SHORT_COMPARE1_STOP_MASK |
13391332 NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK ));
@@ -1352,9 +1345,7 @@ static void start_tx_transaction(void)
13521345 (esb_state == ESB_STATE_PTX_TX ));
13531346 esb_state = ESB_STATE_PTX_TX ;
13541347 } else {
1355- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
1356- NRF_RADIO_SHORT_READY_START_MASK |
1357- ESB_SHORT_DISABLE_MASK ));
1348+ nrf_radio_shorts_set (NRF_RADIO , RADIO_NORMAL_SW_SHORTS );
13581349
13591350 on_radio_disabled = on_radio_disabled_tx_noack ;
13601351 esb_state = ESB_STATE_PTX_TX ;
@@ -1451,7 +1442,7 @@ static void on_radio_disabled_tx(void)
14511442 /* Remove the DISABLED -> RXEN shortcut, to make sure the radio stays
14521443 * disabled after the RX window
14531444 */
1454- nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
1445+ nrf_radio_shorts_set (NRF_RADIO , RADIO_NORMAL_SW_SHORTS );
14551446
14561447 /* Make sure the timer is started the next time the radio is ready,
14571448 * and that it will disable the radio automatically if no packet is
@@ -1493,8 +1484,6 @@ static void on_radio_disabled_tx(void)
14931484 nrf_radio_packetptr_set (NRF_RADIO , rx_payload_buffer );
14941485 if (fast_switching ) {
14951486 nrf_radio_int_disable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
1496- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common | ESB_SHORT_DISABLE_MASK |
1497- NRF_RADIO_SHORT_RXREADY_START_MASK ));
14981487 nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_START );
14991488 }
15001489 on_radio_disabled = on_radio_disabled_tx_wait_for_ack ;
@@ -1530,10 +1519,6 @@ static void on_radio_disabled_tx_wait_for_ack(void)
15301519 }
15311520 }
15321521
1533- if (fast_switching ) {
1534- nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
1535- }
1536-
15371522 if ((atomic_get (& tx_fifo .count ) == 0 ) || (esb_cfg .tx_mode == ESB_TXMODE_MANUAL )) {
15381523 esb_state = ESB_STATE_IDLE ;
15391524 errata_216_off ();
@@ -1566,13 +1551,13 @@ static void on_radio_disabled_tx_wait_for_ack(void)
15661551 nrf_radio_event_clear (NRF_RADIO , NRF_RADIO_EVENT_READY );
15671552
15681553 if (fast_switching ) {
1569- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
1554+ nrf_radio_shorts_set (NRF_RADIO , (RADIO_RSSI_SHORTS |
15701555 NRF_RADIO_SHORT_TXREADY_START_MASK ));
15711556 nrf_radio_event_clear (NRF_RADIO , ESB_RADIO_EVENT_END );
15721557 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
15731558 } else {
1574- nrf_radio_shorts_set (NRF_RADIO ,
1575- ( radio_shorts_common | NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
1559+ nrf_radio_shorts_set (NRF_RADIO , ( RADIO_NORMAL_SW_SHORTS |
1560+ NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
15761561 }
15771562
15781563 if (esb_cfg .protocol == ESB_PROTOCOL_ESB ) {
@@ -1637,12 +1622,12 @@ static void start_rx_listening(void)
16371622 on_radio_disabled = NULL ;
16381623 } else {
16391624 if (fast_switching ) {
1640- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
1641- NRF_RADIO_SHORT_READY_START_MASK ));
1625+ nrf_radio_shorts_set (NRF_RADIO , (RADIO_RSSI_SHORTS |
1626+ NRF_RADIO_SHORT_RXREADY_START_MASK ));
16421627 nrf_radio_event_clear (NRF_RADIO , ESB_RADIO_EVENT_END );
16431628 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
16441629 } else {
1645- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
1630+ nrf_radio_shorts_set (NRF_RADIO , (RADIO_NORMAL_SW_SHORTS |
16461631 NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
16471632 }
16481633
@@ -1675,7 +1660,7 @@ static void clear_events_restart_rx(void)
16751660 esb_fem_lna_reset ();
16761661 esb_ppi_for_txrx_clear (true, false);
16771662
1678- nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
1663+ nrf_radio_shorts_set (NRF_RADIO , 0 );
16791664
16801665 if (esb_cfg .protocol == ESB_PROTOCOL_ESB ) {
16811666 update_rf_payload_format_esb (0 );
@@ -1692,8 +1677,13 @@ static void clear_events_restart_rx(void)
16921677
16931678 nrf_radio_event_clear (NRF_RADIO , NRF_RADIO_EVENT_DISABLED );
16941679
1695- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common | NRF_RADIO_SHORT_READY_START_MASK |
1696- NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
1680+ if (fast_switching ) {
1681+ nrf_radio_shorts_set (NRF_RADIO ,
1682+ (RADIO_RSSI_SHORTS | NRF_RADIO_SHORT_RXREADY_START_MASK ));
1683+ } else {
1684+ nrf_radio_shorts_set (NRF_RADIO ,
1685+ (RADIO_NORMAL_SW_SHORTS | NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
1686+ }
16971687
16981688 esb_ppi_for_txrx_set (true, false);
16991689 esb_fem_for_rx_set ();
@@ -1801,12 +1791,12 @@ static void on_radio_disabled_rx(void)
18011791 nrf_radio_packetptr_set (NRF_RADIO , tx_pdu );
18021792
18031793 if (fast_switching ) {
1804- nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
1805- NRF_RADIO_SHORT_READY_START_MASK ));
1794+ nrf_radio_shorts_set (NRF_RADIO , (RADIO_RSSI_SHORTS |
1795+ NRF_RADIO_SHORT_TXREADY_START_MASK ));
18061796 nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_TXEN );
18071797 } else {
1808- nrf_radio_shorts_set (NRF_RADIO ,
1809- ( radio_shorts_common | NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
1798+ nrf_radio_shorts_set (NRF_RADIO , ( RADIO_NORMAL_SW_SHORTS |
1799+ NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
18101800 }
18111801
18121802 on_radio_disabled = on_radio_disabled_rx_send_ack ;
@@ -1837,11 +1827,11 @@ static void on_radio_disabled_rx_send_ack(void)
18371827 nrf_radio_packetptr_set (NRF_RADIO , rx_payload_buffer );
18381828 if (fast_switching ) {
18391829 nrf_radio_shorts_set (NRF_RADIO ,
1840- (radio_shorts_common | NRF_RADIO_SHORT_READY_START_MASK ));
1830+ (RADIO_RSSI_SHORTS | NRF_RADIO_SHORT_RXREADY_START_MASK ));
18411831 nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_RXEN );
18421832 } else {
1843- nrf_radio_shorts_set (NRF_RADIO , ( radio_shorts_common |
1844- NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
1833+ nrf_radio_shorts_set (NRF_RADIO ,
1834+ ( RADIO_NORMAL_SW_SHORTS | NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
18451835 }
18461836 on_radio_disabled = on_radio_disabled_rx ;
18471837
0 commit comments