-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
wip: nrf9131ek board files #12080
Closed
Closed
wip: nrf9131ek board files #12080
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8f3deea
wip: nrf9131ek board files
maxd-nordic 324a3fc
enable regulator by default
maxd-nordic 7798a2e
enable charging
maxd-nordic 0b77adb
wip: spi flash
maxd-nordic 9342371
workaround for npm1300
maxd-nordic 4389286
get flash info using jesd216 sample
maxd-nordic 2516805
some renamings
maxd-nordic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) 2023 Nordic Semiconductor ASA. | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
|
||
if (CONFIG_BOARD_NRF9131EK_NRF9131 OR CONFIG_BOARD_NRF9131EK_NRF9131_NS) | ||
zephyr_library() | ||
zephyr_library_sources(npm1300.c) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# nRF9131-EK board configuration | ||
# | ||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
|
||
if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS | ||
|
||
config BOARD_INIT_PRIORITY | ||
int "Initialization priority for board configuration" | ||
default 80 | ||
|
||
endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS | ||
|
||
module=BOARD | ||
module-dep=LOG | ||
module-str=Log level for board | ||
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# nRF9131-EK board configuration | ||
|
||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SOC_NRF9161_SICA | ||
|
||
config BOARD_NRF9131EK_NRF9131 | ||
bool "nRF9131 EK NRF9131" | ||
|
||
config BOARD_NRF9131EK_NRF9131_NS | ||
bool "nRF9131 EK NRF9131 non-secure" | ||
|
||
endif # SOC_NRF9161_SICA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# nRF9131 EK NRF9131 board configuration | ||
|
||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS | ||
|
||
config BOARD | ||
default "nrf9131ek_nrf9131" | ||
|
||
# By default, if we build for a Non-Secure version of the board, | ||
# enable building with TF-M as the Secure Execution Environment. | ||
config BUILD_WITH_TFM | ||
default y if BOARD_NRF9131EK_NRF9131_NS | ||
|
||
if BUILD_WITH_TFM | ||
|
||
# By default, if we build with TF-M, instruct build system to | ||
# flash the combined TF-M (Secure) & Zephyr (Non Secure) image | ||
config TFM_FLASH_MERGED_BINARY | ||
bool | ||
default y | ||
|
||
endif # BUILD_WITH_TFM | ||
|
||
# For the secure version of the board the firmware is linked at the beginning | ||
# of the flash, or into the code-partition defined in DT if it is intended to | ||
# be loaded by MCUboot. If the secure firmware is to be combined with a non- | ||
# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always | ||
# be restricted to the size of its code partition. | ||
# For the non-secure version of the board, the firmware | ||
# must be linked into the code-partition (non-secure) defined in DT, regardless. | ||
# Apply this configuration below by setting the Kconfig symbols used by | ||
# the linker according to the information extracted from DT partitions. | ||
|
||
# Workaround for not being able to have commas in macro arguments | ||
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition | ||
|
||
config FLASH_LOAD_SIZE | ||
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) | ||
depends on BOARD_NRF9131EK_NRF9131 && TRUSTED_EXECUTION_SECURE | ||
|
||
if BOARD_NRF9131EK_NRF9131_NS | ||
|
||
config FLASH_LOAD_OFFSET | ||
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) | ||
|
||
config FLASH_LOAD_SIZE | ||
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) | ||
|
||
endif # BOARD_NRF9131EK_NRF9131_NS | ||
|
||
config BT_HCI_VS | ||
default y if BT | ||
|
||
config BT_WAIT_NOP | ||
default BT && $(dt_nodelabel_enabled,nrf5340_reset) | ||
|
||
config I2C | ||
default $(dt_compat_on_bus,$(DT_COMPAT_NXP_PCAL6408A),i2c) | ||
|
||
endif # BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if(CONFIG_BOARD_NRF9131EK_NRF9131_NS) | ||
set(TFM_PUBLIC_KEY_FORMAT "full") | ||
endif() | ||
|
||
if(CONFIG_TFM_FLASH_MERGED_BINARY) | ||
set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) | ||
endif() | ||
|
||
# TODO: change to nRF9131_xxAA when such device is available in JLink | ||
board_runner_args(jlink "--device=nRF9160_xxAA" "--speed=4000") | ||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2023 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/init.h> | ||
#include <zephyr/logging/log.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/drivers/i2c.h> | ||
|
||
LOG_MODULE_REGISTER(board_secure, CONFIG_BOARD_LOG_LEVEL); | ||
|
||
#define CHECKERR if (err) {LOG_ERR("I2C error: %d", err); return err;} | ||
|
||
static const struct i2c_dt_spec pmic = I2C_DT_SPEC_GET(DT_NODELABEL(pmic_main)); | ||
|
||
static int pmic_write_reg(uint16_t address, uint8_t value) | ||
{ | ||
uint8_t buf[] = { | ||
address >> 8, | ||
address & 0xFF, | ||
value, | ||
}; | ||
|
||
return i2c_write_dt(&pmic, buf, ARRAY_SIZE(buf)); | ||
} | ||
|
||
static int thingy91x_board_init(void) | ||
{ | ||
int err = 0; | ||
|
||
if (!device_is_ready(pmic.bus)) { | ||
LOG_ERR("cannot reach PMIC!"); | ||
return -ENODEV; | ||
} | ||
|
||
// disable charger for config | ||
err = pmic_write_reg(0x0305, 0x03); CHECKERR; | ||
|
||
// set VBUS current limit 500mA | ||
Check failure on line 42 in boards/arm/nrf9131ek_nrf9131/npm1300.c GitHub Actions / Run compliance checks on patch series (PR)TRAILING_WHITESPACE
|
||
err = pmic_write_reg(0x0201, 0x00); CHECKERR; | ||
err = pmic_write_reg(0x0202, 0x00); CHECKERR; | ||
err = pmic_write_reg(0x0200, 0x01); CHECKERR; | ||
|
||
// enable charger | ||
err = pmic_write_reg(0x0304, 0x03); CHECKERR; | ||
|
||
return err; | ||
} | ||
|
||
SYS_INIT(thingy91x_board_init, POST_KERNEL, CONFIG_BOARD_INIT_PRIORITY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2023 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
#include <nordic/nrf9161_sica.dtsi> | ||
#include "nrf9131ek_nrf9131_common.dtsi" | ||
|
||
/ { | ||
chosen { | ||
zephyr,sram = &sram0_s; | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &slot0_partition; | ||
zephyr,sram-secure-partition = &sram0_s; | ||
zephyr,sram-non-secure-partition = &sram0_ns; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
identifier: nrf9131ek_nrf9131 | ||
name: nRF9131-DK-NRF9131 | ||
type: mcu | ||
arch: arm | ||
toolchain: | ||
- gnuarmemb | ||
- xtools | ||
- zephyr | ||
ram: 88 | ||
flash: 1024 | ||
supported: | ||
- arduino_gpio | ||
- arduino_i2c | ||
- arduino_serial | ||
- arduino_spi | ||
- gpio | ||
- i2c | ||
- pwm | ||
- spi | ||
- watchdog | ||
- counter |
100 changes: 100 additions & 0 deletions
100
boards/arm/nrf9131ek_nrf9131/nrf9131ek_nrf9131_common-pinctrl.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright (c) 2023 Nordic Semiconductor | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&pinctrl { | ||
uart0_default: uart0_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 11)>, | ||
<NRF_PSEL(UART_RTS, 0, 10)>; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_RX, 0, 12)>, | ||
<NRF_PSEL(UART_CTS, 0, 9)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart0_sleep: uart0_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 11)>, | ||
<NRF_PSEL(UART_RX, 0, 12)>, | ||
<NRF_PSEL(UART_RTS, 0, 10)>, | ||
<NRF_PSEL(UART_CTS, 0, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
uart1_default: uart1_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 24)>, | ||
<NRF_PSEL(UART_RTS, 0, 25)>; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_RX, 0, 23)>, | ||
<NRF_PSEL(UART_CTS, 0, 17)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart1_sleep: uart1_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 24)>, | ||
<NRF_PSEL(UART_RX, 0, 23)>, | ||
<NRF_PSEL(UART_RTS, 0, 25)>, | ||
<NRF_PSEL(UART_CTS, 0, 17)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
i2c2_default: i2c2_default { | ||
group1 { | ||
psels = <NRF_PSEL(TWIM_SDA, 0, 8)>, | ||
<NRF_PSEL(TWIM_SCL, 0, 7)>; | ||
}; | ||
}; | ||
|
||
i2c2_sleep: i2c2_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(TWIM_SDA, 0, 8)>, | ||
<NRF_PSEL(TWIM_SCL, 0, 7)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
pwm0_default: pwm0_default { | ||
group1 { | ||
psels = <NRF_PSEL(PWM_OUT0, 0, 29)>, | ||
<NRF_PSEL(PWM_OUT1, 0, 30)>, | ||
<NRF_PSEL(PWM_OUT2, 0, 31)>; | ||
}; | ||
}; | ||
|
||
pwm0_sleep: pwm0_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(PWM_OUT0, 0, 29)>, | ||
<NRF_PSEL(PWM_OUT1, 0, 30)>, | ||
<NRF_PSEL(PWM_OUT2, 0, 31)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
spi3_default: spi3_default { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>, | ||
<NRF_PSEL(SPIM_MISO, 0, 22)>, | ||
<NRF_PSEL(SPIM_MOSI, 0, 21)>; | ||
nordic,drive-mode = <NRF_DRIVE_H0H1>; | ||
}; | ||
}; | ||
|
||
spi3_sleep: spi3_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>, | ||
<NRF_PSEL(SPIM_MISO, 0, 22)>, | ||
<NRF_PSEL(SPIM_MOSI, 0, 21)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should there be a new SOC also?
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.
good question! technically, it shouldn't be necessary, but it could be for documentation reasons. we could also nename nRF9161 to nRF91X1. Who would decide this?