Skip to content

nimble/ll: Refactor transitions #1974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkasenberg
Copy link
Contributor

New Bluetooth features require fast RX-to-RX and TX-to-TX transitions and use a different TIFS than 150us.

void ble_phy_tifs_set(uint16_t tifs);
#endif
/* Set T_ifs for the next transition */
void ble_phy_tifs_set(uint16_t usecs, uint8_t anchor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer needed (?)

void
ble_phy_set_rxend_cb(ble_phy_rx_end_func rxend_cb, void *arg)
{
/* Set transmit end callback and arg */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'receive'

what is the purpose of this callback? it doesn't seem to be used anywhere

* non-zero for end of PDU */
void ble_phy_tifs_txtx_set(uint16_t usecs, uint8_t anchor);
/* Set direction of the next transition */
void ble_phy_transition_set(uint8_t trans, uint8_t anchor, uint16_t usecs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should perhaps merge trans and anchor to a single parameter

standard tifs transitions would be called as they are now, but add 2 transitions that anchor at the beginning of pdu, smth like BLE_PHY_TRANSITION_TO_TX_SUB -> sub is short of 'subevent' as this is where it will be used

@sjanc ^^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, but I'd call it subevent for clarity

}

void
ble_phy_fast_transition_enable(void)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is fast transition?

@mkasenberg mkasenberg force-pushed the transition branch 3 times, most recently from d5999ac to 7b860c6 Compare February 19, 2025 13:47
@mkasenberg mkasenberg marked this pull request as ready for review February 20, 2025 12:47
@mkasenberg
Copy link
Contributor Author

#AutoPTS run mynewt nrf52 GATT/CL/GAW/BV-01-C GATT/CL/GAD/BV-01-C GATT/CL/GAR/BV-01-C GATT/CL/GAN/BV-01-C GATT/SR/GAN/BV-01-C

@codecoup-tester
Copy link

Scheduled PR #1974 (comment), board: nrf52, estimated start time: 08:02:23, test case count: 5, estimated duration: 0:12:34

Test cases to be runGATT/CL/GAD/BV-01-C
GATT/CL/GAR/BV-01-C
GATT/CL/GAW/BV-01-C
GATT/CL/GAN/BV-01-C
GATT/SR/GAN/BV-01-C

@codecoup-tester
Copy link

AutoPTS Bot results:

Failed tests (1)GATT GATT/SR/GAN/BV-01-C INDCSV
Successful tests (4)GATT GATT/CL/GAD/BV-01-C PASS
GATT GATT/CL/GAN/BV-01-C PASS
GATT GATT/CL/GAR/BV-01-C PASS
GATT GATT/CL/GAW/BV-01-C PASS

@mkasenberg mkasenberg marked this pull request as draft February 21, 2025 07:33
NRF_TIMER0->EVENTS_COMPARE[2] = 0;
phy_fem_enable_pa();
#endif
transition = g_ble_phy_data.phy_transition;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

txend_cb will setup next transition so you need to read all parameters for current transition before that.


/* Return to default values for the next transition */
g_ble_phy_data.phy_transition = PHY_TRANS_NONE;
g_ble_phy_data.tifs_anchor = PHY_TRANS_ANCHOR_END;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you cannot reset parameters here because it will overwrite transition that was set in txend_cb.
if you want to reset to default parameters just in case code doesn't set transition, this should be done after reading parameters for current transition and before calling txend_cb.

/* Packet pointer needs to be reset. */
ble_phy_rx_xcvr_setup();
next_phy_mode = g_ble_phy_data.phy_rx_phy_mode;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done as part of transition_to_rx code


ble_phy_transition_fem(transition, start_time);

if (transition == PHY_TRANS_TO_TX) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd split this into smaller blocks, i.e.

if (transition == PHY_TRANS_TO_TX) {
  ble_transition_to_tx(...);
} else if (transition == PHY_TRANS_TO_RX) {
  ble_transition_to_rx(...);
} else {
  ble_transition_to_none(...);
}

the ble_transition_to_... functions could combine also FEM code so there's no multiple ifs for the same conditions

New Bluetooth features require fast RX-to-RX and TX-to-TX transitions
and use a different TIFS than 150us.

Co-authored-by: Andrzej Kaczmarek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants