boards: arm: ubx_evkninab3_nrf52840: migrate to pinctrl
Use pinctrl instead of `-pin` properties. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
c84e911649
commit
c81b319e79
4 changed files with 134 additions and 35 deletions
|
@ -272,15 +272,32 @@ more than one UART for connecting peripheral devices:
|
|||
|
||||
1. Add device tree overlay file to the main directory of your application:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: devicetree
|
||||
|
||||
&pinctrl {
|
||||
uart1_default: uart1_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 0, 14)>,
|
||||
<NRF_PSEL(UART_RX, 0, 16)>;
|
||||
};
|
||||
};
|
||||
/* required if CONFIG_PM_DEVICE=y */
|
||||
uart1_sleep: uart1_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 0, 14)>,
|
||||
<NRF_PSEL(UART_RX, 0, 16)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
$ cat ubx_evkninab3_nrf52840.overlay
|
||||
&uart1 {
|
||||
compatible = "nordic,nrf-uarte";
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
tx-pin = <14>;
|
||||
rx-pin = <16>;
|
||||
pinctrl-0 = <&uart1_default>;
|
||||
pinctrl-1 = <&uart1_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
In the overlay file above, pin P0.16 is used for RX and P0.14 is used for TX
|
||||
|
@ -295,23 +312,12 @@ picked up automatically by the device tree compiler.
|
|||
|
||||
Selecting the pins
|
||||
==================
|
||||
To select the pin numbers for tx-pin and rx-pin:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
tx-pin = <pin_no>
|
||||
|
||||
Open the data sheet for the NINA-B3 at `u-blox website`_, Section 3 'Pin definition'.
|
||||
Pins can be configured in the board pinctrl file. To see the available mappings,
|
||||
open the data sheet for the NINA-B3 at `u-blox website`_, Section 3 'Pin definition'.
|
||||
In the table 7 select the pins marked 'GPIO_xx'. Note that pins marked as 'Radio sensitive pin'
|
||||
can only be used in under-10KHz applications. They are not suitable for 115200 speed of UART.
|
||||
|
||||
Translate 'Pin' into number for Device tree by using the following formula::
|
||||
|
||||
pin_no = b\*32 + a
|
||||
|
||||
where ``a`` and ``b`` are from the Pin value in the table (Pb.a).
|
||||
For example, for P0.1, ``pin_no = 1`` and for P1.0, ``pin_no = 32``.
|
||||
|
||||
.. note:
|
||||
Pins are defined according to the "nRF52" pin number, not the module pad number.
|
||||
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Nordic Semiconductor
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
&pinctrl {
|
||||
uart0_default: uart0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 1, 13)>,
|
||||
<NRF_PSEL(UART_RX, 0, 29)>,
|
||||
<NRF_PSEL(UART_RTS, 0, 31)>,
|
||||
<NRF_PSEL(UART_CTS, 1, 12)>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0_sleep: uart0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 1, 13)>,
|
||||
<NRF_PSEL(UART_RX, 0, 29)>,
|
||||
<NRF_PSEL(UART_RTS, 0, 31)>,
|
||||
<NRF_PSEL(UART_CTS, 1, 12)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
i2c0_default: i2c0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(TWIM_SDA, 0, 16)>,
|
||||
<NRF_PSEL(TWIM_SCL, 0, 24)>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c0_sleep: i2c0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(TWIM_SDA, 0, 16)>,
|
||||
<NRF_PSEL(TWIM_SCL, 0, 24)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi0_default: spi0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 7)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 1, 0)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 15)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi0_sleep: spi0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 7)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 1, 0)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 15)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi1_default: spi1_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 28)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 9)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi1_sleep: spi1_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 28)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 9)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
pwm0_default: pwm0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(PWM_OUT0, 0, 13)>,
|
||||
<NRF_PSEL(PWM_OUT1, 1, 0)>,
|
||||
<NRF_PSEL(PWM_OUT2, 0, 25)>;
|
||||
nordic,invert;
|
||||
};
|
||||
};
|
||||
|
||||
pwm0_sleep: pwm0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(PWM_OUT0, 0, 13)>,
|
||||
<NRF_PSEL(PWM_OUT1, 1, 0)>,
|
||||
<NRF_PSEL(PWM_OUT2, 0, 25)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
/dts-v1/;
|
||||
#include <nordic/nrf52840_qiaa.dtsi>
|
||||
#include "ubx_evkninab3_nrf52840-pinctrl.dtsi"
|
||||
|
||||
/ {
|
||||
model = "u-blox EVK NINA-B3 nRF52840";
|
||||
|
@ -141,44 +142,41 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <45>;
|
||||
rx-pin = <29>;
|
||||
rts-pin = <31>;
|
||||
cts-pin = <44>;
|
||||
pinctrl-0 = <&uart0_default>;
|
||||
pinctrl-1 = <&uart0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
arduino_i2c: &i2c0 {
|
||||
compatible = "nordic,nrf-twi";
|
||||
status = "okay";
|
||||
sda-pin = <16>;
|
||||
scl-pin = <24>;
|
||||
pinctrl-0 = <&i2c0_default>;
|
||||
pinctrl-1 = <&i2c0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
compatible = "nordic,nrf-spi";
|
||||
/* Cannot be used together with i2c0. */
|
||||
/* status = "okay"; */
|
||||
sck-pin = <7>;
|
||||
mosi-pin = <32>;
|
||||
miso-pin = <15>;
|
||||
pinctrl-0 = <&spi0_default>;
|
||||
pinctrl-1 = <&spi0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
sck-pin = <3>;
|
||||
mosi-pin = <28>;
|
||||
miso-pin = <9>;
|
||||
pinctrl-0 = <&spi1_default>;
|
||||
pinctrl-1 = <&spi1_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&pwm0 {
|
||||
status = "okay";
|
||||
ch0-pin = <13>;
|
||||
ch0-inverted;
|
||||
ch1-pin = <32>;
|
||||
ch1-inverted;
|
||||
ch2-pin = <25>;
|
||||
ch2-inverted;
|
||||
pinctrl-0 = <&pwm0_default>;
|
||||
pinctrl-1 = <&pwm0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -28,3 +28,5 @@ CONFIG_UART_CONSOLE=y
|
|||
|
||||
# additional board options
|
||||
CONFIG_GPIO_AS_PINRESET=y
|
||||
|
||||
CONFIG_PINCTRL=y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue