Skip to content

Commit f4a2683

Browse files
bwasimcarlescufi
authored andcommitted
boards/arm: Adding Contextual Electronics Advanced BLE Cell board to Zephyr
This commit adds supports for the nRF52840 based BLE Cell board from Contextual Electronics. This board contains support for BG95 Modem, BQ52895 charger, SD card etc and can be used as a PI Hat. In this commit, this board supports UART, I2C, SPI, Modem. Support for charger, SD card and other things will be added later. Signed-off-by: Bilal Wasim <[email protected]>
1 parent 6297c66 commit f4a2683

File tree

9 files changed

+372
-0
lines changed

9 files changed

+372
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ABC board configuration
2+
3+
# Copyright (c) 2020 Analog Life LLC
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ENABLE_DCDC
7+
bool "Enable DCDC mode"
8+
select SOC_DCDC_NRF52X
9+
default y
10+
depends on BOARD_CONTEXTELEC_ABC
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ABC board configuration
2+
3+
# Copyright (c) 2020 Analog Life LLC
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_CONTEXTELEC_ABC
7+
bool "nRF52840 based Advanced BLE Cell"
8+
depends on SOC_NRF52840_QIAA
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# nRF52840 BLE Cell board configuration
2+
3+
# Copyright (c) 2020 Bilal Wasim
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_CONTEXTELEC_ABC
7+
8+
config BOARD
9+
default "nrf52840_ble_cell"
10+
11+
if USB
12+
13+
config USB_NRFX
14+
default y
15+
16+
config USB_DEVICE_STACK
17+
default y
18+
19+
endif # USB
20+
21+
config BT_CTLR
22+
default BT
23+
24+
endif # BOARD_CONTEXTELEC_ABC
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
set (OPENOCD_NRF5_SUBFAMILY "nrf52")
4+
board_runner_args(jlink "--device=nrf52" "--speed=4000")
5+
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
6+
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
7+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
8+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/*
2+
* Copyright (c) 2020 Analog Life LLC
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <nordic/nrf52840_qiaa.dtsi>
9+
10+
/ {
11+
model = "nRF52840 BLE Cell";
12+
compatible = "nordic,nrf52840-ble-cell";
13+
14+
chosen {
15+
zephyr,console = &uart0;
16+
zephyr,shell-uart = &uart0;
17+
zephyr,sram = &sram0;
18+
zephyr,flash = &flash0;
19+
zephyr,code-partition = &slot0_partition;
20+
};
21+
};
22+
23+
&gpiote {
24+
status = "okay";
25+
};
26+
27+
&gpio0 {
28+
status = "okay";
29+
};
30+
31+
&gpio1 {
32+
status = "okay";
33+
};
34+
35+
&uart0 {
36+
compatible = "nordic,nrf-uart";
37+
status = "okay";
38+
current-speed = <115200>;
39+
40+
tx-pin = <7>;
41+
rx-pin = <6>;
42+
};
43+
44+
arduino_serial: &uart1 {
45+
status = "okay";
46+
current-speed = <115200>;
47+
48+
/* UART Pin info. */
49+
rx-pin = <20>;
50+
tx-pin = <24>;
51+
rts-pin = <17>;
52+
cts-pin = <16>;
53+
54+
/* Use hardware flow control. */
55+
hw-flow-control;
56+
57+
/* BG9x description. */
58+
quectel_bg9x {
59+
compatible = "quectel,bg9x";
60+
label = "quectel-bg9x";
61+
status = "okay";
62+
63+
mdm-power-gpios = <&gpio1 5 0>;
64+
mdm-reset-gpios = <&gpio1 6 0>;
65+
mdm-dtr-gpios = <&gpio0 22 0>;
66+
};
67+
};
68+
69+
arduino_i2c: &i2c0 {
70+
compatible = "nordic,nrf-twi";
71+
status = "okay";
72+
sda-pin = <27>;
73+
scl-pin = <26>;
74+
};
75+
76+
&spi2 {
77+
compatible = "nordic,nrf-spi";
78+
status = "okay";
79+
sck-pin = <19>;
80+
mosi-pin = <23>;
81+
miso-pin = <21>;
82+
83+
/* This SPI device is interfaced with the SD card. */
84+
};
85+
86+
&flash0 {
87+
88+
partitions {
89+
compatible = "fixed-partitions";
90+
#address-cells = <1>;
91+
#size-cells = <1>;
92+
93+
boot_partition: partition@0 {
94+
label = "mcuboot";
95+
reg = <0x000000000 0x0000C000>;
96+
};
97+
slot0_partition: partition@c000 {
98+
label = "image-0";
99+
reg = <0x0000C000 0x00067000>;
100+
};
101+
slot1_partition: partition@73000 {
102+
label = "image-1";
103+
reg = <0x00073000 0x00067000>;
104+
};
105+
scratch_partition: partition@da000 {
106+
label = "image-scratch";
107+
reg = <0x000da000 0x0001e000>;
108+
};
109+
110+
/*
111+
* The flash starting at 0x000f8000 and ending at
112+
* 0x000fffff is reserved for use by the application.
113+
*/
114+
115+
/*
116+
* Storage partition will be used by FCB/LittleFS/NVS
117+
* if enabled.
118+
*/
119+
storage_partition: partition@f8000 {
120+
label = "storage";
121+
reg = <0x000f8000 0x00008000>;
122+
};
123+
};
124+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
identifier: contextualelectronics_abc
2+
name: contextualelectronics_abc
3+
type: mcu
4+
arch: arm
5+
ram: 256
6+
flash: 1024
7+
toolchain:
8+
- zephyr
9+
- gnuarmemb
10+
- xtools
11+
supported:
12+
- arduino_i2c
13+
- arduino_spi
14+
- gpio
15+
- i2c
16+
- spi
17+
- netif:openthread
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
CONFIG_SOC_SERIES_NRF52X=y
4+
CONFIG_SOC_NRF52840_QIAA=y
5+
CONFIG_BOARD_CONTEXTELEC_ABC=y
6+
7+
# Enable MPU
8+
CONFIG_ARM_MPU=y
9+
10+
# Enable hardware stack protection
11+
CONFIG_HW_STACK_PROTECTION=y
12+
13+
# Enable GPIO
14+
CONFIG_GPIO=y
15+
16+
# Enable uart driver
17+
CONFIG_SERIAL=y
18+
19+
# Enable console
20+
CONFIG_CONSOLE=y
21+
CONFIG_UART_CONSOLE=y
22+
23+
# Additional board options
24+
CONFIG_GPIO_AS_PINRESET=y
681 KB
Loading
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
.. _contextualelectronics_abc:
2+
3+
Contextual Eletronics Advanced BLE Cell
4+
#######################################
5+
6+
Overview
7+
********
8+
9+
The Contextual Eletronics ABC (PCA10056) hardware provides support for the
10+
Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices:
11+
12+
* CLOCK
13+
* FLASH
14+
* :abbr:`GPIO (General Purpose Input Output)`
15+
* :abbr:`I2C (Inter-Integrated Circuit)`
16+
* :abbr:`MPU (Memory Protection Unit)`
17+
* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
18+
* :abbr:`PWM (Pulse Width Modulation)`
19+
* Segger RTT (RTT Console)
20+
* :abbr:`SPI (Serial Peripheral Interface)`
21+
* :abbr:`UART (Universal asynchronous receiver-transmitter)`
22+
* Quectel BG95 Modem
23+
24+
.. figure:: img/contextualelectronics_abc.jpg
25+
:width: 2046px
26+
:align: center
27+
:alt: Contextual Electronics Advanced BLE Cell
28+
29+
Contextual Electronics Advanced BLE Cell (Credit: Chris Gamell)
30+
31+
More information about the board can be found at the `ABC Board website`_.
32+
The `Nordic Semiconductor Infocenter`_ contains the processor's information
33+
and the datasheet.
34+
35+
Hardware
36+
********
37+
38+
ABC board has two external oscillators. The frequency of the slow clock
39+
is 32.768 kHz. The frequency of the main clock is 32 MHz.
40+
41+
- nRF52840 ARM Cortex-M4F processor at 64 MHz
42+
- 1 MB flash memory and 256 KB of SRAM
43+
- SWD connector
44+
45+
Supported Features
46+
==================
47+
48+
The contextualelectronics_abc board configuration supports the following
49+
hardware features:
50+
51+
+-----------+------------+----------------------+
52+
| Interface | Controller | Driver/Component |
53+
+===========+============+======================+
54+
| CLOCK | on-chip | clock_control |
55+
+-----------+------------+----------------------+
56+
| FLASH | on-chip | flash |
57+
+-----------+------------+----------------------+
58+
| GPIO | on-chip | gpio |
59+
+-----------+------------+----------------------+
60+
| I2C(M) | on-chip | i2c |
61+
+-----------+------------+----------------------+
62+
| MPU | on-chip | arch/arm |
63+
+-----------+------------+----------------------+
64+
| NVIC | on-chip | arch/arm |
65+
+-----------+------------+----------------------+
66+
| PWM | on-chip | pwm |
67+
+-----------+------------+----------------------+
68+
| RTC | on-chip | system clock |
69+
+-----------+------------+----------------------+
70+
| RTT | Segger | console |
71+
+-----------+------------+----------------------+
72+
| SPI(M) | on-chip | spi |
73+
+-----------+------------+----------------------+
74+
| UART | on-chip | serial |
75+
+-----------+------------+----------------------+
76+
| Modem | on-board | quectel_bg9x |
77+
+-----------+------------+----------------------+
78+
79+
Other hardware features are not supported by the Zephyr kernel.
80+
See `ABC Board website`_ for more details on this board, and
81+
`Nordic Semiconductor Infocenter`_ for a complete list of SoC
82+
features.
83+
84+
Programming and Debugging
85+
*************************
86+
87+
Applications for the ``contextualelectronics_abc`` board configuration can be
88+
built and flashed in the usual way (see :ref:`build_an_application`
89+
and :ref:`application_run` for more details).
90+
91+
Flashing
92+
========
93+
94+
Flashing Zephyr onto the ``contextualelectronics_abc`` board requires
95+
an external programmer. The programmer is attached to the SWD header.
96+
97+
Build the Zephyr kernel and the :ref:`hello_world` sample application.
98+
99+
.. zephyr-app-commands::
100+
:zephyr-app: samples/hello_world
101+
:board: contextualelectronics_abc
102+
:goals: build
103+
:compact:
104+
105+
Flash the image.
106+
107+
.. zephyr-app-commands::
108+
:zephyr-app: samples/hello_world
109+
:board: contextualelectronics_abc
110+
:goals: flash
111+
:compact:
112+
113+
To see the output, run your favorite terminal program.
114+
115+
.. code-block:: console
116+
117+
$ minicom -D <tty_device> -b 115200
118+
119+
Replace :code:`<tty_device>` with the port where the ABC board
120+
can be found. For example, under Linux, :code:`/dev/ttyACM0`.
121+
122+
Debugging
123+
=========
124+
125+
Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards with a
126+
Segger IC.
127+
128+
Selecting the pins
129+
==================
130+
To select the pin numbers for tx-pin and rx-pin:
131+
132+
.. code-block:: console
133+
134+
tx-pin = <pin_no>
135+
136+
Open the `nRF52840 Product Specification`_, chapter 7 'Hardware and Layout'.
137+
In the table 7.1.1 'aQFN73 ball assignments' select the pins marked
138+
'General purpose I/O'. Note that pins marked as 'low frequency I/O only' can only be used
139+
in under-10KHz applications. They are not suitable for 115200 speed of UART.
140+
141+
Translate the 'Pin' into number for devicetree by using the following formula::
142+
143+
pin_no = b\*32 + a
144+
145+
where ``a`` and ``b`` are from the Pin value in the table (Pb.a).
146+
For example, for P0.1, ``pin_no = 1`` and for P1.0, ``pin_no = 32``.
147+
148+
References
149+
**********
150+
151+
.. target-notes::
152+
153+
.. _ABC Board website: https://contextualelectronics.com/courses/advanced-ble-cell-abc-board/
154+
.. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com
155+
.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html
156+
.. _nRF52840 Product Specification: http://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.0.pdf

0 commit comments

Comments
 (0)