Skip to content

Commit dcd56da

Browse files
markaj-nordicMarGasiorek
authored andcommitted
lib: Bump Aliro stack to revision db4c065
- updated/added stack binaries for nRF54L15, nRF5340 and nRF52840 - aligned app sources and configuration to the new lib revision and all supported platforms - updated docs to include support for nRF54L15, nRF5340 and nRF52840 - added sample.yml for Twister integration Signed-off-by: Marcin Kajor <marcin.kajor@nordicsemi.no> Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
1 parent 2841ea8 commit dcd56da

38 files changed

Lines changed: 658 additions & 402 deletions

app/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ target_sources(app PRIVATE
1717
${app_sources}
1818
)
1919

20-
set(ALIRO_LIB ${ZEPHYR_NCS_DOOR_LOCK_APP_MODULE_DIR}/lib/aliro/bin)
2120
set(PUBLIC_API ${ZEPHYR_NCS_DOOR_LOCK_APP_MODULE_DIR}/lib/aliro)
2221

23-
zephyr_link_libraries(${ALIRO_LIB}/libaliro.a)
22+
if(CONFIG_SOC_SERIES_NRF52X)
23+
set(ALIRO_LIB_PATH ${ZEPHYR_NCS_DOOR_LOCK_APP_MODULE_DIR}/lib/aliro/bin/cortex-m4)
24+
elseif(CONFIG_SOC_SERIES_NRF54LX OR CONFIG_SOC_SERIES_NRF53X)
25+
set(ALIRO_LIB_PATH ${ZEPHYR_NCS_DOOR_LOCK_APP_MODULE_DIR}/lib/aliro/bin/cortex-m33)
26+
endif()
27+
28+
add_library(aliro_stack STATIC IMPORTED GLOBAL)
29+
30+
set_target_properties(aliro_stack PROPERTIES IMPORTED_LOCATION ${ALIRO_LIB_PATH}/libaliro.a)
31+
32+
target_link_libraries(app PRIVATE aliro_stack)
33+
target_link_libraries(aliro_stack INTERFACE zephyr_interface)
2434

2535
zephyr_include_directories(${PUBLIC_API}/include)
2636
zephyr_include_directories(${PUBLIC_API}/interfaces)

app/Kconfig.sysbuild

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
source "share/sysbuild/Kconfig"
8+
9+
config NRF_DEFAULT_IPC_RADIO
10+
default y
11+
12+
config NETCORE_IPC_RADIO_BT_HCI_IPC
13+
default y
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&pinctrl {
8+
spi0_default_alt: spi0_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
11+
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
12+
<NRF_PSEL(SPIM_MISO, 1, 14)>;
13+
};
14+
};
15+
16+
spi0_sleep_alt: spi0_sleep_alt {
17+
group1 {
18+
psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
19+
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
20+
<NRF_PSEL(SPIM_MISO, 1, 14)>;
21+
low-power-enable;
22+
};
23+
};
24+
};
25+
26+
&spi0 {
27+
compatible = "nordic,nrf-spi";
28+
status = "okay";
29+
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
30+
31+
pinctrl-0 = <&spi0_default_alt>;
32+
pinctrl-1 = <&spi0_sleep_alt>;
33+
pinctrl-names = "default", "sleep";
34+
nucleo_nfc@0 {
35+
compatible = "x-nucleo-nfc";
36+
reg = <0>;
37+
spi-max-frequency = <4000000>;
38+
irq-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
39+
};
40+
};
41+
42+
&spi1 {
43+
status = "disabled";
44+
};
45+
46+
&spi2 {
47+
status = "disabled";
48+
};
49+
50+
&spi3 {
51+
status = "disabled";
52+
};
53+
54+
/ {
55+
psa_rng: psa-rng {
56+
compatible = "zephyr,psa-crypto-rng";
57+
status = "okay";
58+
};
59+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&pinctrl {
8+
spi1_default_alt: spi1_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
11+
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
12+
<NRF_PSEL(SPIM_MISO, 1, 14)>;
13+
};
14+
};
15+
16+
spi1_sleep_alt: spi1_sleep_alt {
17+
group1 {
18+
psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
19+
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
20+
<NRF_PSEL(SPIM_MISO, 1, 14)>;
21+
low-power-enable;
22+
};
23+
};
24+
25+
};
26+
27+
28+
&spi1 {
29+
compatible = "nordic,nrf-spim";
30+
status = "okay";
31+
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
32+
33+
pinctrl-0 = <&spi1_default_alt>;
34+
pinctrl-1 = <&spi1_sleep_alt>;
35+
pinctrl-names = "default", "sleep";
36+
nucleo_nfc@0 {
37+
compatible = "x-nucleo-nfc";
38+
reg = <0>;
39+
spi-max-frequency = <4000000>;
40+
irq-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
41+
};
42+
};
File renamed without changes.

app/prj.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ CONFIG_RESET_ON_FATAL_ERROR=n
1616
CONFIG_CONSOLE=y
1717
CONFIG_LOG=y
1818
CONFIG_NCS_ALIRO_RFAL_LOG_LEVEL_DBG=y
19+
CONFIG_USE_SEGGER_RTT=n
20+
CONFIG_LOG_BACKEND_RTT=n
21+
CONFIG_LOG_BACKEND_SHOW_COLOR=n
1922

2023
# Print reader key that can be provisioned to the User Device
2124
CONFIG_ALIRO_PRINT_READER_GROUP_ID=y
@@ -28,5 +31,11 @@ CONFIG_SHELL_VT100_COLORS=n
2831
CONFIG_SHELL_HISTORY=n
2932
CONFIG_SHELL_WILDCARD=n
3033

34+
# Increase shell buffer sizes
35+
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=512
36+
CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=128
37+
3138
# Adjust logs queue size
3239
CONFIG_SHELL_BACKEND_SERIAL_LOG_MESSAGE_QUEUE_SIZE=768
40+
41+
CONFIG_ASSERT=y

app/sample.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sample:
2+
description: Door lock sample application
3+
name: ncs-door-lock-sample
4+
common:
5+
sysbuild: true
6+
build_only: true
7+
platform_allow: &platforms
8+
- nrf54l15dk/nrf54l15/cpuapp
9+
- nrf52840dk/nrf52840
10+
- nrf5340dk/nrf5340/cpuapp
11+
integration_platforms: *platforms
12+
tests:
13+
app.nfc_door_lock: {}

app/src/hw_init.cpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

app/src/main.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,7 @@ LOG_MODULE_REGISTER(door_lock_app, CONFIG_NCS_DOOR_LOCK_APP_LOG_LEVEL);
1717

1818
int main()
1919
{
20-
LOG_INF(" \r\n"
21-
" @@@ @@@@ \r\n"
22-
" @@@@@@@@@@@@ @@@ \r\n"
23-
" @@@@@ @@@@@ @@@@ @@ @@@ @@ @@ @@@@ \r\n"
24-
" @@@@ @@@@ @@@@ @@@@@@ @@@ @@ @@@@@ @@@ @@@@ \r\n"
25-
"@@@@ @@ @@@ @@@ @@@ @@@ @@ @@@ @@@ @@@\r\n"
26-
"@@@ @@@@@ @@@ @@@ @@@ @@@ @@ @@ @@@ @@\r\n"
27-
"@@@ @@@@@@@@ @@@ @@@ @@@ @@@ @@ @@ @@@ @@\r\n"
28-
" @@@ @@@@ @@@@ @@@ @@@@ @@@ @@ @@ @@ @@@\r\n"
29-
" @@@ @@@@ @@@@ @@@@@@@@@@@ @@@@@ @@ @@ @@@@@@@@@ \r\n"
30-
" @@@@ @@@@ @@@@ \r\n"
31-
" @@ @@@@ @@ \r\n");
20+
LOG_INF("Starting nRF Door Lock Reference Application for the nRF Connect SDK");
3221

3322
AliroError ec = Aliro::AliroStack::Instance().Init(
3423
{ .mOnAccessAttempt =

app/src/nfc_transport_impl/nfc_transport_rfal.cpp

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@ K_THREAD_STACK_DEFINE(mStack, CONFIG_RFAL_WORKER_THREAD_STACK_SIZE);
2323
void NfcTransportRfal::Run()
2424
{
2525
while (true) {
26-
if (mRxTimeout || mIdleTimeout) {
27-
if (mRxTimeout) {
28-
VerifyAndCall(Instance().NfcDriver::mCallbacks.mOnError, ALIRO_TIMEOUT);
29-
mRxTimeout = false;
30-
}
31-
if (mIdleTimeout) {
32-
mIdleTimeout = false;
33-
}
26+
if (mIdleTimeout) {
27+
mIdleTimeout = false;
3428
RecoverPolling();
3529
}
3630
rfalNfcWorker();
@@ -73,7 +67,6 @@ void NfcTransportRfal::RfalNotifyCallback(rfalNfcState state)
7367
LOG_DBG("RFAL: Data exchange state");
7468
break;
7569
case RFAL_NFC_STATE_DATAEXCHANGE_DONE:
76-
k_timer_stop(&mRxTimer);
7770
CaptureRxData();
7871
k_timer_start(&mIdleTimer, K_MSEC(sIdleTimerTimeoutMs), K_NO_WAIT);
7972
break;
@@ -106,7 +99,7 @@ ReturnCode NfcTransportRfal::RfalNfcInit()
10699
return err;
107100
}
108101

109-
void NfcTransportRfal::SelectTag()
102+
void NfcTransportRfal::SelectTag() const
110103
{
111104
rfalNfcDevice *nfcDevice;
112105
rfalNfcGetActiveDevice(&nfcDevice);
@@ -150,7 +143,7 @@ void NfcTransportRfal::CaptureRxData()
150143
0);
151144
}
152145

153-
void NfcTransportRfal::RecoverPolling()
146+
void NfcTransportRfal::RecoverPolling() const
154147
{
155148
if (rfalNfcIsDevActivated(rfalNfcGetState())) {
156149
ReturnCode err = rfalNfcDeactivate(RFAL_NFC_DEACTIVATE_SLEEP);
@@ -169,26 +162,26 @@ AliroError NfcTransportRfal::_Init(IsoDep::Callbacks callbacks)
169162
return ALIRO_NO_ERROR;
170163
}
171164

172-
AliroError NfcTransportRfal::_PrepareData(NfcTransport::Data data)
165+
AliroError NfcTransportRfal::_PrepareData([[maybe_unused]] Data data) const
173166
{
174167
// ISO-DEP layer is implemented internally in the RFAL, no need for special data handling
175168
return ALIRO_ERROR_NOT_IMPLEMENTED;
176169
}
177170

178-
AliroError NfcTransportRfal::_PrepareRats()
171+
AliroError NfcTransportRfal::_PrepareRats() const
179172
{
180173
// RATS is sent by the driver internally as an activation procedure, so we can presume the tag is fully selected
181174
// a this point
182175
return ALIRO_ERROR_NOT_IMPLEMENTED;
183176
}
184177

185-
AliroError NfcTransportRfal::_HandleReceivedData(NfcTransport::Data data, int transferError)
178+
AliroError NfcTransportRfal::_HandleReceivedData([[maybe_unused]] Data data, [[maybe_unused]] int transferError) const
186179
{
187180
// No specific processing needed, all ISO-DEP specific data handling happens in driver's internals
188181
return ALIRO_ERROR_NOT_IMPLEMENTED;
189182
}
190183

191-
AliroError NfcTransportRfal::_ReportTimeout()
184+
AliroError NfcTransportRfal::_ReportTimeout() const
192185
{
193186
// No special handling needed with RFAL
194187
return ALIRO_ERROR_NOT_IMPLEMENTED;
@@ -219,7 +212,7 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
219212
return ALIRO_ERROR_INTERNAL;
220213
}
221214

222-
k_tid_t thread = ncs_pal_nfc_worker_start([](void *, void *, void *) -> void { return Instance().Run(); });
215+
const k_tid_t thread = ncs_pal_nfc_worker_start([](void *, void *, void *) { Instance().Run(); });
223216

224217
VerifyOrReturnStatus(thread, ALIRO_INVALID_STATE, LOG_ERR("RFAL: Cannot spawn the NFC driver thread"));
225218

@@ -228,14 +221,6 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
228221
return ALIRO_ERROR_INTERNAL;
229222
}
230223

231-
k_timer_init(
232-
&mRxTimer,
233-
[](k_timer *) {
234-
LOG_DBG("RFAL: RX timer expired");
235-
Instance().mRxTimeout = true;
236-
},
237-
nullptr);
238-
239224
k_timer_init(
240225
&mIdleTimer,
241226
[](k_timer *) {
@@ -247,7 +232,7 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
247232
return ALIRO_NO_ERROR;
248233
}
249234

250-
AliroError NfcTransportRfal::_Send(NfcTransport::Data data, uint32_t maximumFrameDelayTime)
235+
AliroError NfcTransportRfal::_Send(Data data, [[maybe_unused]] uint32_t maximumFrameDelayTime)
251236
{
252237
k_timer_stop(&mIdleTimer);
253238

@@ -256,14 +241,13 @@ AliroError NfcTransportRfal::_Send(NfcTransport::Data data, uint32_t maximumFram
256241
// use RFAL_FWT_NONE as FWT because the driver with ISO-DEP enabled will ignore it anyway
257242
ReturnCode err = rfalNfcDataExchangeStart(data.mData, data.mLength, &mRxData, &mRcvLen, RFAL_FWT_NONE);
258243
if (!err) {
259-
k_timer_start(&mRxTimer, K_MSEC(sRxTimerTimeoutMs), K_NO_WAIT);
260244
return ALIRO_NO_ERROR;
261245
}
262246

263247
return ALIRO_ERROR_INTERNAL;
264248
}
265249

266-
AliroError NfcTransportRfal::_NfcOn()
250+
AliroError NfcTransportRfal::_NfcOn() const
267251
{
268252
// The RF field is turned right after the STR25 boots
269253
// The only thing that must be done is to activate the reader
@@ -277,7 +261,7 @@ AliroError NfcTransportRfal::_NfcOn()
277261
return ALIRO_NO_ERROR;
278262
}
279263

280-
AliroError NfcTransportRfal::_NfcOff()
264+
AliroError NfcTransportRfal::_NfcOff() const
281265
{
282266
// RFAL handles this internally and knows when the field can be off
283267
return ALIRO_ERROR_NOT_IMPLEMENTED;

0 commit comments

Comments
 (0)