TiaC CoffeeCaller nRF52
Overview
The TiaC CoffeeCaller nRF52 board is based on the aQFN73 package of the nRF52840 chip. See the nRF52840 Product Overview [15] for a short description of the key features of the chip or the more detailed nRF52840 Product Specification [16] for all technical details.
Hardware
The board is powered by 5V via the USB-C connector and has a 3.3V/200㎃ LDO as needed by the chip and other peripherals on the board. It features 5 user buttons, 4 GPIO LEDs, WS2812 RGB Strip with 4 LEDs, 4 servo PIN headers, SHT40 temperature and humidity sensor, qwIIC Connector and a PWM buzzer. Schematics and KiCad design files can be found in the TiaC CoffeeCaller nRF52 website [2].
Features and Resources |
Printed Circuit Board |
5V/150㎃ 3.3V/200㎃ 64㎒ 1㎆ 256㎅ USB-C UF2 SWD RST BOOT USER WHITE RGB PASSIVE Servo Motor TH : T H 17 5 2 1
Design Data |
|
Positions
Todo
Export more design notes from KiCad and show here.
Pinouts
Todo
Create a pinout for the free pin header, maybe with KiCad.
Supported Features
The TiaC CoffeeCaller nRF52 board configuration supports the following Zephyr hardware features:
Peripheral |
Kconfig option |
Devicetree compatible |
Zephyr API |
|---|---|---|---|
PINCTRL |
|||
GPIO |
|||
UART |
|||
UDC (USB Device Controller) |
|||
RADIO (L1: GFSK / O-QPSK, L2: IEEE 802.15.4) |
|||
I2C |
|||
WS2812 (GPIO) |
N/A |
||
PWM |
|||
Watchdog Timer (WDT) |
|||
Flash |
|||
HWINFO |
N/A |
||
CLOCK |
|||
NVIC |
N/A |
Nested Vector Interrupts Controller |
|
SYSTICK |
N/A |
Other hardware features are not currently supported by Zephyr. The default configuration can be found in the different Kconfig files:
Board Configurations
The TiaC CoffeeCaller nRF52 board can be configured for the following different use cases.
west build -b coffeecaller_nrf52
Use the native USB device port with CDC-ACM as Zephyr console and for the shell.
User LED
The TiaC CoffeeCaller nRF52 board feature four white LEDs for user purposes at GPIO port 1. The LEDs are all low active.
LD1 (white) @ P1.06 →
aliases { led0 = &ld1; };LD2 (white) @ P1.07 →
aliases { led1 = &ld2; };LD3 (white) @ P1.02 →
aliases { led2 = &ld3; };LD4 (white) @ P1.04 →
aliases { led3 = &ld4; };
User RGB LED
The TiaC CoffeeCaller nRF52 board feature four RGB LEDs for user purposes in strip (serial) interconnection at GPIO port 0 line 26.
WS2812 Strip @ P0.26 →
aliases { led-strip = &led_strip; };
User PWM Buzzer and Servo Motors
The TiaC CoffeeCaller nRF52 board feature two independent PWM function units with 4 channels each. The PWM0 channel 0 will be used for the on-board passive magnetic buzzer and PWM1 channel 0 to 3 are reserved for driving servo motors.
Serial Port
The TiaC CoffeeCaller nRF52 board feature one two wire UART (RxD/TxD) at USART0 acassible on the free pin header with the default settings of 115200/8N1 without any flow control (no XON/XOFF, no RTS/CTS).
TxD @ P0.06
RxD @ P0.08
USB Device Port
The TiaC CoffeeCaller nRF52 board features one (native) USB full-speed device port that can be used to communicate with a host PC. See the USB sample applications for more, such as the USB CDC ACM UART sample sample which sets up a virtual serial port that echos characters back to the host PC. This board provide the Zephyr console per default on the USB port as CDC ACM:
USB device idVendor=1915, idProduct=c0ca, bcdDevice= 4.03 USB device strings: Mfr=1, Product=2, SerialNumber=3 Product: CoffeeCaller nRF52 (CDC ACM) Manufacturer: TiaC (Nordic Semiconductor ASA) SerialNumber: 9D167F0C551481F7
Connections and IOs
Selecting the pins
Pins can be configured in the board pinctrl file ( boards/tiac/coffeecaller/nrf52840-pinctrl.dtsi ). To see the available mappings, open the nRF52840 Product Specification [16], chapter 7 Hardware and Layout. In the table 7.1.1 aQFN73 ball assignments select the pins marked General purpose I/O. Note that pins marked as low frequency I/O only can only be used in under-10㎑ applications. They are not suitable for 115200 speed of UART.
Laced Grove Signal Interface
The TiaC CoffeeCaller nRF52 board offers the option of connecting
hardware modules via one single Qwiic/STEMMA QT (Grove connectors). This is
provided by a specific interface for general signal mapping, the
Laced Grove Signal Interface.
Following mappings are well known:
grove_gpios: GPIO mappinggrove_pwms: PWM mapping
This is the GPIO signal line mapping from the nRF52840 [15] to the
set of Grove connectors provided as Laced Grove Signal Interface.
This list must not be stable!
phandle index to shield –> |
Signal : Meaning |
|
|---|---|---|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
P0.20: I2C-SDA (I2C0) |
<&grove_d17_header 1 …>↳
<&gpio0 20 …> |
|
P0.24: I2C-SCL (I2C0) |
<&grove_d17_header 0 …>↳
<&gpio0 24 …> |
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
|
|
not wired |
The corresponding mapping is always board or SOC specific. In addition
to the PWM signal line mapping, the valid references to the PWM
function units in the SOC or on the board are therefore also defined
as Grove PWM Labels. The following table reflects the currently
supported mapping for coffeecaller_nrf52, but this list will
be growing up with further development and maintenance.
This list must not be complete or stable!
Grove PWM Label |
phandle index to shield –> |
Signal : Meaning |
|
|---|---|---|---|
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
P0.20: I2C-SDA |
not yet supported |
|
|
P0.24: I2C-SCL |
not yet supported |
|
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
||
|
not wired |
Programming and Debugging
The TiaC CoffeeCaller nRF52 board features an
UF2 based bootloader [4]
to program the application by copying the build/zephyr/zephyr.uf2 file
to the mounted mass storage device TiaCCoffee. If the board is powered
on with the BOOTSEL button pressed (the big BUTTON0), it will appear
on the host as a mass storage device:
USB device idVendor=239a, idProduct=00da, bcdDevice= 1.00 USB device strings: Mfr=1, Product=2, SerialNumber=3 Product: coffeecaller Manufacturer: TiaC SerialNumber: 9D167F0C551481F7
Tip
When ever you need to restore this original bootloader you should read and following the directions in Building and flashing the CoffeeCaller bootloader [5]. There is also a backup copy of the original bootloader together with a ready to use SEGGER JFlash control file inside the Bridel project:
There is also a SWD header (SWD1) on board which have to be used with tools like SEGGER JLink for bootloader restore, for programming, or direct programming and debugging.
Flashing
Using UF2
The UF2 file should be copied on command line or drag-and-dropped via UI file manager to this new mass storage device, which will flash the board.
Here is an example for the Hello World
application. First, run your favorite terminal program to listen for output.
Replace <tty_device> with the port where the board can be found. For
example, under Linux, /dev/ttyACM0.
$ minicom -b 115200 -8 -c on -D <tty_device>
Then build and flash the application in the usual way.
west build -b coffeecaller_nrf52 -p -d build/coffeecaller_nrf52 zephyr/samples/hello_world west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
*** Booting Zephyr OS build v4.3.0…*** Hello World! coffeecaller_nrf52/nrf52840
Debugging
The SWD interface can be used to debug the board. To achieve this, you can either use SEGGER JLink, OpenOCD or PyOCD and follow the instruction in Building, Flashing and Debugging.
You can debug an application in the usual way. Here is an example for debugging the Hello World application:
west build -b coffeecaller_nrf52 -p -d build/coffeecaller_nrf52 zephyr/samples/hello_world west debug -r jlink -d build/coffeecaller_nrf52
Tests and Examples
Hello Shell on the USB Console (CDC/ACM)
west build -b coffeecaller_nrf52 -p -d build/coffeecaller_nrf52 bridle/samples/helloshell
west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
*** Booting Zephyr OS build v4.3.0…*** Hello World! I'm THE SHELL from coffeecaller_nrf52 uart:~$ █
Simple test execution on target
(text in bold is a command input)
System
uart:~$ hwinfo devid Length: 8 ID: 0x9d167f0c551481f7 uart:~$ kernel version Zephyr version 4.3.0 uart:~$ bridle version Bridle version 4.3.0 uart:~$ bridle version long Bridle version 4.3.0.0 uart:~$ bridle info Zephyr: 4.3.0 Bridle: 4.3.0Devices
uart:~$ device list devices: - clock@40000000 (READY) DT node labels: clock - gpio@50000300 (READY) DT node labels: gpio1 - gpio@50000000 (READY) DT node labels: gpio0 - cdc_acm_uart0 (READY) DT node labels: cdc_acm_uart0 - uart@40002000 (READY) DT node labels: uart0 - usbd@40027000 (READY) DT node labels: usbd zephyr_udc0 - flash-controller@4001e000 (READY) DT node labels: flash_controller - i2c@40003000 (READY) DT node labels: i2c0 grove_i2c - pwm@40021000 (READY) DT node labels: pwm1 - pwm@4001c000 (READY) DT node labels: pwm0 - leds (READY) - temp@4000c000 (READY) DT node labels: temp - sht4x@46 (READY) DT node labels: sht4xOperate with the PWM buzzer
concert pitch: 440 ㎐
Piezo middle frequency: 1,000 ㎑
Piezo resonance: 2,730 ㎑
Piezo high frequency: 10,000 ㎑
higher frequencies: 11 ㎑, 12 ㎑, 13 ㎑, 14 ㎑, 15 ㎑
uart:~$ pwm usec pwm0 0 2273 1136uart:~$ pwm usec pwm0 0 2000 1000uart:~$ pwm usec pwm0 0 366 183uart:~$ pwm usec pwm0 0 100 50uart:~$ pwm usec pwm0 0 90 45uart:~$ pwm usec pwm0 0 83 41uart:~$ pwm usec pwm0 0 77 39uart:~$ pwm usec pwm0 0 71 36uart:~$ pwm usec pwm0 0 66 33Operate with the PWM servo
on 0.500 ㎳ ≲ -90°
on 1.500 ㎳ ≅ 0°
on 2.500 ㎳ ≳ +90°
uart:~$ pwm usec pwm1 0 20000 500 uart:~$ pwm usec pwm1 0 20000 1500 uart:~$ pwm usec pwm1 0 20000 2500Die Temperature and I2C T/H Sensor
uart:~$ sensor info device name: sht4x@46, vendor: Sensirion AG, model: sht4x, friendly name: on-board temperature and humidity device name: temp@4000c000, vendor: Nordic Semiconductor, model: nrf-temp, friendly name: nRF52 chip temperatureuart:~$ sensor get temp channel type=12(die_temp) index=0 shift=5 num_samples=1 value=660970642089ns (26.749999)uart:~$ sensor get sht4x channel type=13(ambient_temp) index=0 shift=6 num_samples=1 value=692580444335ns (27.622261) channel type=16(humidity) index=0 shift=6 num_samples=1 value=692580444335ns (39.897215)Flash Controller
Erase, Write and Verify
uart:~$ flash read flash_controller e0000 40 000E0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| uart:~$ flash test flash_controller e0000 1000 2 Erase OK. Write OK. Verified OK. Erase OK. Write OK. Verified OK. Erase-Write-Verify test done.Details
uart:~$ flash read flash_controller e0000 40 000E0000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |........ ........| 000E0010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |........ ........| 000E0020: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&' ()*+,-./| 000E0030: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |01234567 89:;<=>?| uart:~$ flash page_info e0000 Page for address 0xe0000: start offset: 0xe0000 size: 4096 index: 224Revert
uart:~$ flash erase flash_controller e0000 1000 Erase success. uart:~$ flash read flash_controller e0000 40 000E0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........|I2C on Qwiic with BMP280
The TiaC CoffeeCaller nRF52 board has one on-board I2C devices. For this example an additional Grove Temperature and Barometer Sensor – BMP280 [13] was plugged into the Qwiic connector.
uart:~$ i2c scan i2c0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- 46 -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- 77 1 devices found on i2c0The I2C address
0x46is the on-board SHT40 [14] T/H Sensor.The I2C address
0x77is a Bosch BMP280 Air Pressure Sensor and their Chip-ID can read from register0xd0. The Chip-ID must be0x58:uart:~$ i2c read_byte i2c0 77 d0 Output: 0x58
More Samples
There are 3 samples that allow you to test that the push buttons and LEDs on the board are working properly with Zephyr. You can build and flash the examples to make sure Zephyr is running correctly on your board. The button and LED definitions can be found in boards/tiac/coffeecaller/coffeecaller_nrf52_nrf52840.dts.
User LED Blinky by GPIO
See also Zephyr sample: Blinky.
west build -b coffeecaller_nrf52 -p -d build/coffeecaller_nrf52 zephyr/samples/basic/blinky west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
*** Booting Zephyr OS build v4.3.0…*** LED state: OFF LED state: ON LED state: OFF LED state: ON LED … … …
WS2812 LED Test Pattern over GPIO
See also Zephyr sample: LED strip.
west build -b coffeecaller_nrf52 -p -d build/coffeecaller_nrf52 zephyr/samples/drivers/led/led_strip west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
*** Booting Zephyr OS build v4.3.0…*** [00:00:04.013,671] <inf> main: Found LED strip device ws2812 [00:00:04.013,671] <inf> main: Displaying pattern on strip
Sounds from the speaker
This Bridle sample is applicable for the on-board passive magnetic buzzer connected to the PWM0 channel 0.
west build -b coffeecaller_nrf52 -p -d build/coffeecaller_nrf52 bridle/samples/buzzer west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
*** Booting Zephyr OS build v4.3.0…*** uart:~$ █
Simple test execution on target
play a beep
play a folk song
play a chrismas song
uart:~$ buzzer beepuart:~$ buzzer play folksonguart:~$ buzzer play xmastime
Drive a servo motor
See also Zephyr sample: Servomotor.
This Zephyr sample is applicable for first on-board servo motor connector corresponding to the PWM1 channel 0.
Connect a servomotor MG996R to the first on-board PWM channel for servomotors, the 4×3 pin header block (HDR1 and HDR2).
The corresponding PWM pulse widths for a range of -90° to +90° (180°) are 500 ㎲ to 2,500 ㎲ with a period of 50 ㎐. All these servomotor specific parameters are preset by the snippet PWM Servomotor Preset Snippet (pwm-servo) that have to use to get access to this dedicated PWM channel together with the original Zephyr Servomotor sample. Invoke west build and west flash with this snipped and optional mixed with others, for example:
west build -b coffeecaller_nrf52/nrf52840 -p always -S "pwm-servo" -d build/coffeecaller_nrf52 zephyr/samples/basic/servo_motor west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
*** Booting Zephyr OS build v4.3.0…*** Servomotor control
Grove Module Samples
All currently supported Grove modules can be reused on the Qwiic / STEMMA QT connector using a conversion cable. Only the corresponding shield stacks need to be specified.
Hello Shell with sensor access to Grove BMP280
west build -b coffeecaller_nrf52 -p --shield "grove_sens_bmp280" -d build/coffeecaller_nrf52 bridle/samples/helloshell
west flash -r uf2 -d build/coffeecaller_nrf52
Simple test execution on target
(text in bold is a command input)
Devices
Only an excerpt from the full list:
uart:~$ device list devices: … … … - bmp280@77 (READY) … … …Sensor access from Zephyr Shell
uart:~$ sensor info device name: bmp280@77, vendor: Bosch Sensortec GmbH, model: bme280, friendly name: Grove TP Sensor V1.0 (BME280) device name: sht4x@46, vendor: Sensirion AG, model: sht4x, friendly name: on-board temperature and humidity device name: temp@4000c000, vendor: Nordic Semiconductor, model: nrf-temp, friendly name: nRF52 chip temperatureuart:~$ sensor get bmp280@77 channel type=13(ambient_temp) index=0 shift=16 num_samples=1 value=83516265870ns (27.299987) channel type=14(press) index=0 shift=23 num_samples=1 value=83516265870ns (99.054687) channel type=16(humidity) index=0 shift=21 num_samples=1 value=83516265870ns (0.000000)
BME280 humidity and pressure sensor with Grove BMP280
See also Zephyr sample: BME280 humidity and pressure sensor.
west build -b coffeecaller_nrf52 -p --shield "grove_sens_bmp280" -d build/coffeecaller_nrf52 zephyr/samples/sensor/bme280 west flash -r uf2 -d build/coffeecaller_nrf52
You should see the following message on the console:
[00:00:00.000,305] <dbg> temp_nrf5: temp_nrf5_sample_fetch: sample: 112 [00:00:00.000,305] <dbg> temp_nrf5: temp_nrf5_channel_get: Temperature:28,0 [00:00:00.002,838] <dbg> BME280: bme280_chip_init: ID OK (BMP280) [00:00:00.012,084] <dbg> BME280: bme280_chip_init: "bmp280@77" OK *** Booting Zephyr OS build v4.3.0…*** Found device "bmp280@77", getting sensor data temp: 27.319976; press: 99.58593; humidity: 0.7812 [00:00:04.032,348] <dbg> temp_nrf5: temp_nrf5_sample_fetch: sample: 112 [00:00:04.032,348] <dbg> temp_nrf5: temp_nrf5_channel_get: Temperature:28,0 temp: 27.319976; press: 99.58593; humidity: 0.7812 temp: 27.319976; press: 99.58593; humidity: 0.7812 temp: 27.319976; press: 99.58593; humidity: 0.7812 [00:00:08.032,531] <dbg> temp_nrf5: temp_nrf5_sample_fetch: sample: 109 [00:00:08.032,531] <dbg> temp_nrf5: temp_nrf5_channel_get: Temperature:27,250000 temp: 27.319976; press: 99.58593; humidity: 0.7812 temp: 27.319976; press: 99.58593; humidity: 0.7812 temp: 27.319976; press: 99.58593; humidity: 0.7812 temp: 27.319976; press: 99.58593; humidity: 0.7812 temp: 27.319976; press: 99.58593; humidity: 0.7812 … … …