Zephyr uses the nrf52_pca20020 board configuration for building for the Thingy:52 board. The board has the nRF52832 MCU with ARM Cortex-M4F processor, a set of environmental sensors, a pushbutton, and two RGB LEDs.
- Gas sensor
- GPIO Expander
- Humidity and temperature sensor
- Pressure sensor
- RADIO (Bluetooth Low Energy)
- RGB LEDs
Thingy:52 has the following features:
- Two RGB LEDs
- CO2 and TVOC sensor
- Humidity and temperature sensor
- Color sensor
- I2C GPIO expander
- Provisions for a pin header and I2C and serial connectors
- Bluetooth radio
|Humidity and Temp||on-board||hts221|
|Pressure and Temp||on-board||lps22hb_press|
Connections and IOs¶
Lightwell RGB LED¶
The LED is driven by the SX1509B GPIO expander chip (device name GPIO_P0).
|GPIO Expander Pin||LED Channel|
By default the system UART has the following pin configuration:
The pins can be found on the P4 and P6 connectors. The system UART console uses these pins by default.
Internal I2C Bus¶
The internal I2C bus (I2C_0) is not routed to any of the external connectors, but most of the on-board devices are accessed trough it. The following pins have been assigned to the bus:
The following devices are attached to the bus.
External I2C Bus¶
The external I2C bus (I2C_1) can be found on the P4 header and the P5 and P7 connectors.
This is the pinout of the P4 pin header. Some of the SOC GPIO pins and I2C GPIO expander pins are accessible through it. It also allows attaching external devices to the four on-board N-channel MOSFET transistors.
|Pin||Device||Signal / Device Pin|
|1||SOC||SCL_EXT / P0.15|
|2||SOC||SDA_EXT / P0.14|
|3||SOC||ANA/DIG0 / P0.02|
|4||SOC||ANA/DIG1 / P0.03|
|5||SOC||ANA/DIG2 / P0.04|
|7||GPIO Expander||Pin 0|
|8||GPIO Expander||Pin 1|
|9||GPIO Expander||Pin 2|
|10||GPIO Expander||Pin 3|
The MOSFETs are attached to the following SOC GPIO pins:
Thing:52 has multiple power rails. The necessary rails for the currently supported devices are listed here.
|Name||Derived from||Controlled by|
|VREG||The battery||Always on|
|VDD||VREG||SOC pin P0.30|
|VDD_CCS||VDD||GPIO expander pin 10|
Due to the dependencies of the power rails, multiple rails may need to be powered for a given device to turn on. The correct order of powering up the rails is the order of the rails down the dependency chain. For example, in order to power the CCS811 gas sensor, VDD has to be turned on first and VDD_CCS after it. Here’s a list of the devices and their power rails:
|Device||Function||Bus||I2C Address||Power Rail|
|LPS22HB||Pressure and Temperature sensor||I2C_0||0x5c||VDD|
|HTS221||Humidity and Temperature sensor||I2C_0||0x5f||VDD|
Programming and Debugging¶
Flashing Zephyr onto Thingy:52 requires an external J-Link programmer. The programmer is attached to the P9 programming header.
Thingy:52 does not have an on-board J-Link debug IC as some other nRF5 development boards, however, instructions from the Nordic nRF5x Segger J-Link page also apply to this board, with the additional step of connecting an external debugger. A development board with a Debug out connector such as the nRF52-PCA10040 can be used as a debugger with Thingy:52.
Testing board features¶
The green lightwell LED can be tested with the Blinky Application example.
# On Linux/macOS cd $ZEPHYR_BASE/samples/basic/blinky mkdir build && cd build # On Windows cd %ZEPHYR_BASE%\samples\basic\blinky mkdir build & cd build # Use cmake to configure a Ninja-based build system: cmake -GNinja -DBOARD=nrf52_pca20020 .. # Now run ninja on the generated build system: ninja ninja flash
Also the temperature and humidity sensor can be tested with the HTS221: Temperature and Humidity Monitor sample.
# On Linux/macOS cd $ZEPHYR_BASE/samples/sensor/hts221 mkdir build && cd build # On Windows cd %ZEPHYR_BASE%\samples\sensor\hts221 mkdir build & cd build # Use cmake to configure a Ninja-based build system: cmake -GNinja -DBOARD=nrf52_pca20020 .. # Now run ninja on the generated build system: ninja ninja flash