Skip to content

Commit

Permalink
boards: heltec_wifi_lora32_v2: enable lora
Browse files Browse the repository at this point in the history
This enables the support for the Semtech SX1276 chip on board (see the
pinout[1] and schematic[2] documents).

The chip is connected to SPI as follow:

| PIN  | GPIO   |
| ---- | -------|
| CS#  | GPIO18 |
| CLK  | GPIO5  |
| MOSI | GPIO27 |
| MISO | GPIO19 |
| RST# | GPIO14 |

Additionally, the LoRa DIO PINs are connected as follow:

| PIN  | GPIO   |
| ---- | -------|
| DIO0 | GPIO26 |
| DIO1 | GPIO35 |
| DIO2 | GPIO34 |

_Note_: The first three DIO PINs are connected to the ESP32 MCU only.

[1]: https://resource.heltec.cn/download/WiFi_LoRa_32/WIFI_LoRa_32_V2.1.pdf
[2]: https://resource.heltec.cn/download/WiFi_LoRa_32/V2/WIFI_LoRa_32_V2(868-915).PDF

Signed-off-by: Gaël PORTAY <[email protected]>
  • Loading branch information
gportay authored and carlescufi committed Oct 31, 2022
1 parent ac76c27 commit cd9d2db
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
};
};

spim3_default: spim3_default {
group1 {
pinmux = <SPIM3_MISO_GPIO19>,
<SPIM3_SCLK_GPIO5>;
};
group2 {
pinmux = <SPIM3_MOSI_GPIO27>;
output-low;
};
};

i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_GPIO4>,
Expand Down
25 changes: 24 additions & 1 deletion boards/xtensa/heltec_wifi_lora32_v2/heltec_wifi_lora32_v2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
led0 = &led0;
sw0 = &button0;
watchdog0 = &wdt0;
lora0 = &lora0;
};

leds {
Expand Down Expand Up @@ -56,7 +57,6 @@
};
};


&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
Expand Down Expand Up @@ -89,6 +89,29 @@
pinctrl-names = "default";
};

&spi3 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-0 = <&spim3_default>;
pinctrl-names = "default";
cs-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
lora0: lora@0 {
compatible = "semtech,sx1276";
reg = <0>;
reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
dio-gpios =
/* SX1276 D0 -> GPIO26 */
<&gpio0 26 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
/* SX1276 D1 -> GPIO35 */
<&gpio1 3 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
/* SX1276 D1 -> GPIO34 */
<&gpio1 2 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
spi-max-frequency = <1000000>;
power-amplifier-output = "pa-boost";
};
};

&flash0 {
status = "okay";
partitions {
Expand Down

0 comments on commit cd9d2db

Please sign in to comment.