diff --git a/Documentation/platforms/arm/nrf54l/boards/nrf54l15-tag/index.rst b/Documentation/platforms/arm/nrf54l/boards/nrf54l15-tag/index.rst new file mode 100644 index 00000000000..27652d1ea75 --- /dev/null +++ b/Documentation/platforms/arm/nrf54l/boards/nrf54l15-tag/index.rst @@ -0,0 +1,112 @@ +=================== +Nordic nRF54L15 Tag +=================== + +.. tags:: chip:nrf54l, chip:nrf54l15 + +.. figure:: nrf54l15-tag-front.jpg + :align: center + :alt: nRF54L15-TAG Front + + nRF54L15-TAG Front + +The nRF54L15-TAG is a board based on the nRF54L15 from Nordic. + +Serial Console +============== + +The console uses RTT channel 0. Connect an external J-Link probe to the +P1 SWD header and use a bidirectional RTT terminal. + +LEDs +==== + +The board has an RGB LED: + +===== ===== +Color MCU +===== ===== +Red P2.08 +Green P2.10 +Blue P2.09 +===== ===== + +A low output illuminates the LED. + +Button +====== + +BTN1 is connected to P0.00 and is active low. + +Onboard sensors +=============== + +The board provides the following sensors: + +======== ===================================== ======================= +Device Measurements Interface +======== ===================================== ======================= +BMI270 Acceleration and angular velocity SPI2 (SPIM22) +BME688 Temperature, pressure, humidity, gas I2C1 (TWIM21), 0x76 +ADXL367 Acceleration and die temperature I2C1 (TWIM21), 0x1d +======== ===================================== ======================= + +SPI2 uses P1.08 (SCK), P1.06 (MOSI), P1.05 (MISO), and P1.07 +(BMI270 chip select). I2C1 uses P1.11 (SCL) and P1.12 (SDA). + +The SAADC measures the supply voltage through its internal VDD input. +With 12-bit resolution and a 3.6 V full scale, the voltage is +``sample * 3.6 / 4096`` volts. + +Configurations +============== + +Select a configuration with:: + + tools/configure.sh nrf54l15-tag: + +nsh +--- + +Basic NuttShell configuration with the console over RTT. + +sensors +------- + +NSH over RTT with the three onboard sensors, supply-voltage ADC, BTN1, +user LEDs, and TIMER20. The configuration includes ``sensortest``, ``i2c``, +``adc``, ``buttons``, ``leds``, and ``timer``. For example:: + + sensortest -n 10 accel0 + sensortest -n 10 gyro0 + sensortest -n 10 accel1 + sensortest -n 5 baro0 + sensortest -n 5 humi0 + adc + buttons + timer + +``accel0`` and ``gyro0`` are the BMI270; ``accel1`` is the ADXL367. +The BME688 barometer samples also include temperature. The ADC is registered +at ``/dev/adc0``, BTN1 at ``/dev/buttons``, and TIMER20 at ``/dev/timer0``. + +sdc +--- + +NSH over RTT with the native Bluetooth host, SoftDevice Controller, GRTC +tickless scheduling and the ``bt`` utility. Set ``CONFIG_NRF54L_SDC_PUB_ADDR`` +to the board's assigned public address. The host advertises its GAP service +at startup. To scan:: + + bt bnep0 scan start -d + bt bnep0 scan get + bt bnep0 scan stop + +Flash & Debug +============= + +An external SWD probe is required. Program the generated ``nuttx.hex`` +with a tool supporting nRF54L15, for example:: + + nrfutil device program --firmware nuttx.hex --serial-number PROBE_SERIAL + nrfutil device reset --serial-number PROBE_SERIAL diff --git a/Documentation/platforms/arm/nrf54l/boards/nrf54l15-tag/nrf54l15-tag-front.jpg b/Documentation/platforms/arm/nrf54l/boards/nrf54l15-tag/nrf54l15-tag-front.jpg new file mode 100644 index 00000000000..1ab82c92207 Binary files /dev/null and b/Documentation/platforms/arm/nrf54l/boards/nrf54l15-tag/nrf54l15-tag-front.jpg differ diff --git a/boards/Kconfig b/boards/Kconfig index 2e651a8056c..48038f28f05 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -1567,6 +1567,15 @@ config ARCH_BOARD_THINGY53 ---help--- This option selects the Thingy:53 multi-protocol IoT prototyping platform +config ARCH_BOARD_NRF54L15_TAG + bool "Nordic nRF54L15 Tag" + depends on ARCH_CHIP_NRF54L15 + select ARCH_HAVE_LEDS + select ARCH_HAVE_BUTTONS + select ARCH_HAVE_IRQBUTTONS + ---help--- + This option selects the nRF54L15 Tag + config ARCH_BOARD_NRF54LM20_DK bool "Nordic nRF54LM20 Development Kit" depends on ARCH_CHIP_NRF54LM20A || ARCH_CHIP_NRF54LM20B @@ -4141,6 +4150,7 @@ config ARCH_BOARD default "nrf5340-dk" if ARCH_BOARD_NRF5340_DK default "nrf5340-audio-dk" if ARCH_BOARD_NRF5340_AUDIO_DK default "thingy53" if ARCH_BOARD_THINGY53 + default "nrf54l15-tag" if ARCH_BOARD_NRF54L15_TAG default "nrf54lm20-dk" if ARCH_BOARD_NRF54LM20_DK default "nrf9160-dk" if ARCH_BOARD_NRF9160_DK default "thingy91" if ARCH_BOARD_THINGY91 diff --git a/boards/arm/nrf54l/nrf54l15-tag/CMakeLists.txt b/boards/arm/nrf54l/nrf54l15-tag/CMakeLists.txt new file mode 100644 index 00000000000..410d7e5661e --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# boards/arm/nrf54l/nrf54l15-tag/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +add_subdirectory(src) diff --git a/boards/arm/nrf54l/nrf54l15-tag/Kconfig b/boards/arm/nrf54l/nrf54l15-tag/Kconfig new file mode 100644 index 00000000000..1b82cd0f69c --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_NRF54L15_TAG + +endif # ARCH_BOARD_NRF54L15_TAG diff --git a/boards/arm/nrf54l/nrf54l15-tag/configs/nsh/defconfig b/boards/arm/nrf54l/nrf54l15-tag/configs/nsh/defconfig new file mode 100644 index 00000000000..f142f8f44ee --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/configs/nsh/defconfig @@ -0,0 +1,28 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="nrf54l15-tag" +CONFIG_ARCH_BOARD_NRF54L15_TAG=y +CONFIG_ARCH_CHIP="nrf54l" +CONFIG_ARCH_CHIP_NRF54L15=y +CONFIG_ARCH_CHIP_NRF54L=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARD_LOOPSPERMSEC=10000 +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=262144 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN=256 +CONFIG_SERIAL_RTT0=y +CONFIG_START_YEAR=2026 +CONFIG_SYSLOG_RTT=y +CONFIG_SYSTEM_NSH=y diff --git a/boards/arm/nrf54l/nrf54l15-tag/configs/sdc/defconfig b/boards/arm/nrf54l/nrf54l15-tag/configs/sdc/defconfig new file mode 100644 index 00000000000..aac9931915d --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/configs/sdc/defconfig @@ -0,0 +1,62 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ALLOW_BSDNORDIC_COMPONENTS=y +CONFIG_ALLOW_BSD_COMPONENTS=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="nrf54l15-tag" +CONFIG_ARCH_BOARD_NRF54L15_TAG=y +CONFIG_ARCH_CHIP="nrf54l" +CONFIG_ARCH_CHIP_NRF54L15=y +CONFIG_ARCH_CHIP_NRF54L=y +CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_STACKDUMP=y +CONFIG_BLUETOOTH_MAX_CONN=2 +CONFIG_BLUETOOTH_TXCMD_PRIORITY=180 +CONFIG_BLUETOOTH_TXCONN_PRIORITY=180 +CONFIG_BOARD_LOOPSPERMSEC=10000 +CONFIG_BTSAK=y +CONFIG_BTSAK_STACKSIZE=4096 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_HARDFAULT_ALERT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_WIRELESS=y +CONFIG_DEBUG_WIRELESS_ERROR=y +CONFIG_DEBUG_WIRELESS_WARN=y +CONFIG_FS_PROCFS=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 +CONFIG_INTELHEX_BINARY=y +CONFIG_NET=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NET_BLUETOOTH=y +CONFIG_NRF54L_LFCLK_SYNTH=y +CONFIG_NRF54L_SDC_PUB_ADDR=0x010203040507 +CONFIG_NRF54L_SOFTDEVICE_CONTROLLER=y +CONFIG_NRF54L_SYSTIMER_GRTC=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFCONFIG=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_DISABLE_VCONFIG=y +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_MQ_MSGS=32 +CONFIG_RAM_SIZE=262144 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_SCHED_LPWORKPRIORITY=180 +CONFIG_SCHED_LPWORKSTACKSIZE=4096 +CONFIG_SCHED_WAITPID=y +CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN=256 +CONFIG_SERIAL_RTT0=y +CONFIG_STACK_COLORATION=y +CONFIG_START_YEAR=2026 +CONFIG_SYSLOG_RTT=y +CONFIG_SYSTEM_NSH=y +CONFIG_USEC_PER_TICK=10000 +CONFIG_WIRELESS=y +CONFIG_WIRELESS_BLUETOOTH=y diff --git a/boards/arm/nrf54l/nrf54l15-tag/configs/sensors/defconfig b/boards/arm/nrf54l/nrf54l15-tag/configs/sensors/defconfig new file mode 100644 index 00000000000..c27b11b53fd --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/configs/sensors/defconfig @@ -0,0 +1,65 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_LEDS is not set +CONFIG_ADC=y +CONFIG_ANALOG=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="nrf54l15-tag" +CONFIG_ARCH_BOARD_NRF54L15_TAG=y +CONFIG_ARCH_BUTTONS=y +CONFIG_ARCH_CHIP="nrf54l" +CONFIG_ARCH_CHIP_NRF54L15=y +CONFIG_ARCH_CHIP_NRF54L=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_IRQBUTTONS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BME688_I2C_FREQUENCY=100000 +CONFIG_BOARD_LOOPSPERMSEC=10000 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_EXAMPLES_ADC=y +CONFIG_EXAMPLES_ADC_GROUPSIZE=1 +CONFIG_EXAMPLES_ADC_NSAMPLES=5 +CONFIG_EXAMPLES_ADC_SWTRIG=y +CONFIG_EXAMPLES_BUTTONS=y +CONFIG_EXAMPLES_LEDS=y +CONFIG_EXAMPLES_TIMER=y +CONFIG_FS_PROCFS=y +CONFIG_I2CTOOL_DEFFREQ=100000 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INPUT=y +CONFIG_INPUT_BUTTONS=y +CONFIG_INPUT_BUTTONS_LOWER=y +CONFIG_INTELHEX_BINARY=y +CONFIG_NRF54L_GPIOTE=y +CONFIG_NRF54L_I2C1_MASTER=y +CONFIG_NRF54L_SAADC=y +CONFIG_NRF54L_SAADC_CHANNELS=1 +CONFIG_NRF54L_SAADC_RESOLUTION=2 +CONFIG_NRF54L_SPI2_MASTER=y +CONFIG_NRF54L_TIMER0=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=262144 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN=256 +CONFIG_SENSORS=y +CONFIG_SENSORS_ADXL367=y +CONFIG_SENSORS_BME688=y +CONFIG_SENSORS_BMI270=y +CONFIG_SENSORS_BMI270_UORB=y +CONFIG_SERIAL_RTT0=y +CONFIG_START_YEAR=2026 +CONFIG_SYSLOG_RTT=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SENSORTEST=y +CONFIG_USERLED=y +CONFIG_USERLED_LOWER=y diff --git a/boards/arm/nrf54l/nrf54l15-tag/include/board.h b/boards/arm/nrf54l/nrf54l15-tag/include/board.h new file mode 100644 index 00000000000..a0d3c27093f --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/include/board.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/include/board.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_NRF54L_NRF54L15_TAG_INCLUDE_BOARD_H +#define __BOARDS_ARM_NRF54L_NRF54L15_TAG_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +#define BOARD_SYSTICK_CLOCK 128000000 +#define BOARD_HFXO_CAPACITANCE 15000 + +/* LED definitions **********************************************************/ + +#define BOARD_LED1 0 +#define BOARD_LED2 1 +#define BOARD_LED3 2 +#define BOARD_NLEDS 3 + +/* LED bits for use with board_userled_all() */ + +#define BOARD_LED1_BIT (1 << BOARD_LED1) +#define BOARD_LED2_BIT (1 << BOARD_LED2) +#define BOARD_LED3_BIT (1 << BOARD_LED3) + +/* LED indications when CONFIG_ARCH_LEDS is selected */ + +#define LED_STARTED 0 /* OFF */ +#define LED_HEAPALLOCATE 0 /* OFF */ +#define LED_IRQSENABLED 0 /* OFF */ +#define LED_STACKCREATED 1 /* ON */ +#define LED_INIRQ 2 /* No change */ +#define LED_SIGNAL 2 /* No change */ +#define LED_ASSERTION 2 /* No change */ +#define LED_PANIC 3 /* Flashing */ + +/* Buttons ******************************************************************/ + +#define BUTTON_BTN1 0 +#define NUM_BUTTONS 1 +#define BUTTON_BTN1_BIT (1 << BUTTON_BTN1) + +/* SPI22: BMI270 ************************************************************/ + +#define BOARD_SPI2_SCK_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(8)) +#define BOARD_SPI2_MOSI_PIN (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN(6)) +#define BOARD_SPI2_MISO_PIN (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN(5)) + +/* TWIM21: BME688 and ADXL367 ***********************************************/ + +#define BOARD_I2C1_SCL_PIN (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN(11)) +#define BOARD_I2C1_SDA_PIN (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN(12)) + +#endif /* __BOARDS_ARM_NRF54L_NRF54L15_TAG_INCLUDE_BOARD_H */ diff --git a/boards/arm/nrf54l/nrf54l15-tag/scripts/Make.defs b/boards/arm/nrf54l/nrf54l15-tag/scripts/Make.defs new file mode 100644 index 00000000000..e1a9cfb8919 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/scripts/Make.defs @@ -0,0 +1,36 @@ +############################################################################ +# boards/arm/nrf54l/nrf54l15-tag/scripts/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm/src/armv8-m/Toolchain.defs + +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)rram.ld + +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 diff --git a/boards/arm/nrf54l/nrf54l15-tag/scripts/rram.ld b/boards/arm/nrf54l/nrf54l15-tag/scripts/rram.ld new file mode 100644 index 00000000000..a22b426e1c7 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/scripts/rram.ld @@ -0,0 +1,111 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/scripts/rram.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#include + +MEMORY +{ + progmem (rx) : ORIGIN = 0x00000000, LENGTH = 0x17d000 + datamem (rwx) : ORIGIN = 0x20000000, LENGTH = 256K +} + +OUTPUT_ARCH(arm) +ENTRY(__start) /* Treat __start as the anchor for dead code stripping */ +EXTERN(_vectors) /* Force the vectors to be included in the output */ +SECTIONS +{ + .text : + { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > progmem + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) + _einit = ABSOLUTE(.); + } > progmem + + .ARM.extab : + { + *(.ARM.extab*) + } > progmem + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : + { + *(.ARM.exidx*) + } > progmem + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > datamem AT > progmem + + /* BSS */ + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > datamem + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/CMakeLists.txt b/boards/arm/nrf54l/nrf54l15-tag/src/CMakeLists.txt new file mode 100644 index 00000000000..5f7e0bcd2e5 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# boards/arm/nrf54l/nrf54l15-tag/src/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +set(SRCS nrf54l_boot.c nrf54l_bringup.c) +if(CONFIG_NRF54L_SPI2_MASTER) + list(APPEND SRCS nrf54l_spi.c) +endif() +if(CONFIG_SYSTEM_I2CTOOL) + list(APPEND SRCS nrf54l_i2c.c) +endif() +if(CONFIG_SENSORS) + list(APPEND SRCS nrf54l_sensors.c) +endif() +if(CONFIG_ARCH_BUTTONS) + list(APPEND SRCS nrf54l_buttons.c) +endif() +if(CONFIG_NRF54L_SAADC) + list(APPEND SRCS nrf54l_adc.c) +endif() +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS nrf54l_autoleds.c) +else() + list(APPEND SRCS nrf54l_userleds.c) +endif() +target_sources(board PRIVATE ${SRCS}) +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/rram.ld") diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/Make.defs b/boards/arm/nrf54l/nrf54l15-tag/src/Make.defs new file mode 100644 index 00000000000..018593cb472 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/Make.defs @@ -0,0 +1,51 @@ +############################################################################ +# boards/arm/nrf54l/nrf54l15-tag/src/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/Make.defs + +CSRCS = nrf54l_boot.c nrf54l_bringup.c + +ifeq ($(CONFIG_NRF54L_SPI2_MASTER),y) +CSRCS += nrf54l_spi.c +endif + +ifeq ($(CONFIG_SYSTEM_I2CTOOL),y) +CSRCS += nrf54l_i2c.c +endif + +ifeq ($(CONFIG_SENSORS),y) +CSRCS += nrf54l_sensors.c +endif + +ifeq ($(CONFIG_ARCH_BUTTONS),y) +CSRCS += nrf54l_buttons.c +endif + +ifeq ($(CONFIG_NRF54L_SAADC),y) +CSRCS += nrf54l_adc.c +endif + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += nrf54l_autoleds.c +else +CSRCS += nrf54l_userleds.c +endif diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/Makefile b/boards/arm/nrf54l/nrf54l15-tag/src/Makefile new file mode 100644 index 00000000000..18f237a458c --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/Makefile @@ -0,0 +1,24 @@ +############################################################################ +# boards/arm/nrf54l/nrf54l15-tag/src/Makefile +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include Make.defs +include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l15-tag.h b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l15-tag.h new file mode 100644 index 00000000000..baa0884351d --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l15-tag.h @@ -0,0 +1,103 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l15-tag.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_NRF54L_NRF54L15_TAG_SRC_NRF54L15_TAG_H +#define __BOARDS_ARM_NRF54L_NRF54L15_TAG_SRC_NRF54L15_TAG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include "nrf54l_gpio.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* procfs File System */ + +#ifdef CONFIG_FS_PROCFS +# ifdef CONFIG_NSH_PROC_MOUNTPOINT +# define NRF54L_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT +# else +# define NRF54L_PROCFS_MOUNTPOINT "/proc" +# endif +#endif + +/* LED definitions **********************************************************/ + +/* Definitions to configure LED GPIO as outputs */ + +#define GPIO_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN(8)) +#define GPIO_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN(10)) +#define GPIO_LED3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN(9)) + +/* Antenna switch ***********************************************************/ + +#define GPIO_ANT1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(9)) +#define GPIO_ANT2 (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN(10)) + +/* Button and sensors *******************************************************/ + +#define GPIO_BUTTON1 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN(0)) +#define GPIO_BMI270_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(7)) + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_bringup + * + * Description: + * Perform board-specific initialization. Called from + * board_late_initialize() when CONFIG_BOARD_LATE_INITIALIZE is selected. + * + ****************************************************************************/ + +int nrf54l_bringup(void); + +#ifdef CONFIG_NRF54L_SPI2_MASTER +void nrf54l_spidev_initialize(void); +#endif + +#ifdef CONFIG_SYSTEM_I2CTOOL +int nrf54l_i2ctool(void); +#endif + +#ifdef CONFIG_SENSORS +int nrf54l_sensors_init(void); +#endif + +#ifdef CONFIG_NRF54L_SAADC +int nrf54l_adc_setup(void); +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_NRF54L_NRF54L15_TAG_SRC_NRF54L15_TAG_H */ diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_adc.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_adc.c new file mode 100644 index 00000000000..05c4f2eb003 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_adc.c @@ -0,0 +1,93 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_adc.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "nrf54l_adc.h" +#include "nrf54l15-tag.h" + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Internal VDD input, 0.9 V reference and gain 1/4: 3.6 V full scale. */ + +static const struct nrf54l_adc_channel_s g_adc_chanlist[] = +{ + { + .p_psel = NRF54L_ADC_IN_VDD, + .n_psel = 0, + .gain = NRF54L_ADC_GAIN_1_4, + .refsel = NRF54L_ADC_REFSEL_INTERNAL, + .tacq = NRF54L_ADC_TACQ_40US, + .mode = NRF54L_ADC_MODE_SE, + .burst = NRF54L_ADC_BURST_DISABLE, + } +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_adc_setup + * + * Description: + * Register the supply voltage ADC channel. + * + ****************************************************************************/ + +int nrf54l_adc_setup(void) +{ + static bool initialized; + struct adc_dev_s *adc; + int ret; + + if (initialized) + { + return OK; + } + + adc = nrf54l_adcinitialize(g_adc_chanlist, 1); + if (adc == NULL) + { + return -ENODEV; + } + + ret = adc_register("/dev/adc0", adc); + if (ret < 0) + { + aerr("ERROR: adc_register failed: %d\n", ret); + return ret; + } + + initialized = true; + return OK; +} diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_autoleds.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_autoleds.c new file mode 100644 index 00000000000..06842832426 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_autoleds.c @@ -0,0 +1,104 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_autoleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "nrf54l15-tag.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const nrf54l_pinset_t g_ledcfg[BOARD_NLEDS] = +{ + GPIO_LED1, + GPIO_LED2, + GPIO_LED3, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_autoled_initialize + * + * Description: + * Configure the GPIO pins used for operating system LED indications. + * + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + unsigned int i; + + for (i = 0; i < BOARD_NLEDS; i++) + { + nrf54l_gpio_config(g_ledcfg[i]); + } +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Set the LED indication for the requested operating system event. + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + if (led == LED_STACKCREATED || led == LED_PANIC) + { + nrf54l_gpio_write(g_ledcfg[BOARD_LED1], false); + } +} + +/**************************************************************************** + * Name: board_autoled_off + * + * Description: + * Clear the LED indication for the requested operating system event. + * + ****************************************************************************/ + +void board_autoled_off(int led) +{ + if (led == LED_PANIC) + { + nrf54l_gpio_write(g_ledcfg[BOARD_LED1], true); + } +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_boot.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_boot.c new file mode 100644 index 00000000000..3df65f93637 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_boot.c @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_boot.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#include "nrf54l_start.h" +#include "nrf54l15-tag.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_board_initialize + * + * Description: + * Initialize board hardware before starting the operating system. + * + ****************************************************************************/ + +void nrf54l_board_initialize(void) +{ +#ifdef CONFIG_NRF54L_SPI2_MASTER + nrf54l_spidev_initialize(); +#endif + +#ifdef CONFIG_ARCH_LEDS + board_autoled_initialize(); +#endif +} + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +/**************************************************************************** + * Name: board_late_initialize + * + * Description: + * Initialize board devices after the operating system is available. + * + ****************************************************************************/ + +void board_late_initialize(void) +{ + nrf54l_bringup(); +} +#endif diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_bringup.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_bringup.c new file mode 100644 index 00000000000..a038c37a48a --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_bringup.c @@ -0,0 +1,147 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_bringup.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#ifdef CONFIG_INPUT_BUTTONS_LOWER +# include +#endif + +#ifdef CONFIG_USERLED_LOWER +# include +#endif + +#ifdef CONFIG_TIMER +# include "nrf54l_tim_lowerhalf.h" +#endif + +#include "nrf54l15-tag.h" + +#ifdef CONFIG_NRF54L_SOFTDEVICE_CONTROLLER +# include "nrf54l_sdc.h" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_bringup + * + * Description: + * Mount optional file systems and register enabled board devices. + * + ****************************************************************************/ + +int nrf54l_bringup(void) +{ + int ret; + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = nx_mount(NULL, NRF54L_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: procfs mount failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_USERLED_LOWER + /* Register the LED driver */ + + ret = userled_lower_initialize("/dev/userleds"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: LED registration failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_INPUT_BUTTONS_LOWER + ret = btn_lower_initialize("/dev/buttons"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Button registration failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_SYSTEM_I2CTOOL + ret = nrf54l_i2ctool(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: I2C registration failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_NRF54L_SAADC + ret = nrf54l_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: ADC registration failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_TIMER) && defined(CONFIG_NRF54L_TIMER0) + /* Configure TIMER driver */ + + ret = nrf54l_timer_initialize("/dev/timer0", 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize timer driver: %d\n", ret); + } +#endif + +#ifdef CONFIG_SENSORS + ret = nrf54l_sensors_init(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Sensor registration failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_NRF54L_SOFTDEVICE_CONTROLLER + /* Select antenna 1 on the SKY13348 RF switch */ + + nrf54l_gpio_config(GPIO_ANT2); + nrf54l_gpio_config(GPIO_ANT1); + + /* Register the Bluetooth controller */ + + ret = nrf54l_sdc_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: SDC initialization failed: %d\n", ret); + return ret; + } +#endif + + UNUSED(ret); + return OK; +} diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_buttons.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_buttons.c new file mode 100644 index 00000000000..2f43334002b --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_buttons.c @@ -0,0 +1,157 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_buttons.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include "nrf54l_gpio.h" +#include "nrf54l_gpiote.h" + +#include "nrf54l15-tag.h" + +#ifdef CONFIG_ARCH_BUTTONS + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Pin configuration for each button. This array is indexed by + * the BUTTON_* definitions in board.h + */ + +static const uint32_t g_buttons[NUM_BUTTONS] = +{ + GPIO_BUTTON1, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_button_initialize + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + ****************************************************************************/ + +uint32_t board_button_initialize(void) +{ + int i; + + /* Configure the GPIO pins as inputs. */ + + for (i = 0; i < NUM_BUTTONS; i++) + { + nrf54l_gpio_config(g_buttons[i]); + } + + return NUM_BUTTONS; +} + +/**************************************************************************** + * Name: board_buttons + ****************************************************************************/ + +uint32_t board_buttons(void) +{ + uint32_t ret = 0; + int i; + + /* Check that state of each key */ + + for (i = 0; i < NUM_BUTTONS; i++) + { + /* A LOW value means that the key is pressed. */ + + bool released = nrf54l_gpio_read(g_buttons[i]); + + /* Accumulate the set of depressed (not released) keys */ + + if (!released) + { + ret |= (1 << i); + } + } + + return ret; +} + +/**************************************************************************** + * Button support. + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns an + * 32-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT definitions in board.h for the meaning of each bit. + * + * board_button_irq() may be called to register an interrupt handler that + * will be called when a button is depressed or released. The ID value is + * a button enumeration value that uniquely identifies a button resource. + * See the BUTTON_* definitions in board.h for the meaning of enumeration + * value. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_IRQBUTTONS +int board_button_irq(int id, xcpt_t irqhandler, void *arg) +{ + int ret = OK; + + if (id < 0 || id >= NUM_BUTTONS) + { + return -EINVAL; + } + + ret = nrf54l_gpiote_set_event(g_buttons[id], true, true, irqhandler, arg); + if (ret < 0) + { + ierr("ERROR: nrf54l_gpiote_set_event\n"); + return ret; + } + + return OK; +} +#endif + +#endif /* CONFIG_ARCH_BUTTONS */ diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_i2c.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_i2c.c new file mode 100644 index 00000000000..2243f02e765 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_i2c.c @@ -0,0 +1,98 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_i2c.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#ifdef CONFIG_I2C +# include "nrf54l_i2c.h" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef CONFIG_SYSTEM_I2CTOOL +int nrf54l_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret = OK; + + i2c = nrf54l_i2cbus_initialize(bus); + if (i2c == NULL) + { + syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus); + ret = -ENODEV; + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", + bus, ret); + nrf54l_i2cbus_uninitialize(i2c); + } + } + + return ret; +} +#endif + +/**************************************************************************** + * Name: nrf54l_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef CONFIG_SYSTEM_I2CTOOL +int nrf54l_i2ctool(void) +{ + int ret = OK; + +#ifdef CONFIG_NRF54L_I2C1_MASTER + ret = nrf54l_i2c_register(1); + if (ret != OK) + { + return ret; + } +#endif + + return ret; +} +#endif diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_sensors.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_sensors.c new file mode 100644 index 00000000000..7458f478cf4 --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_sensors.c @@ -0,0 +1,156 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_sensors.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#ifdef CONFIG_SENSORS_BMI270 +# include +# include "nrf54l_spi.h" +#endif +#ifdef CONFIG_SENSORS_BME688 +# include +#endif +#ifdef CONFIG_SENSORS_ADXL367 +# include +#endif + +#include "nrf54l_i2c.h" +#include "nrf54l15-tag.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_BME688 +/**************************************************************************** + * Name: nrf54l_bme688_init + ****************************************************************************/ + +static int nrf54l_bme688_init(struct i2c_master_s *i2c) +{ + struct bme688_config_s config = + { + 0 + }; + + config.temp_os = BME688_OS_2X; +#ifndef CONFIG_BME688_DISABLE_PRESS_MEAS + config.press_os = BME688_OS_16X; +#endif +#ifndef CONFIG_BME688_DISABLE_HUM_MEAS + config.hum_os = BME688_OS_1X; +#endif +#ifdef CONFIG_BME688_ENABLE_IIR_FILTER + config.filter_coef = BME688_FILTER_COEF3; +#endif +#ifndef CONFIG_BME688_DISABLE_GAS_MEAS + config.target_temp = 300; + config.heater_duration = 100; + config.nb_conv = 0; + config.amb_temp = 30; +#endif + + return bme688_register(0, i2c, &config); +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_sensors_init + * + * Description: + * Initialize and register the onboard sensors. + * + ****************************************************************************/ + +int nrf54l_sensors_init(void) +{ +#ifdef CONFIG_SENSORS_BMI270 + struct spi_dev_s *spi; +#endif +#if defined(CONFIG_SENSORS_BME688) || defined(CONFIG_SENSORS_ADXL367) + struct i2c_master_s *i2c; +#endif + int ret = OK; + int result = OK; + +#ifdef CONFIG_SENSORS_BMI270 + spi = nrf54l_spibus_initialize(2); + if (spi == NULL) + { + ret = -ENODEV; + } + else + { +#ifdef CONFIG_SENSORS_BMI270_UORB + ret = bmi270_register_uorb(0, spi); +#else + ret = bmi270_register("/dev/bmi270", spi); +#endif + } + + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: BMI270 registration failed: %d\n", ret); + result = ret; + } +#endif + +#if defined(CONFIG_SENSORS_BME688) || defined(CONFIG_SENSORS_ADXL367) + i2c = nrf54l_i2cbus_initialize(1); + if (i2c == NULL) + { + return -ENODEV; + } + +#ifdef CONFIG_SENSORS_BME688 + ret = nrf54l_bme688_init(i2c); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: BME688 registration failed: %d\n", ret); + result = ret; + } +#endif + +#ifdef CONFIG_SENSORS_ADXL367 + ret = adxl367_register(1, i2c, 0x1d); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: ADXL367 registration failed: %d\n", ret); + result = ret; + } +#endif +#endif + + UNUSED(ret); + return result; +} diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_spi.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_spi.c new file mode 100644 index 00000000000..7b3eb9fff6c --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_spi.c @@ -0,0 +1,82 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_spi.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include "nrf54l_gpio.h" +#include "nrf54l_spi.h" +#include "nrf54l15-tag.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf54l_spidev_initialize + * + * Description: + * Configure the BMI270 chip select. + * + ****************************************************************************/ + +void nrf54l_spidev_initialize(void) +{ + nrf54l_gpio_config(GPIO_BMI270_CS); +} + +/**************************************************************************** + * Name: nrf54l_spi2select + ****************************************************************************/ + +void nrf54l_spi2select(struct spi_dev_s *dev, uint32_t devid, bool selected) +{ + spiinfo("devid: %08lx CS: %s\n", + (unsigned long)devid, selected ? "assert" : "de-assert"); + + switch (devid) + { + case SPIDEV_IMU(0): + nrf54l_gpio_write(GPIO_BMI270_CS, !selected); + break; + + default: + break; + } +} + +/**************************************************************************** + * Name: nrf54l_spi2status + ****************************************************************************/ + +uint8_t nrf54l_spi2status(struct spi_dev_s *dev, uint32_t devid) +{ + return devid == SPIDEV_IMU(0) ? SPI_STATUS_PRESENT : 0; +} diff --git a/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_userleds.c b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_userleds.c new file mode 100644 index 00000000000..fc1412acd1a --- /dev/null +++ b/boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_userleds.c @@ -0,0 +1,115 @@ +/**************************************************************************** + * boards/arm/nrf54l/nrf54l15-tag/src/nrf54l_userleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "nrf54l15-tag.h" + +#ifndef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define LED_ON 0 +#define LED_OFF 1 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const nrf54l_pinset_t g_ledcfg[BOARD_NLEDS] = +{ + GPIO_LED1, + GPIO_LED2, + GPIO_LED3, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_userled_initialize + * + * Description: + * Configure the user LEDs and return the number of available LEDs. + * + ****************************************************************************/ + +uint32_t board_userled_initialize(void) +{ + unsigned int i; + + for (i = 0; i < BOARD_NLEDS; i++) + { + nrf54l_gpio_config(g_ledcfg[i]); + } + + return BOARD_NLEDS; +} + +/**************************************************************************** + * Name: board_userled + * + * Description: + * Set the state of one user LED. + * + ****************************************************************************/ + +void board_userled(int led, bool ledon) +{ + if ((unsigned int)led < BOARD_NLEDS) + { + nrf54l_gpio_write(g_ledcfg[led], ledon ? LED_ON : LED_OFF); + } +} + +/**************************************************************************** + * Name: board_userled_all + * + * Description: + * Set all user LEDs from the supplied bit set. + * + ****************************************************************************/ + +void board_userled_all(uint32_t ledset) +{ + unsigned int i; + + for (i = 0; i < BOARD_NLEDS; i++) + { + nrf54l_gpio_write(g_ledcfg[i], (ledset & (1 << i)) ? LED_ON : LED_OFF); + } +} + +#endif /* !CONFIG_ARCH_LEDS */