zephyr/boards/arm/bbc_microbit/bbc_microbit.dts
Andrzej Głąbek 7b940cabe5 boards: bbc_microbit: Fix usage of GPIOTE channels
There are only 4 GPIOTE channels available in the nRF51 SoC that is
used in the bbc_microbit board. After the display driver for the board
has been reworked to use the nRF LED matrix display driver underneath
(see commit 44585b7fc5), 3 of those are
used for handling the display, so only 1 remains for other uses. This
causes problems with handling of buttons (as it needs GPIO interrupts
and by default the GPIO shim driver uses GPIOTE channels for their
generation) and also the SW PWM driver fails to initialize in its
default configuration (as it requires 3 GPIOTE channels for providing
3 PWM channels). And because of these problems, for example, the pong
sample does not work.

This commit addresses the problems by changing two things:
- it configures the GPIO shim driver to use the sensing mechanism
  instead of GPIOTE channels for interrupt generation for all pins
- it limits the number of available SW PWM channels to 1 (instead of
  the default 3)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-01-11 18:27:02 -05:00

162 lines
3.3 KiB
Plaintext

/*
* Copyright (c) 2017 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nordic/nrf51822_qfaa.dtsi>
/ {
model = "BBC Micro:bit";
compatible = "bbc,microbit";
/* These aliases are provided for compatibility with samples */
aliases {
sw0 = &buttonA;
sw1 = &buttonB;
};
chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,bt-mon-uart = &uart0;
zephyr,bt-c2h-uart = &uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,display = &led_matrix;
};
gpio_keys {
compatible = "gpio-keys";
buttonA: button_0 {
label = "BTN_A";
gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
};
buttonB: button_1 {
label = "BTN_B";
gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
};
};
led_matrix: led_matrix {
compatible = "nordic,nrf-led-matrix";
status = "okay";
label = "LED_MATRIX";
width = <5>;
height = <5>;
pixel-mapping = [00 13 01 14 02
23 24 25 26 27
11 08 12 28 10
07 06 05 04 03
22 16 20 15 21];
row-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>,
<&gpio0 14 GPIO_ACTIVE_HIGH>,
<&gpio0 15 GPIO_ACTIVE_HIGH>;
col-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>,
<&gpio0 5 GPIO_ACTIVE_LOW>,
<&gpio0 6 GPIO_ACTIVE_LOW>,
<&gpio0 7 GPIO_ACTIVE_LOW>,
<&gpio0 8 GPIO_ACTIVE_LOW>,
<&gpio0 9 GPIO_ACTIVE_LOW>,
<&gpio0 10 GPIO_ACTIVE_LOW>,
<&gpio0 11 GPIO_ACTIVE_LOW>,
<&gpio0 12 GPIO_ACTIVE_LOW>;
refresh-frequency = <50>;
timer = <&timer2>;
pixel-group-size = <3>;
};
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
/*
* Use the sensing mechanism for all pins by default, as GPIOTE channels
* are needed for the LED matrix and the SW PWM.
*/
sense-edge-mask = <0xffffffff>;
};
&sw_pwm {
channel-count = <1>;
};
&uart0 {
status = "okay";
current-speed = <115200>;
tx-pin = <24>;
rx-pin = <25>;
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
sda-pin = <30>;
scl-pin = <0>;
/* See https://tech.microbit.org/hardware/i2c/ for board variants */
/* v1.3 MMA8653FC (= FXOS8700) + MAG3110 */
mma8653fc@1d {
compatible = "nxp,fxos8700", "nxp,mma8653fc";
status = "okay";
reg = <0x1d>;
label = "MMA8653FC";
int1-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
int2-gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
};
/* v1.5 variant 1 LSM303AGR */
lsm303agr-magn@1e {
compatible = "st,lis2mdl", "st,lsm303agr-magn";
status = "disabled";
reg = <0x1e>;
label = "LSM303AGR-MAGN";
irq-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; /* A3 */
};
lsm303agr-accel@19 {
compatible = "st,lis2dh", "st,lsm303agr-accel";
status = "disabled";
reg = <0x19>;
label = "LSM303AGR-ACCEL";
irq-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x8000>;
};
slot0_partition: partition@8000 {
label = "image-0";
reg = <0x00008000 0x1a000>;
};
slot1_partition: partition@22000 {
label = "image-1";
reg = <0x00022000 0x1a000>;
};
scratch_partition: partition@3c000 {
label = "image-scratch";
reg = <0x0003c000 0x2000>;
};
storage_partition: partition@3e000 {
label = "storage";
reg = <0x0003e000 0x00002000>;
};
};
};