Fix incorrect radio timing for Tx chain delay for S2 and S8
coding. Regression introduced in commit 55d3ce111c
("Bluetooth: controller: Refactoring nRF5 radio driver").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix conditional compilation in nRF5 radio interface so that
when Coded PHY feature is not selected then it does not use
the PPIs required for supporting the feature.
This will allow pwm_nrf5_sw driver to use PPI channels 14 to
19 and support 3 PWM channels. Without the Coded PHY feature
disabled, only PPI 14, 15, 18 and 19 are available for PWM.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit implements a minor refactoring of the implementation
for enabling the Radio on TIFS expiration. It inlines a function
that is defined in the local radio_nrf5_ppi header file.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit contributes the implementation of the sw-switch for
tIFS in nRF5 Radio using the EVENT_TIMER instead of a dedicated
TIMER instance. A Kconfig configuration is added so the user can
select whether to use the EVENT_TIMER for the tIFS switch or use
a dedicated TIMER instance.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit implements minor refactoring of radio.c and ctrl.c,
to prepare for adding the implementation of sw-switch based on
the event timer.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit adds the option of conditionally reuse an existing
CC register of the event timer for timer sampling used in ISR
profiling, in case SW tIFS switching is implemented based on the
event timer.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit adds a symbolic name for the event timer
CC offset that is used to sample the event timer during
ISR profiling.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Refactor radio_nrf5* header files to group together
definitions and have less #if-#else-#endif.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Conditionally compiled changes to the NRF52 HAL so it can
run on simulated HW on the native port.
(HW models are not included in this commit)
All changes are under ifdefs and therefore will not have any
effect on normal builds
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Refactor mayfly based execution context solution out into
the HAL folder. This opens up the possibility to use
tasklets (if and when kernel gets the support) style
execution contexts.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove redundant code that clears NRF_RADIO->EVENT_*
registers that are only used in PPI context. Only EVENT_*
registers that are read back need to be cleared.
Relates to: #5753
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit implements the SW-based radio switch for TIFS for LE
Coded PHY S2 in nRF52840 with a single PPI channel and a single
TIMER CC register.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit moves the radio enable on-tick functionality in
function hal_radio_enable_on_tick_ppi_config_and_enable() in
radio_nrf5_ppi.h.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Fix a missing !CONFIG_BT_CTLR_TIFS_HW conditional
compilation when nRF52840 is configured to use hardware
Trx switching, that caused compile error.
Fixes: #5779Fixes: #5761
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit refactors the nRF5 radio driver of Bluetooth controller
to use symbolic names for PPIs. It also revisits the Radio hardware
timing constants to align with experimental measurements.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Add implementation to consider differing Rx chain delays for
S2 and S8 Coded PHY PDU reception. These changes are
required to meet tIFS timings for transmission after a
reception on S8 coding.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
PA/LNA feature being not default enabled, keeping the PPI
indices used for this feature at the higher indices would
allow use of these PPI indices by other drivers, for
instance the nRF5 software PWM driver.
Software PWM driver provides 3 PWM pins/channels using upto
6 PPI channels. If BLE controler where to use 0-13, then
14-19 PPI indices can be used by the PWM driver.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Always use S8 Rx Chain Delay instead of the actual Rx-ed
packet coding. I believe, as the packet always start with
S8, hence S8 timings when used the tIFS is near correct
value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fixed the usage of NRF_AAR peripheral for controller privacy
to clear events on configure and on every radio ISR entry.
Without this fix, there was spurious AAR matches leading to
controller asserts.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the use of tIFS software switching PPI index set up by
one position to make place for use of PA/LNA implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Earlier design captured AA twice in the first Rx in a slave
connection event and retained one of the capture until end
of event to calculate drift.
Design updated to use single capture of AA and save the
first AA capture in a slave connection event in RAM instead.
This frees up a PPI channel in the controller design.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Minor refactor of radio_tmr_start to reduced duplicate
assignments common in if-then-else control path.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Updated debug pin mapping so that the outputs are on P3 pin
head on all nRF5x Development Kits.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fixed the configuration of NRF_CCM for 2M PHY connections.
Now faster 2M data rate mode will be used when a connection
is in 2M PHY.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use correct NRF_AAR enable macro defines from Nordic MDK.
Old code funtionally worked fine even though not setting
the correct enable value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Optimised the get() function in nRF5 hal rand implementation
to reduce number of probable branching operations.
This is needed to reduce nRF51 platform's CPU use in radio
ISR when using the fast encryption setup implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
To meet CPU time usage restricts inside radio ISR on nRF51
SoCs, use ccflags -Ofast when using fast encryption setup
implementation in the controller.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.
Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fix incorrect return data type, which causes controller to
hang generating random numbers.
Fixes bug introduced in commit d90095b556 ("Bluetooth:
controller: Use random numbers in adv and enc setup")
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added implementation to get random numbers in ISR. And fixed
implementation to use random numbers in advertisement random
delay and encryption setup procedure.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The nRF5 AAR requires the packet pointer to be placed exactly 3 bytes
before the beginning of the address. Since we don't use the S1 extra
length byte, substract one from the address of the radio packet pointer.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The nRF5's AAR was being improperly configured, leading to a NULL
scratch pointer which made it not function at all.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order to obtain the ID (index) of the device matched in a hardware
filter, a new API call has been added along with the required
implementation for nRF5x devices.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
We have conflicting types between the decleration and implementation of
several radio functions. We should be using u32_t everywhere. This
shows up when we try and build with newlib enabled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Added HAL Radio abstractions to use SoC specific Radio Timings
as documented in SoC's electrical characteristics.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Restrict encryption support on nRF51 series SoC to Bluetooth
LE 1M PHY and max. 27 bytes PDU. If 251 bytes PDU using Data
Length Update procedure is desired, then LE Encryption
procedure will not be supported (until a software CCM is
implemented in future).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
While returning 32-bit values from radio status interfaces,
explicitly compare radio h/w event registers to be non-zero,
dont just return the direct 32-bit h/w register content.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Since more and more code is going to be reused by both the Host and the
Controller, this commit introduces a common/ folder that will contain
everything that is not tied to one of the two components but shared by
them.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Added support for Bluetooth v5.0 PHY Update Procedure in the
Controller.
Asymmetric PHY connections do not work for now due to the
Radio mode not being setup in time in the ISR during tIFS
period and the Radio already ramping up in the cached
previous Radio mode to meet tIFS deadline.
Subsequent commits will add this feature, by either double
buffering the mode in software or using fast radio ramp up
which gives enough time in the ISR to change the mode.
Jira: ZEP-2086
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>