1.. zephyr:board:: nrf52840_papyr
2
3Overview
4********
5
6Zephyr applications use the nrf52840_papyr board configuration
7to run on Electronut Labs Papyr hardware. It provides
8support for the Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and
9the following devices:
10
11* :abbr:`ADC (Analog to Digital Converter)`
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* RADIO (Bluetooth Low Energy and 802.15.4)
20* :abbr:`RTC (nRF RTC System Clock)`
21* :abbr:`SPI (Serial Peripheral Interface)`
22* :abbr:`UART (Universal asynchronous receiver-transmitter)`
23* :abbr:`USB (Universal Serial Bus)`
24* :abbr:`WDT (Watchdog Timer)`
25* COUNTER
26
27More information about the board is available at https://gitlab.com/electronutlabs-public/papyr.
28
29Hardware
30********
31
32Papyr has two external oscillators. The frequency of
33the slow clock is 32.768 kHz. The frequency of the main clock
34is 32 MHz.
35
36Supported Features
37==================
38
39The nrf52840_papyr board configuration supports the following
40hardware features currently:
41
42+-----------+------------+----------------------+
43| Interface | Controller | Driver/Component     |
44+===========+============+======================+
45| ADC       | on-chip    | adc                  |
46+-----------+------------+----------------------+
47| CLOCK     | on-chip    | clock_control        |
48+-----------+------------+----------------------+
49| FLASH     | on-chip    | flash                |
50+-----------+------------+----------------------+
51| GPIO      | on-chip    | gpio                 |
52+-----------+------------+----------------------+
53| I2C(M)    | on-chip    | i2c                  |
54+-----------+------------+----------------------+
55| MPU       | on-chip    | arch/arm             |
56+-----------+------------+----------------------+
57| NVIC      | on-chip    | arch/arm             |
58+-----------+------------+----------------------+
59| PWM       | on-chip    | pwm                  |
60+-----------+------------+----------------------+
61| RADIO     | on-chip    | Bluetooth,           |
62|           |            | ieee802154           |
63+-----------+------------+----------------------+
64| RTC       | on-chip    | system clock         |
65+-----------+------------+----------------------+
66| SPI(M/S)  | on-chip    | spi                  |
67+-----------+------------+----------------------+
68| UART      | on-chip    | serial               |
69+-----------+------------+----------------------+
70| USB       | on-chip    | usb                  |
71+-----------+------------+----------------------+
72| WDT       | on-chip    | watchdog             |
73+-----------+------------+----------------------+
74
75Connections and IOs
76===================
77
78LED
79---
80
81* LED1 (green) = P0.13
82* LED2 (blue)  = P0.15
83* LED3 (red)   = P0.14
84
85Push buttons
86------------
87
88* Reset = SW0 = P0.18 (can be used as GPIO also)
89
90UART
91----
92
93* TX = P0.8
94* RX = P0.7
95
96I2C
97---
98
99I2C pins connected to onboard sensors (I2C_0):
100
101* SDA = P0.5
102* SCL = P0.6
103
104SPI
105---
106
107The e-paper display is connected to the chip via SPI on the following pins (SPI_1):
108
109* SCK  = P0.31
110* MOSI = P0.29
111* MISO = P1.1 (not used by the display)
112
113NOTE: P1.1 is pin 33 in absolute enumeration.
114
115Other pins used by the e-paper display are:
116
117* E-ink enable = P0.11 (cuts off power to the display with MOSFET)
118* CS   = P0.30
119* BUSY = P0.3
120* D/C  = P0.28
121* RES  = P0.2
122
123Programming and Debugging
124*************************
125
126Applications for the ``nrf52840_papyr`` board configuration can be
127built and flashed in the usual way (see :ref:`build_an_application`
128and :ref:`application_run` for more details); Black Magic
129Probe debugger presents itself as two USB-serial ports. On Linux,
130they may come up as ``/dev/ttyACM0`` and ``/dev/ttyACM1``. The first
131one of these (``/dev/ttyACM0`` here) is the debugger port.
132GDB can directly connect to this port without requiring a GDB server by specifying
133``target external /dev/ttyACM0``. The second port acts as a
134serial port, connected to the SoC.
135
136Flashing
137========
138
139By default, papyr is configured to be used with a blackmagicprobe compatible
140debugger (see _Bumpy).
141
142Applications are flashed and run as usual (see :ref:`build_an_application` and
143:ref:`application_run` for more details).
144
145Here is an example for the :zephyr:code-sample:`hello_world` application.
146
147First, run your favorite terminal program to listen for output.
148
149.. code-block:: console
150
151   $ minicom -D <tty_device> -b 115200
152
153Replace :code:`<tty_device>` with the serial port of Black Magic Probe.
154For example, under Linux, :code:`/dev/ttyACM1`.
155
156Then build and flash the application in the usual way.
157
158.. zephyr-app-commands::
159   :zephyr-app: samples/hello_world
160   :board: nrf52840_papyr
161   :goals: build flash
162
163Debugging
164=========
165
166Debug and attach configurations are available using Black Magic Probe, and
167``ninja debug``, or ``ninja attach`` (or with ``make``) are available.
168
169NOTE: You may need to press the reset button once after using ``ninja flash``
170to start executing the code. (not required with ``debug`` or ``attach``)
171
172References
173**********
174
175.. target-notes::
176
177.. _Electronut Labs website: https://electronut.in
178.. _Store link: https://www.tindie.com/stores/ElectronutLabs/
179.. _Papyr website: https://docs.electronut.in/papyr/
180.. _Schematic: https://gitlab.com/electronutlabs-public/papyr/raw/master/hardware/papyr_schematic_v_0_3.pdf?inline=false
181.. _Datasheet: https://gitlab.com/electronutlabs-public/papyr/raw/master/papyr_v0.3_datasheet.pdf?inline=false
182.. _Nordic Semiconductor Infocenter: http://infocenter.nordicsemi.com/
183.. _Black Magic Probe website: https://github.com/blacksphere/blackmagic
184.. _Bumpy website: https://docs.electronut.in/bumpy/
185