-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Bluetooth: Controller: nRF54Lx: Use NRF_GRTC for radio scheduling #74183
Bluetooth: Controller: nRF54Lx: Use NRF_GRTC for radio scheduling #74183
Conversation
57a6546
to
4cc8e1a
Compare
time_diff = (time_wrapping_point == UINT32_MAX) ? | ||
INT32_MIN : | ||
-((int64_t)ISOAL_TIME_WRAPPING_POINT_US); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time_diff
is int32_t
, so it doesn't make sense to cast to int64_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler did not like when ISOAL_TIME_WRAPPING_POINT_US
is 32-bit unsigned int, as signed values need an extra bit to represent them in 2's compliment, hence have to typecast to 64-bit, then the compiler is ok to assign it to int32_t.
@mtpr-ot or @niag-Oticon or @Tronil can comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks alright. With this timer I would expect time_wrapping_point == UINT32_MAX
to be true so the value actually assigned should be INT32_MIN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler did not like when ISOAL_TIME_WRAPPING_POINT_US is 32-bit unsigned int, as signed values need an extra bit to represent them in 2's compliment, hence have to typecast to 64-bit, then the compiler is ok to assign it to int32_t.
What is the compiler error/warning?
Depending on what parameters is provided to e.g. GCC, it would also give an error/warning if you assigned a int64_t
to a int32_t
, so I would suggest to do it properly than just replacing one compiler error/warning with a future error/warning.
One easy solution would be to simply have time_diff
as int64_t
and then if the result actually fits in a int32_t
, then we can cast the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compile error was:
/home/jack/workspace/zephyrproject/zephyr/tests/bluetooth/ctrl_isoal/src/sub_sets/isoal_test_rx.c: In function 'test_rx_unframed_test_rx_time_wrapping':
/home/jack/workspace/zephyrproject/zephyr/tests/bluetooth/ctrl_isoal/src/sub_sets/isoal_test_rx.c:928:21: warning: overflow in conversion from 'long long unsigned int' to 'int32_t' {aka 'int'} changes value from '18446744073197551647' to '-511999969' [-Woverflow]
928 | time_diff = (time_wrapping_point == UINT32_MAX ? INT32_MIN : -ISOAL_TIME_WRAPPING_POINT_US);
| ^
/home/jack/workspace/zephyrproject/zephyr/tests/bluetooth/ctrl_isoal/src/sub_sets/isoal_test_rx.c:935:21: warning: overflow in conversion from 'long long unsigned int' to 'int32_t' {aka 'int'} changes value from '18446744073197551647' to '-511999969' [-Woverflow]
935 | time_diff = (time_wrapping_point == UINT32_MAX ? INT32_MIN : -ISOAL_TIME_WRAPPING_POINT_US);
| ^
time_diff = (time_wrapping_point == UINT32_MAX) ? | ||
INT32_MIN : | ||
-((int64_t)ISOAL_TIME_WRAPPING_POINT_US); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c
Outdated
Show resolved
Hide resolved
subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c
Outdated
Show resolved
Hide resolved
samples/bluetooth/hci_uart/boards/nrf54l15pdk_nrf54l15_cpuapp_df.overlay
Show resolved
Hide resolved
aa2503b
to
f51ae20
Compare
58da23c
to
919b875
Compare
Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE Kconfig depends on. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix software tIFS switching using single timer from triggering spurious TXEN/RXEN if the first remainder is shorter than the tIFS delay calculated in the sw_switch() function. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix Extended Connection Creation when using single timer feature in the Controller. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Refactor sw_switch hal interface use and document why some PPI/DPPI channel group related subscriptions are not disabled explicitly. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Remove redundant HAL_TICKER_CNTR_CLK_FREQ_HZ define. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Add HAL_TICKER_TICKS_TO_US_64BIT define, to return microsecond value in 64-bits. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Add ticker implementation support for free running counter use. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
919b875
to
fa2f85f
Compare
nRF54Lx have updated Data Whitening register settings, add implementation to correctly set them up. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use NRF_GRTC, Global real-time counter, instead of NRF_RTC. NRF_GRTC is present in a different power domain in the SoC. Also, NRF_GRTC provide microsecond resolution timing units, in the future use of NRF_TIMER for packet timer can also be replaced. Use of NRF_RTC would keep Radio power domain ON in addition to already ON NRF_GRTC's power domain, hence switch to using NRF_GRTC on nRF54Lx SoC to have lower power consumptions. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Add support for Radio fast ramp up for nRF54Lx SoCs. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Add preliminary direction finding support building hci_uart sample for nrf54l15pdk. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Review rework GRTC support for nRF54Lx SoCs. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use nrfx interface for register access with sideeffects to facilitate bsim use. 4 part commits: 1. Add nrf_grtc interface. 2. Remove CMSIS interface use. 3. Add nrf_grtc interface, once missing bsim port available. 4. Remove CMSIS interface use, replaced by bsim port. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use nrfx interface for register access with sideeffects to facilitate bsim use. Remove CMSIS interface use, was replaced with nrf_grtc interface in previous commit. 4 part commits: 1. Add nrf_grtc interface. 2. Remove CMSIS interface use. 3. Add nrf_grtc interface, once missing bsim port available. 4. Remove CMSIS interface use, replaced by bsim port. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use nrfx interface for register access with sideeffects to facilitate bsim use. 4 part commits: 1. Add nrf_grtc interface. 2. Remove CMSIS interface use. 3. Add nrf_grtc interface, once missing bsim port available. 4. Remove CMSIS interface use, replaced by bsim port. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use nrfx interface for register access with sideeffects to facilitate bsim use. Remove CMSIS interface use, was replaced with nrf_grtc, nrf_dppic and nrf_ppib interface in previous commit. 4 part commits: 1. Add nrf_grtc interface. 2. Remove CMSIS interface use. 3. Add nrf_grtc interface, once missing bsim port available. 4. Remove CMSIS interface use, replaced by bsim port. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use SW_SWITCH_SINGLE_TIMER for nRF54Lx so that fast ramp can be used, and hence support assymmetric PHYs in ACL connections. nRF54Lx radio domain does not have second timer instance to efficiently implement software switch unless a second time is used from a different power domain needed use of PPIB for the double buffered switch timer compares. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Use NRF_GRTC in nrf54l15bsim board builds. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
This reverts commit 3d72998. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Enable central HR peripheral HR samples for nrf54l15bsim. RealEncryption is BabbleSIM is not enabled as nRF54L port in Zephyr Controller is not yet supported and the test is also not using security (SMP pairing). Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
fa2f85f
to
d1293ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving understanding that this PR will be followed up shortly with another one fixing the entropy source so we avoid randomness in CI.
@@ -47,17 +116,89 @@ uint32_t cntr_stop(void) | |||
return 1; | |||
} | |||
|
|||
#if defined(CONFIG_BT_CTLR_NRF_GRTC) | |||
/* TODO: if we own and stop GRTC, implement stop here */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I don't think anybody is meant to ever stop the GRTC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's passing existing tests, but are we testing all the new Kconfigs?
Use NRF_GRTC, Global real-time counter, instead of NRF_RTC.
NRF_GRTC is present in a different power domain in the SoC.
Also, NRF_GRTC provide microsecond resolution timing units,
in the future use of NRF_TIMER for packet timer can also be
replaced.
Use of NRF_RTC would keep Radio power domain ON in addition
to already ON NRF_GRTC's power domain, hence switch to using
NRF_GRTC on nRF54Lx SoC to have lower power consumptions.
Add ticker implementation support for free running counter use.