boards: arm: nrf52833dk_nrf52833: 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
2306318688
commit
1ee660dbcc
4 changed files with 192 additions and 41 deletions
|
@ -165,15 +165,32 @@ more than one UART for connecting peripheral devices:
|
|||
|
||||
1. Add devicetree 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 nrf52833dk_nrf52833.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
|
||||
|
@ -184,24 +201,13 @@ See :ref:`set-devicetree-overlays` for further details.
|
|||
|
||||
Selecting the pins
|
||||
==================
|
||||
To select the pin numbers for tx-pin and rx-pin:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
tx-pin = <pin_no>
|
||||
|
||||
Open the `nRF52833 Product Specification`_, chapter 7 'Hardware and Layout'.
|
||||
Pins can be configured in the board pinctrl file. To see the available mappings,
|
||||
open the `nRF52833 Product Specification`_, chapter 7 'Hardware and Layout'.
|
||||
In the table 7.1.1 'aQFN73 ball assignments' select the pins marked
|
||||
'General purpose I/O'. Note that pins marked as 'low frequency I/O only' can only be used
|
||||
in under-10KHz applications. They are not suitable for 115200 speed of UART.
|
||||
|
||||
Translate the 'Pin' into number for devicetree 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``.
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
|
|
142
boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833-pinctrl.dtsi
Normal file
142
boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833-pinctrl.dtsi
Normal file
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Nordic Semiconductor
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
&pinctrl {
|
||||
uart0_default: uart0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 0, 6)>,
|
||||
<NRF_PSEL(UART_RTS, 0, 5)>;
|
||||
};
|
||||
group2 {
|
||||
psels = <NRF_PSEL(UART_RX, 0, 8)>,
|
||||
<NRF_PSEL(UART_CTS, 0, 7)>;
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
|
||||
uart0_sleep: uart0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 0, 6)>,
|
||||
<NRF_PSEL(UART_RX, 0, 8)>,
|
||||
<NRF_PSEL(UART_RTS, 0, 5)>,
|
||||
<NRF_PSEL(UART_CTS, 0, 7)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
uart1_default: uart1_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_RX, 1, 1)>;
|
||||
bias-pull-up;
|
||||
};
|
||||
group2 {
|
||||
psels = <NRF_PSEL(UART_TX, 1, 2)>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1_sleep: uart1_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_RX, 1, 1)>,
|
||||
<NRF_PSEL(UART_TX, 1, 2)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
i2c0_default: i2c0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
|
||||
<NRF_PSEL(TWIM_SCL, 0, 27)>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c0_sleep: i2c0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
|
||||
<NRF_PSEL(TWIM_SCL, 0, 27)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
i2c1_default: i2c1_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
|
||||
<NRF_PSEL(TWIM_SCL, 0, 31)>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c1_sleep: i2c1_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
|
||||
<NRF_PSEL(TWIM_SCL, 0, 31)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
pwm0_default: pwm0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
|
||||
nordic,invert;
|
||||
};
|
||||
};
|
||||
|
||||
pwm0_sleep: pwm0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi0_default: spi0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 26)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 29)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi0_sleep: spi0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 26)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 29)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi1_default: spi1_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 30)>,
|
||||
<NRF_PSEL(SPIM_MISO, 1, 8)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi1_sleep: spi1_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 30)>,
|
||||
<NRF_PSEL(SPIM_MISO, 1, 8)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi3_default: spi3_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 23)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 22)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 21)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi3_sleep: spi3_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 23)>,
|
||||
<NRF_PSEL(SPIM_MISO, 0, 22)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 21)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
/dts-v1/;
|
||||
#include <nordic/nrf52833_qiaa.dtsi>
|
||||
#include "nrf52833dk_nrf52833-pinctrl.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Nordic nRF52833 DK NRF52833";
|
||||
|
@ -133,66 +134,66 @@
|
|||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
tx-pin = <6>;
|
||||
rx-pin = <8>;
|
||||
rx-pull-up;
|
||||
rts-pin = <5>;
|
||||
cts-pin = <7>;
|
||||
cts-pull-up;
|
||||
pinctrl-0 = <&uart0_default>;
|
||||
pinctrl-1 = <&uart0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
arduino_serial: &uart1 {
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
rx-pin = <33>;
|
||||
rx-pull-up;
|
||||
tx-pin = <34>;
|
||||
pinctrl-0 = <&uart1_default>;
|
||||
pinctrl-1 = <&uart1_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
arduino_i2c: &i2c0 {
|
||||
compatible = "nordic,nrf-twi";
|
||||
status = "okay";
|
||||
sda-pin = <26>;
|
||||
scl-pin = <27>;
|
||||
pinctrl-0 = <&i2c0_default>;
|
||||
pinctrl-1 = <&i2c0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
compatible = "nordic,nrf-twi";
|
||||
/* Cannot be used together with spi1. */
|
||||
/* status = "okay"; */
|
||||
sda-pin = <30>;
|
||||
scl-pin = <31>;
|
||||
pinctrl-0 = <&i2c1_default>;
|
||||
pinctrl-1 = <&i2c1_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&pwm0 {
|
||||
status = "okay";
|
||||
ch0-pin = <13>;
|
||||
ch0-inverted;
|
||||
pinctrl-0 = <&pwm0_default>;
|
||||
pinctrl-1 = <&pwm0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
compatible = "nordic,nrf-spi";
|
||||
/* Cannot be used together with i2c0. */
|
||||
/* status = "okay"; */
|
||||
sck-pin = <27>;
|
||||
mosi-pin = <26>;
|
||||
miso-pin = <29>;
|
||||
pinctrl-0 = <&spi0_default>;
|
||||
pinctrl-1 = <&spi0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
compatible = "nordic,nrf-spi";
|
||||
status = "okay";
|
||||
sck-pin = <31>;
|
||||
mosi-pin = <30>;
|
||||
miso-pin = <40>;
|
||||
pinctrl-0 = <&spi1_default>;
|
||||
pinctrl-1 = <&spi1_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
arduino_spi: &spi3 {
|
||||
status = "okay";
|
||||
sck-pin = <23>;
|
||||
miso-pin = <22>;
|
||||
mosi-pin = <21>;
|
||||
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
|
||||
pinctrl-0 = <&spi3_default>;
|
||||
pinctrl-1 = <&spi3_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -25,3 +25,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