Skip to content

Commit d4d8580

Browse files
henrikbrixandersencarlescufi
authored andcommitted
boards: shields: add adafruit data logger shield
Add definition for the Adafruit Data Logger Shield. This shield is equipped with a PCF8523 RTC, an SD card slot, a couple of user LEDs and a prototyping area. Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 11fc5d0 commit d4d8580

File tree

5 files changed

+164
-0
lines changed

5 files changed

+164
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2019-2023 Henrik Brix Andersen <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SHIELD_ADAFRUIT_DATA_LOGGER
5+
6+
if DISK_ACCESS
7+
8+
config SPI
9+
default y
10+
11+
config DISK_DRIVER_SDMMC
12+
default y
13+
14+
endif # DISK_ACCESS
15+
16+
endif # SHIELD_ADAFRUIT_DATA_LOGGER
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2019 Henrik Brix Andersen <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SHIELD_ADAFRUIT_DATA_LOGGER
5+
def_bool $(shields_list_contains,adafruit_data_logger)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2019-2023 Henrik Brix Andersen <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
rtc = &rtc0_adafruit_data_logger;
10+
};
11+
12+
leds {
13+
compatible = "gpio-leds";
14+
/*
15+
* LED1 connection must be manually established using a jumper between
16+
* pins "L1" and "Digital I/O 3".
17+
*/
18+
green_led_adafruit_data_logger: led_1__adafruit_data_logger {
19+
gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */
20+
label = "User LED1";
21+
};
22+
/*
23+
* LED2 connection must be manually established using a jumper between
24+
* pins "L2" and "Digital I/O 4".
25+
*/
26+
red_led_adafruit_data_logger: led_2_adafruit_data_logger {
27+
gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
28+
label = "User LED2";
29+
};
30+
};
31+
32+
};
33+
34+
&arduino_spi {
35+
status = "okay";
36+
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
37+
38+
sdhc0_adafruit_data_logger: sdhc@0 {
39+
compatible = "zephyr,sdhc-spi-slot";
40+
reg = <0>;
41+
spi-max-frequency = <24000000>;
42+
status = "okay";
43+
44+
sdmmc {
45+
compatible = "zephyr,sdmmc-disk";
46+
status = "okay";
47+
};
48+
};
49+
};
50+
51+
&arduino_i2c {
52+
status = "okay";
53+
54+
rtc0_adafruit_data_logger: rtc@68 {
55+
compatible = "nxp,pcf8523";
56+
reg = <0x68>;
57+
alarms-count = <1>;
58+
battery-switch-over = "standard";
59+
/*
60+
* Interrupt connection must be manually established using a jumper wire between
61+
* pins "SQ" and "Digital I/O 7".
62+
*/
63+
int1-gpios = <&arduino_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* D7 */
64+
status = "okay";
65+
};
66+
};
Loading
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
.. _adafruit_data_logger_shield:
2+
3+
Adafruit Data Logger Shield
4+
###########################
5+
6+
Overview
7+
********
8+
9+
The `Adafruit Data Logger Shield`_ rev. B features an `NXP PCF8523 Real-Time Clock/Calendar with
10+
Battery Backup`_, an SD card interface, two user LEDs, and a prototyping area.
11+
12+
.. figure:: adafruit_data_logger.jpg
13+
:align: center
14+
:alt: Adafruit Data Logger Shield
15+
16+
Adafruit Data Logger Shield (Credit: Adafruit)
17+
18+
.. note::
19+
The older revision A of the Adafruit Data Logger Shield is not supported.
20+
21+
Pin Assignments
22+
===============
23+
24+
+-----------------------+---------------------------------------------+
25+
| Shield Connector Pin | Function |
26+
+=======================+=============================================+
27+
| D3 | User LED1 (green) [1]_ |
28+
+-----------------------+---------------------------------------------+
29+
| D4 | User LED2 (red) [1]_ |
30+
+-----------------------+---------------------------------------------+
31+
| D7 | PCF8523 RTC INT1 [2]_ |
32+
+-----------------------+---------------------------------------------+
33+
| D10 | SD card SPI CS |
34+
+-----------------------+---------------------------------------------+
35+
| D11 | SD card SPI MOSI |
36+
+-----------------------+---------------------------------------------+
37+
| D12 | SD card SPI MISO |
38+
+-----------------------+---------------------------------------------+
39+
| D13 | SD card SPI SCK |
40+
+-----------------------+---------------------------------------------+
41+
| SDA | PCF8523 RTC I2C SDA |
42+
+-----------------------+---------------------------------------------+
43+
| SCL | PCF8523 RTC I2C SCL |
44+
+-----------------------+---------------------------------------------+
45+
46+
.. [1] The user LEDs are not connected to ``D3`` and ``D4`` by default. Jumper or jumper wire
47+
connections must be established between the ``L1`` and ``Digital I/O 3`` pins for ``LED1``
48+
and ``L2`` and ``Digital I/O 4`` pins for ``LED2`` if they are to be used.
49+
50+
.. [2] The PCF8523 RTC ``INT1`` interrupt output pin is not connected to ``D7`` by default. A jumper
51+
wire connection must be established between the ``SQ`` pin and the ``Digital I/O 7`` pin in
52+
order to use the RTC interrupt functionality (i.e. alarm callback, 1 pulse per second
53+
callback). The ``INT1`` interrupt output is open-drain, but the shield definition enables an
54+
internal GPIO pull-up and thus no external pull-up resistor is needed.
55+
56+
Requirements
57+
************
58+
59+
This shield can only be used with a board which provides a configuration for Arduino connectors and
60+
defines node aliases for SPI and GPIO interfaces (see :ref:`shields` for more details).
61+
62+
Programming
63+
***********
64+
65+
Set ``-DSHIELD=adafruit_data_logger`` when you invoke ``west build``. For example:
66+
67+
.. zephyr-app-commands::
68+
:zephyr-app: tests/drivers/rtc/rtc_api
69+
:board: frdm_k64f
70+
:shield: adafruit_data_logger
71+
:goals: build
72+
73+
.. _Adafruit Data Logger Shield:
74+
https://learn.adafruit.com/adafruit-data-logger-shield/
75+
76+
.. _NXP PCF8523 Real-Time Clock/Calendar with Battery Backup:
77+
https://www.nxp.com/docs/en/data-sheet/PCF8523.pdf

0 commit comments

Comments
 (0)