1.. _thingy52_nrf52832: 2 3Thingy:52 4######### 5 6.. warning:: 7 8 Nordic Semiconductor no longer offers support for this board, so it is not 9 recommended for new prototypes. 10 11Overview 12******** 13 14Zephyr uses the thingy52/nrf52832 (PCA20020) board configuration for building 15for the Thingy:52 board. The board has the nRF52832 MCU with ARM Cortex-M4F 16processor, a set of environmental sensors, a pushbutton, and two RGB LEDs. 17 18* :abbr:`ADC (Analog to Digital Converter)` 19* CLOCK 20* FLASH 21* Gas sensor 22* :abbr:`GPIO (General Purpose Input Output)` 23* GPIO Expander 24* Humidity and temperature sensor 25* :abbr:`I2C (Inter-Integrated Circuit)` 26* :abbr:`MPU (Memory Protection Unit)` 27* :abbr:`NVIC (Nested Vectored Interrupt Controller)` 28* Pressure sensor 29* :abbr:`PWM (Pulse Width Modulation)` 30* RADIO (Bluetooth Low Energy) 31* RGB LEDs 32* :abbr:`RTC (nRF RTC System Clock)` 33* :abbr:`SPI (Serial Peripheral Interface)` 34* :abbr:`UART (Universal asynchronous receiver-transmitter)` 35* :abbr:`WDT (Watchdog Timer)` 36 37.. figure:: img/thingy52_nrf52832.jpg 38 :align: center 39 :alt: nRF52 Thingy:52 40 41 nRF52 Thingy:52 (Credit: Nordic Semiconductor) 42 43More information about the board can be found at the `nRF52 DK website`_. The 44`Nordic Thingy:52 guide`_ contains the processor's information and the 45datasheet. 46 47 48Hardware 49******** 50 51Thingy:52 has the following features: 52 53* Two RGB LEDs 54* CO2 and TVOC sensor 55* Humidity and temperature sensor 56* Color sensor 57* I2C GPIO expander 58* Provisions for a pin header and I2C and serial connectors 59* Bluetooth radio 60 61Supported Features 62================== 63 64+-----------+------------+----------------------+ 65| Interface | Controller | Driver/Component | 66+===========+============+======================+ 67| ADC | on-chip | adc | 68+-----------+------------+----------------------+ 69| CLOCK | on-chip | clock_control | 70+-----------+------------+----------------------+ 71| FLASH | on-chip | flash | 72+-----------+------------+----------------------+ 73| Gas | on-board | ccs811 | 74| Sensor | | | 75+-----------+------------+----------------------+ 76| GPIO | on-chip | gpio | 77+-----------+------------+----------------------+ 78| GPIO Exp | on-board | sx1509b | 79+-----------+------------+----------------------+ 80| Humidity | on-board | hts221 | 81| and Temp | | | 82+-----------+------------+----------------------+ 83| I2C(M) | on-chip | i2c | 84+-----------+------------+----------------------+ 85| MPU | on-chip | arch/arm | 86+-----------+------------+----------------------+ 87| NVIC | on-chip | arch/arm | 88+-----------+------------+----------------------+ 89| Pressure | on-board | lps22hb_press | 90| and Temp | | | 91+-----------+------------+----------------------+ 92| PWM | on-chip | pwm | 93+-----------+------------+----------------------+ 94| RADIO | on-chip | Bluetooth | 95+-----------+------------+----------------------+ 96| RTC | on-chip | system clock | 97+-----------+------------+----------------------+ 98| SPI(M/S) | on-chip | spi | 99+-----------+------------+----------------------+ 100| UART | on-chip | serial | 101+-----------+------------+----------------------+ 102| WDT | on-chip | watchdog | 103+-----------+------------+----------------------+ 104 105Connections and IOs 106=================== 107 108Lightwell RGB LED 109----------------- 110The LED is driven by the SX1509B GPIO expander chip (device name GPIO_P0). 111 112+-------------------+-------------+ 113| GPIO Expander Pin | LED Channel | 114+===================+=============+ 115| 5 | Green | 116+-------------------+-------------+ 117| 6 | Blue | 118+-------------------+-------------+ 119| 7 | Red | 120+-------------------+-------------+ 121 122Button 123------ 124 125Thingy:52 has a pushbutton, connected to the P0.11 SOC GPIO pin. 126 127Serial 128------ 129 130By default the system UART has the following pin configuration: 131 132+---------+--------+ 133| SOC Pin | Signal | 134+=========+========+ 135| P0.02 | TX | 136+---------+--------+ 137| P0.03 | RX | 138+---------+--------+ 139 140The pins can be found on the P4 and P6 connectors. The system UART console 141uses these pins by default. 142 143Internal I2C Bus 144---------------- 145 146The internal I2C bus (I2C_0) is not routed to any of the external connectors, 147but most of the on-board devices are accessed through it. The following pins 148have been assigned to the bus: 149 150+---------+---------+ 151| SOC Pin | Signal | 152+=========+=========+ 153| P0.07 | SDA | 154+---------+---------+ 155| P0.08 | SCL | 156+---------+---------+ 157 158The following devices are attached to the bus. 159 160+----------+---------+ 161| Device | Address | 162+==========+=========+ 163| SX1509B | 0x3e | 164+----------+---------+ 165| LPS22HB | 0x5c | 166+----------+---------+ 167| HTS221 | 0x5f | 168+----------+---------+ 169| CCS811 | 0x5a | 170+----------+---------+ 171 172External I2C Bus 173---------------- 174 175The external I2C bus (I2C_1) can be found on the P4 header and the P5 and P7 176connectors. 177 178+---------+---------+ 179| SOC Pin | Signal | 180+=========+=========+ 181| P0.14 | SDA_EXT | 182+---------+---------+ 183| P0.15 | SCL_EXT | 184+---------+---------+ 185 186Pin Header 187---------- 188 189This is the pinout of the P4 pin header. Some of the SOC GPIO pins and I2C GPIO 190expander pins are accessible through it. It also allows attaching external 191devices to the four on-board N-channel MOSFET transistors. 192 193+-----+---------------+-----------------------+ 194| Pin | Device | Signal / Device Pin | 195+=====+===============+=======================+ 196| 1 | SOC | SCL_EXT / P0.15 | 197+-----+---------------+-----------------------+ 198| 2 | SOC | SDA_EXT / P0.14 | 199+-----+---------------+-----------------------+ 200| 3 | SOC | ANA/DIG0 / P0.02 | 201+-----+---------------+-----------------------+ 202| 4 | SOC | ANA/DIG1 / P0.03 | 203+-----+---------------+-----------------------+ 204| 5 | SOC | ANA/DIG2 / P0.04 | 205+-----+---------------+-----------------------+ 206| 6 | | GND | 207+-----+---------------+-----------------------+ 208| 7 | GPIO Expander | Pin 0 | 209+-----+---------------+-----------------------+ 210| 8 | GPIO Expander | Pin 1 | 211+-----+---------------+-----------------------+ 212| 9 | GPIO Expander | Pin 2 | 213+-----+---------------+-----------------------+ 214| 10 | GPIO Expander | Pin 3 | 215+-----+---------------+-----------------------+ 216| 11 | MOSFET 1 | Drain | 217+-----+---------------+-----------------------+ 218| 12 | MOSFET 1 | Source | 219+-----+---------------+-----------------------+ 220| 13 | MOSFET 2 | Drain | 221+-----+---------------+-----------------------+ 222| 14 | MOSFET 2 | Source | 223+-----+---------------+-----------------------+ 224| 15 | MOSFET 3 | Drain | 225+-----+---------------+-----------------------+ 226| 16 | MOSFET 3 | Source | 227+-----+---------------+-----------------------+ 228| 17 | MOSFET 4 | Drain | 229+-----+---------------+-----------------------+ 230| 18 | MOSFET 4 | Source | 231+-----+---------------+-----------------------+ 232| 19 | | VDD | 233+-----+---------------+-----------------------+ 234| 20 | | GND | 235+-----+---------------+-----------------------+ 236 237MOSFETs 238~~~~~~~ 239 240The MOSFETs are attached to the following SOC GPIO pins: 241 242+----------+----------+ 243| Device | Gate Pin | 244+==========+==========+ 245| MOSFET 1 | P0.18 | 246+----------+----------+ 247| MOSFET 2 | P0.19 | 248+----------+----------+ 249| MOSFET 3 | P0.20 | 250+----------+----------+ 251| MOSFET 4 | P0.21 | 252+----------+----------+ 253 254Power Rails 255----------- 256 257Thing:52 has multiple power rails. The necessary rails for the currently 258supported devices are listed here. 259 260+---------+--------------+----------------------+ 261| Name | Derived from | Controlled by | 262+=========+==============+======================+ 263| VREG | The battery | Always on | 264+---------+--------------+----------------------+ 265| VDD_nRF | VREG | Always on | 266+---------+--------------+----------------------+ 267| VDD | VREG | SOC pin P0.30 | 268+---------+--------------+----------------------+ 269| VDD_CCS | VDD | GPIO expander pin 10 | 270+---------+--------------+----------------------+ 271 272Due to the dependencies of the power rails, multiple rails may need to be 273powered for a given device to turn on. The correct order of powering up the 274rails is the order of the rails down the dependency chain. For example, in order 275to power the CCS811 gas sensor, VDD has to be turned on first and VDD_CCS after 276it. Here's a list of the devices and their power rails: 277 278+----------+---------+ 279| Device | Rail | 280+==========+=========+ 281| nRF52832 | VDD_nRF | 282+----------+---------+ 283| SX1509B | VDD | 284+----------+---------+ 285| LPS22HB | VDD | 286+----------+---------+ 287| HTS221 | VDD | 288+----------+---------+ 289| CCS811 | VDD_CCS | 290+----------+---------+ 291 292Sensors 293------- 294 295+----------+---------------------------------+-------+-------------+------------+ 296| Device | Function | Bus | I2C Address | Power Rail | 297+==========+=================================+=======+=============+============+ 298| LPS22HB | Pressure and Temperature sensor | I2C_0 | 0x5c | VDD | 299+----------+---------------------------------+-------+-------------+------------+ 300| HTS221 | Humidity and Temperature sensor | I2C_0 | 0x5f | VDD | 301+----------+---------------------------------+-------+-------------+------------+ 302| CCS811 | Gas sensor | I2C_0 | 0x5a | VDD_CCS | 303+----------+---------------------------------+-------+-------------+------------+ 304 305Misc. Device Pins 306----------------- 307 308SX1509B 309~~~~~~~ 310 311+---------------+-------------------+ 312| Device Signal | SOC Pin | 313+===============+===================+ 314| SX_OSCIO | P0.05 | 315+---------------+-------------------+ 316| SX_RESET | P0.16 | 317+---------------+-------------------+ 318 319LPS22HB 320~~~~~~~ 321 322+---------------+-------------------+ 323| Sensor Signal | SOC Pin | 324+===============+===================+ 325| LPS_INT | P0.23 | 326+---------------+-------------------+ 327 328HTS221 329~~~~~~ 330 331+---------------+-------------------+ 332| Sensor Signal | SOC Pin | 333+===============+===================+ 334| HTS_INT | P0.24 | 335+---------------+-------------------+ 336 337CCS811 338~~~~~~ 339 340+---------------+-------------------+ 341| Sensor Signal | GPIO Expander Pin | 342+===============+===================+ 343| CCS_RESET | 11 | 344+---------------+-------------------+ 345| CCS_WAKE | 12 | 346+---------------+-------------------+ 347 348Programming and Debugging 349************************* 350 351Flashing 352======== 353 354Flashing Zephyr onto Thingy:52 requires an external J-Link programmer. The 355programmer is attached to the P9 programming header. 356 357 358Debugging 359========= 360 361Thingy:52 does not have an on-board J-Link debug IC as some other nRF5 362development boards, however, instructions from the :ref:`nordic_segger` page 363also apply to this board, with the additional step of connecting an external 364debugger. A development board with a Debug out connector such as the 365:ref:`nrf52dk_nrf52832` can be used as a debugger with Thingy:52. 366 367Testing board features 368********************** 369 370The green lightwell LED can be tested with the :zephyr:code-sample:`blinky` example. 371 372.. zephyr-app-commands:: 373 :zephyr-app: samples/basic/blinky 374 :board: thingy52/nrf52832 375 :goals: build flash 376 377 378 379Also the temperature and humidity sensor can be tested with the :zephyr:code-sample:`hts221` 380sample. 381 382.. zephyr-app-commands:: 383 :zephyr-app: samples/sensor/hts221 384 :board: thingy52/nrf52832 385 :goals: build flash 386 387References 388********** 389 390.. target-notes:: 391 392.. _nRF52 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/Nordic-Thingy-52 393.. _Nordic Thingy:52 guide: https://docs.nordicsemi.com/bundle/ug_thingy52/page/UG/thingy52/intro/frontpage.html 394