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
39.. zephyr:board-supported-hw::
40
41Connections and IOs
42===================
43
44LED
45---
46
47* LED1 (green) = P0.13
48* LED2 (blue)  = P0.15
49* LED3 (red)   = P0.14
50
51Push buttons
52------------
53
54* Reset = SW0 = P0.18 (can be used as GPIO also)
55
56UART
57----
58
59* TX = P0.8
60* RX = P0.7
61
62I2C
63---
64
65I2C pins connected to onboard sensors (I2C_0):
66
67* SDA = P0.5
68* SCL = P0.6
69
70SPI
71---
72
73The e-paper display is connected to the chip via SPI on the following pins (SPI_1):
74
75* SCK  = P0.31
76* MOSI = P0.29
77* MISO = P1.1 (not used by the display)
78
79NOTE: P1.1 is pin 33 in absolute enumeration.
80
81Other pins used by the e-paper display are:
82
83* E-ink enable = P0.11 (cuts off power to the display with MOSFET)
84* CS   = P0.30
85* BUSY = P0.3
86* D/C  = P0.28
87* RES  = P0.2
88
89Programming and Debugging
90*************************
91
92Applications for the ``nrf52840_papyr`` board configuration can be
93built and flashed in the usual way (see :ref:`build_an_application`
94and :ref:`application_run` for more details); Black Magic
95Probe debugger presents itself as two USB-serial ports. On Linux,
96they may come up as ``/dev/ttyACM0`` and ``/dev/ttyACM1``. The first
97one of these (``/dev/ttyACM0`` here) is the debugger port.
98GDB can directly connect to this port without requiring a GDB server by specifying
99``target external /dev/ttyACM0``. The second port acts as a
100serial port, connected to the SoC.
101
102Flashing
103========
104
105By default, papyr is configured to be used with a blackmagicprobe compatible
106debugger (see _Bumpy).
107
108Applications are flashed and run as usual (see :ref:`build_an_application` and
109:ref:`application_run` for more details).
110
111Here is an example for the :zephyr:code-sample:`hello_world` application.
112
113First, run your favorite terminal program to listen for output.
114
115.. code-block:: console
116
117   $ minicom -D <tty_device> -b 115200
118
119Replace :code:`<tty_device>` with the serial port of Black Magic Probe.
120For example, under Linux, :code:`/dev/ttyACM1`.
121
122Then build and flash the application in the usual way.
123
124.. zephyr-app-commands::
125   :zephyr-app: samples/hello_world
126   :board: nrf52840_papyr
127   :goals: build flash
128
129Debugging
130=========
131
132Debug and attach configurations are available using Black Magic Probe, and
133``ninja debug``, or ``ninja attach`` (or with ``make``) are available.
134
135NOTE: You may need to press the reset button once after using ``ninja flash``
136to start executing the code. (not required with ``debug`` or ``attach``)
137
138References
139**********
140
141.. target-notes::
142
143.. _Electronut Labs website: https://electronut.in
144.. _Store link: https://www.tindie.com/stores/ElectronutLabs/
145.. _Papyr website: https://docs.electronut.in/papyr/
146.. _Schematic: https://gitlab.com/electronutlabs-public/papyr/raw/master/hardware/papyr_schematic_v_0_3.pdf?inline=false
147.. _Datasheet: https://gitlab.com/electronutlabs-public/papyr/raw/master/papyr_v0.3_datasheet.pdf?inline=false
148.. _Nordic Semiconductor Infocenter: http://infocenter.nordicsemi.com/
149.. _Black Magic Probe website: https://github.com/blacksphere/blackmagic
150.. _Bumpy website: https://docs.electronut.in/bumpy/
151