Skip to content

Commit

Permalink
boards: lilygo: ttgo_lora32: enable SDHC support
Browse files Browse the repository at this point in the history
enable support for the SDHC controller to use the micro SD card slot

documentation: added instructions for SD card and OLED samples

Signed-off-by: Lothar Felten <lothar.felten@gmail.com>
  • Loading branch information
lfelten committed Oct 9, 2024
1 parent 029540a commit 1e38289
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 4 deletions.
26 changes: 23 additions & 3 deletions boards/lilygo/ttgo_lora32/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ of the Lilygo TTGO LoRa32 board.
+------------------+-------------------------------------------------------------------------+
| Power Switch | Sliding power switch. |
+------------------+-------------------------------------------------------------------------+
| LCD screen | Built-in OLED display \(`SSD1306`_, 0.96", 128x64 px\) controlled |
| OLED display | Built-in OLED display \(`SSD1306`_, 0.96", 128x64 px\) controlled |
| | by I2C interface |
+------------------+-------------------------------------------------------------------------+
| SX1276/SX1278 | LoRa radio frontend chip, connected via SPI. |
| | Use SX1276 for 433MHz and SX1276 for 868/915/923MHz. |
+------------------+-------------------------------------------------------------------------+
| TF card slot | TF card slot wired to the SD interface of the MCU. |
| TF card slot | TF card slot wired to the SDHC interface of the MCU. |
+------------------+-------------------------------------------------------------------------+


Expand Down Expand Up @@ -205,7 +205,7 @@ message in the monitor:
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
Hello World! ttgo_lora32
LoRa samples
Code samples
============

There are two LoRa samples that will work out of the box with this board.
Expand All @@ -230,6 +230,26 @@ To build the LoRa receive sample application using sysbuild use the command:
:west-args: --sysbuild
:compact:

The following sample application lists the contents of the SD card:

.. zephyr-app-commands::
:tool: west
:zephyr-app: samples/subsys/fs/fs_sample
:board: ttgo_lora32/esp32/procpu
:goals: build
:west-args: --sysbuild
:compact:

The following sample application displays numbers on the OLED display:

.. zephyr-app-commands::
:tool: west
:zephyr-app: samples/subsys/display/cfb
:board: ttgo_lora32/esp32/procpu
:goals: build
:west-args: --sysbuild
:compact:

Debugging
*********

Expand Down
8 changes: 7 additions & 1 deletion boards/lilygo/ttgo_lora32/ttgo_lora32-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,11 @@
output-high;
};
};

sdhc0_default: sdhc0_default {
group1 {
pinmux = <SDHC0_CD_GPIO34>;
bias-pull-up;
output-high;
};
};
};
1 change: 1 addition & 0 deletions boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ testing:
- cmsis_rtos
- jwt
- zdsp
- sdhc
vendor: lilygo
26 changes: 26 additions & 0 deletions boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
uart-0 = &uart0;
i2c-0 = &i2c0;
watchdog0 = &wdt0;
sdhc0 = &sdhc1;
lora0 = &lora0;
};

Expand All @@ -28,6 +29,7 @@
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,display = &ssd1306_128x64;
zephyr,sdhc = &sdhc1;
};

leds {
Expand Down Expand Up @@ -121,6 +123,30 @@
status = "okay";
};

&sdhc {
sdhc1: sdhc@1 {
status = "okay";

pinctrl-0 = <&sdhc0_default>;
pinctrl-names = "default";
power-delay-ms = <100>;
max-bus-freq = <52000000>;
bus-width = <4>;

clk-pin = <14>;
cmd-pin = <15>;
d0-pin = <2>;
d1-pin = <4>;
d2-pin = <12>;
d3-pin = <13>;

mmc {
compatible = "zephyr,sdmmc-disk";
status = "okay";
};
};
};

&flash0 {
status = "okay";
partitions {
Expand Down
1 change: 1 addition & 0 deletions boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ supported:
- display
- lora
- nvs
- sdhc
testing:
ignore_tags:
- net
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ CONFIG_UART_CONSOLE=y

CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_ESP32_USE_UNSUPPORTED_REVISION=y

0 comments on commit 1e38289

Please sign in to comment.