initial commit
This commit is contained in:
commit
22605d6992
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.pio
|
||||||
|
.vscode/.browse.c_cpp.db*
|
||||||
|
.vscode/c_cpp_properties.json
|
||||||
|
.vscode/launch.json
|
||||||
|
.vscode/ipch
|
||||||
10
.vscode/extensions.json
vendored
Normal file
10
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"platformio.platformio-ide"
|
||||||
|
],
|
||||||
|
"unwantedRecommendations": [
|
||||||
|
"ms-vscode.cpptools-extension-pack"
|
||||||
|
]
|
||||||
|
}
|
||||||
18
.vscode/settings.json
vendored
Normal file
18
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"devicetree.h": "c",
|
||||||
|
"lorawan.h": "c",
|
||||||
|
"kernel.h": "c",
|
||||||
|
"device.h": "c",
|
||||||
|
"log.h": "c",
|
||||||
|
"mlx90614.h": "c",
|
||||||
|
"sensor.h": "c",
|
||||||
|
"sht4x.h": "c",
|
||||||
|
"array": "c",
|
||||||
|
"string_view": "c",
|
||||||
|
"initializer_list": "c",
|
||||||
|
"stm32-pinctrl-common.h": "c",
|
||||||
|
"printk.h": "c"
|
||||||
|
},
|
||||||
|
"cmake.sourceDirectory": "C:/Users/xlemmingx/Documents/PlatformIO/Projects/embedded_raumsenor_lorawan/zephyr"
|
||||||
|
}
|
||||||
43
boards/g2h_lorawan_heat_control.json
Normal file
43
boards/g2h_lorawan_heat_control.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"core": "stm32",
|
||||||
|
"cpu": "cortex-m4",
|
||||||
|
"extra_flags": "-DSTM32WL -DSTM32WLxx -DSTM32WLE5xx",
|
||||||
|
"f_cpu": "48000000L",
|
||||||
|
"framework_extra_flags": {
|
||||||
|
"arduino": "-DUSE_CM4_STARTUP_FILE"
|
||||||
|
},
|
||||||
|
"mcu": "stm32wl55jc",
|
||||||
|
"product_line": "STM32WL55xx",
|
||||||
|
"variant": "STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I"
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"default_tools": [
|
||||||
|
"stlink"
|
||||||
|
],
|
||||||
|
"jlink_device": "STM32WL55JC",
|
||||||
|
"onboard_tools": [
|
||||||
|
"stlink"
|
||||||
|
],
|
||||||
|
"openocd_target": "stm32wlx",
|
||||||
|
"svd_path": "STM32WL5x_CM4.svd"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"zephyr"
|
||||||
|
],
|
||||||
|
"name": "G2H LoraWAN Heat Control",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 65536,
|
||||||
|
"maximum_size": 262144,
|
||||||
|
"protocol": "stlink",
|
||||||
|
"protocols": [
|
||||||
|
"jlink",
|
||||||
|
"cmsis-dap",
|
||||||
|
"stlink",
|
||||||
|
"mbed"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": "https://www.st.com/en/evaluation-tools/nucleo-wl55jc.html",
|
||||||
|
"vendor": "ST"
|
||||||
|
}
|
||||||
37
include/README
Normal file
37
include/README
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
This directory is intended for project header files.
|
||||||
|
|
||||||
|
A header file is a file containing C declarations and macro definitions
|
||||||
|
to be shared between several project source files. You request the use of a
|
||||||
|
header file in your project source file (C, C++, etc) located in `src` folder
|
||||||
|
by including it, with the C preprocessing directive `#include'.
|
||||||
|
|
||||||
|
```src/main.c
|
||||||
|
|
||||||
|
#include "header.h"
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Including a header file produces the same results as copying the header file
|
||||||
|
into each source file that needs it. Such copying would be time-consuming
|
||||||
|
and error-prone. With a header file, the related declarations appear
|
||||||
|
in only one place. If they need to be changed, they can be changed in one
|
||||||
|
place, and programs that include the header file will automatically use the
|
||||||
|
new version when next recompiled. The header file eliminates the labor of
|
||||||
|
finding and changing all the copies as well as the risk that a failure to
|
||||||
|
find one copy will result in inconsistencies within a program.
|
||||||
|
|
||||||
|
In C, the convention is to give header files names that end with `.h'.
|
||||||
|
|
||||||
|
Read more about using header files in official GCC documentation:
|
||||||
|
|
||||||
|
* Include Syntax
|
||||||
|
* Include Operation
|
||||||
|
* Once-Only Headers
|
||||||
|
* Computed Includes
|
||||||
|
|
||||||
|
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||||
46
lib/README
Normal file
46
lib/README
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
This directory is intended for project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link into the executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in a separate directory
|
||||||
|
("lib/your_library_name/[Code]").
|
||||||
|
|
||||||
|
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||||
|
| |
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |
|
||||||
|
| |- README --> THIS FILE
|
||||||
|
|
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
Example contents of `src/main.c` using Foo and Bar:
|
||||||
|
```
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||||
|
libraries by scanning project source files.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
14
platformio.ini
Normal file
14
platformio.ini
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env:g2h_lorawan_heat_control]
|
||||||
|
platform = ststm32
|
||||||
|
board = g2h_lorawan_heat_control
|
||||||
|
framework = zephyr
|
||||||
41
src/main.c
Normal file
41
src/main.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include <zephyr/kernel.h>
|
||||||
|
#include <zephyr/device.h>
|
||||||
|
#include <zephyr/devicetree.h>
|
||||||
|
#include <zephyr/sys/printk.h>
|
||||||
|
#include <zephyr/lorawan/lorawan.h>
|
||||||
|
|
||||||
|
void get_unique_dev_eui(uint8_t *dev_eui)
|
||||||
|
{
|
||||||
|
uint32_t uid_l = HAL_GetUIDw0();
|
||||||
|
uint32_t uid_h = HAL_GetUIDw1();
|
||||||
|
|
||||||
|
dev_eui[0] = (uid_h >> 24) & 0xFF;
|
||||||
|
dev_eui[1] = (uid_h >> 16) & 0xFF;
|
||||||
|
dev_eui[2] = (uid_h >> 8) & 0xFF;
|
||||||
|
dev_eui[3] = (uid_h) & 0xFF;
|
||||||
|
dev_eui[4] = (uid_l >> 24) & 0xFF;
|
||||||
|
dev_eui[5] = (uid_l >> 16) & 0xFF;
|
||||||
|
dev_eui[6] = (uid_l >> 8) & 0xFF;
|
||||||
|
dev_eui[7] = (uid_l) & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MAIN */
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
uint8_t deveui[8];
|
||||||
|
|
||||||
|
get_unique_dev_eui(deveui);
|
||||||
|
printk("DevEUI: ");
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
printk("%02X", deveui[i]);
|
||||||
|
}
|
||||||
|
printk("\n");
|
||||||
|
|
||||||
|
/* Delay until next cycle */
|
||||||
|
k_sleep(K_SECONDS(10));
|
||||||
|
}
|
||||||
|
}
|
||||||
11
test/README
Normal file
11
test/README
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
This directory is intended for PlatformIO Test Runner and project tests.
|
||||||
|
|
||||||
|
Unit Testing is a software testing method by which individual units of
|
||||||
|
source code, sets of one or more MCU program modules together with associated
|
||||||
|
control data, usage procedures, and operating procedures, are tested to
|
||||||
|
determine whether they are fit for use. Unit testing finds problems early
|
||||||
|
in the development cycle.
|
||||||
|
|
||||||
|
More information about PlatformIO Unit Testing:
|
||||||
|
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||||
9
zephyr/CMakeLists.txt
Normal file
9
zephyr/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Path to out-of-tree boards definitions
|
||||||
|
set (BOARD_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.13.1)
|
||||||
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
|
project(embedded_raumsenor_lorawan)
|
||||||
|
|
||||||
|
FILE(GLOB app_sources ../src/*.c*)
|
||||||
|
target_sources(app PRIVATE ${app_sources})
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
# Copyright (c) 2020 STMicroelectronics
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BOARD_G2H_LORAWAN_HEAT_CONTROL
|
||||||
|
select SOC_STM32WL55XX
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 STMicroelectronics
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
arduino_header: connector {
|
||||||
|
compatible = "arduino-header-r3";
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
gpio-map-mask = <0xffffffff 0xffffffc0>;
|
||||||
|
gpio-map-pass-thru = <0 0x3f>;
|
||||||
|
gpio-map = <0 0 &gpiob 1 0>, /* A0 */
|
||||||
|
<1 0 &gpiob 2 0>, /* A1 */
|
||||||
|
<2 0 &gpioa 10 0>, /* A2 */
|
||||||
|
<3 0 &gpiob 4 0>, /* A3 */
|
||||||
|
<4 0 &gpiob 14 0>, /* A4 */
|
||||||
|
<5 0 &gpiob 13 0>, /* A5 */
|
||||||
|
<6 0 &gpiob 7 0>, /* D0 */
|
||||||
|
<7 0 &gpiob 6 0>, /* D1 */
|
||||||
|
<8 0 &gpiob 12 0>, /* D2 */
|
||||||
|
<9 0 &gpiob 3 0>, /* D3 */
|
||||||
|
<10 0 &gpiob 5 0>, /* D4 */
|
||||||
|
<11 0 &gpiob 8 0>, /* D5 */
|
||||||
|
<12 0 &gpiob 10 0>, /* D6 */
|
||||||
|
<13 0 &gpioc 1 0>, /* D7 */
|
||||||
|
<14 0 &gpioc 2 0>, /* D8 */
|
||||||
|
<15 0 &gpioa 9 0>, /* D9 */
|
||||||
|
<16 0 &gpioa 4 0>, /* D10 */
|
||||||
|
<17 0 &gpioa 7 0>, /* D11 */
|
||||||
|
<18 0 &gpioa 6 0>, /* D12 */
|
||||||
|
<19 0 &gpioa 5 0>, /* D13 */
|
||||||
|
<20 0 &gpiob 11 0>, /* D14 */
|
||||||
|
<21 0 &gpiob 12 0>; /* D15 */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
arduino_serial: &usart1 {};
|
||||||
|
arduino_i2c: &i2c2 {};
|
||||||
|
arduino_spi: &spi1 {};
|
||||||
8
zephyr/boards/st/g2h_lorawan_heat_control/board.cmake
Normal file
8
zephyr/boards/st/g2h_lorawan_heat_control/board.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# keep first
|
||||||
|
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
|
||||||
|
|
||||||
|
# keep first
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
|
||||||
6
zephyr/boards/st/g2h_lorawan_heat_control/board.yml
Normal file
6
zephyr/boards/st/g2h_lorawan_heat_control/board.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
board:
|
||||||
|
name: g2h_lorawan_heat_control
|
||||||
|
full_name: G2H LoraWAN Heat Control
|
||||||
|
vendor: st
|
||||||
|
socs:
|
||||||
|
- name: stm32wl55xx
|
||||||
@ -0,0 +1,212 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020-2024 STMicroelectronics
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include <st/wl/stm32wl55Xc.dtsi>
|
||||||
|
#include <st/wl/stm32wl55jcix-pinctrl.dtsi>
|
||||||
|
#include "arduino_r3_connector.dtsi"
|
||||||
|
#include "st_morpho_connector.dtsi"
|
||||||
|
#include <zephyr/dt-bindings/input/input-event-codes.h>
|
||||||
|
//#include "g2h_lorawan_heat_control.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "G2H LoraWAN Heat control based on STM32WL55JC-NUCLEO";
|
||||||
|
compatible = "st,stm32wl55-nucleo,g2h_lorawan_heat_control";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,console = &lpuart1;
|
||||||
|
zephyr,shell-uart = &lpuart1;
|
||||||
|
zephyr,sram = &sram0;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
zephyr,code-partition = &slot0_partition;
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
lora0 = &lora;
|
||||||
|
watchdog0 = &iwdg;
|
||||||
|
die-temp0 = &die_temp;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&clk_lsi {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
stm32_lp_tick_source: &lptim1 {
|
||||||
|
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
|
||||||
|
<&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&clk_hsi {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&clk_lse {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&pll {
|
||||||
|
div-m = <1>;
|
||||||
|
mul-n = <6>;
|
||||||
|
div-r = <2>;
|
||||||
|
div-q = <2>;
|
||||||
|
clocks = <&clk_hsi>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&rcc {
|
||||||
|
clocks = <&pll>;
|
||||||
|
clock-frequency = <DT_FREQ_M(48)>;
|
||||||
|
cpu1-prescaler = <1>;
|
||||||
|
cpu2-prescaler = <1>;
|
||||||
|
ahb3-prescaler = <1>;
|
||||||
|
apb1-prescaler = <1>;
|
||||||
|
apb2-prescaler = <1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&lpuart1 {
|
||||||
|
pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
current-speed = <115200>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&i2c1 {
|
||||||
|
status = "okay";
|
||||||
|
pinctrl-0 = <&i2c1_scl_pa9 &i2c1_sda_pa10>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
status = "okay";
|
||||||
|
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||||
|
|
||||||
|
sht4x: sht4x@44 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "sensirion,sht4x";
|
||||||
|
label = "SHT4X Integrated Temp Sensor";
|
||||||
|
reg = <0x44>;
|
||||||
|
repeatability = <2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
mlx90614: mlx90614@5A {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "melexis,mlx90614";
|
||||||
|
label = "MLX90614 Infrared Temp Sensor";
|
||||||
|
reg = <0x5A>;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
&spi1 {
|
||||||
|
pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5
|
||||||
|
&spi1_miso_pa6 &spi1_mosi_pa7>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
&dac1 {
|
||||||
|
pinctrl-0 = <&dac_out1_pa10>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&timers2 {
|
||||||
|
status = "okay";
|
||||||
|
pwm2: pwm {
|
||||||
|
status = "okay";
|
||||||
|
pinctrl-0 = <&tim2_ch4_pb11>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
&adc1 {
|
||||||
|
pinctrl-0 = <&adc_in5_pb1 &adc_in0_pb13>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
st,adc-clock-source = "SYNC";
|
||||||
|
st,adc-prescaler = <4>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&die_temp {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&aes {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&rng {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&iwdg {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&subghzspi {
|
||||||
|
status = "okay";
|
||||||
|
lora: radio@0 {
|
||||||
|
status = "okay";
|
||||||
|
tx-enable-gpios = <&gpioc 4 GPIO_ACTIVE_LOW>; /* FE_CTRL1 */
|
||||||
|
rx-enable-gpios = <&gpioc 5 GPIO_ACTIVE_LOW>; /* FE_CTRL2 */
|
||||||
|
dio3-tcxo-voltage = <SX126X_DIO3_TCXO_1V7>;
|
||||||
|
tcxo-power-startup-delay-ms = <5>;
|
||||||
|
/* High-power output is selected as a consequence of using
|
||||||
|
* tx/rx-enable-gpio to control FE_CTRL1 and FE_CTRL2. Low-power
|
||||||
|
* output would require both FE_CTRL1 and FE_CTRL2 to be high,
|
||||||
|
* which is not currently supported by the driver.
|
||||||
|
*/
|
||||||
|
power-amplifier-output = "rfo-hp";
|
||||||
|
rfo-lp-max-power = <15>;
|
||||||
|
rfo-hp-max-power = <22>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 DT_SIZE_K(32)>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
slot0_partition: partition@8000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00008000 DT_SIZE_K(104)>;
|
||||||
|
};
|
||||||
|
slot1_partition: partition@22000 {
|
||||||
|
label = "image-1";
|
||||||
|
reg = <0x00022000 DT_SIZE_K(104)>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set 16kB of storage (8x2kB pages) at the end of the 256kB of
|
||||||
|
* flash.
|
||||||
|
*/
|
||||||
|
storage_partition: partition@3c000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x0003c000 DT_SIZE_K(16)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&rtc {
|
||||||
|
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>,
|
||||||
|
<&rcc STM32_SRC_LSE RTC_SEL(1)>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&vref {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&vbat {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
#include <zephyr/dt-bindings/pinctrl/stm32-pinctrl.h>
|
||||||
|
#include <st/wl/stm32wl55jcix-pinctrl.dtsi>
|
||||||
|
|
||||||
|
&pinctrl {
|
||||||
|
gpio_pc0: gpio_pc0 {
|
||||||
|
pinmux = <STM32_PINMUX(STM32_PORTC, 0, STM32_GPIO)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
identifier: g2h_lorawan_heat_control
|
||||||
|
name: G2H LoraWAN Heat Control
|
||||||
|
type: mcu
|
||||||
|
arch: arm
|
||||||
|
toolchain:
|
||||||
|
- zephyr
|
||||||
|
- gnuarmemb
|
||||||
|
ram: 64
|
||||||
|
flash: 256
|
||||||
|
supported:
|
||||||
|
- gpio
|
||||||
|
- i2c
|
||||||
|
- spi
|
||||||
|
- arduino_gpio
|
||||||
|
- arduino_i2c
|
||||||
|
- arduino_spi
|
||||||
|
- adc
|
||||||
|
- dac
|
||||||
|
- pwm
|
||||||
|
- counter
|
||||||
|
- dma
|
||||||
|
- watchdog
|
||||||
|
- nvs
|
||||||
|
- lora
|
||||||
|
- rtc
|
||||||
|
vendor: st
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
# enable uart driver
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
|
||||||
|
# enable GPIO
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
# console
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_UART_CONSOLE=y
|
||||||
|
|
||||||
|
# Enable MPU
|
||||||
|
CONFIG_ARM_MPU=y
|
||||||
|
|
||||||
|
# Enable HW stack protection
|
||||||
|
CONFIG_HW_STACK_PROTECTION=y
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Marcin Niestroj
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/dt-bindings/gpio/gpio.h>
|
||||||
|
#include <zephyr/dt-bindings/gpio/st-morpho-header.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
st_morpho_header: st-morpho-header {
|
||||||
|
compatible = "st-morpho-header";
|
||||||
|
#gpio-cells = <2>;
|
||||||
|
gpio-map-mask = <ST_MORPHO_PIN_MASK 0x0>;
|
||||||
|
gpio-map-pass-thru = <0x0 GPIO_DT_FLAGS_MASK>;
|
||||||
|
gpio-map = <ST_MORPHO_L_7 0 &gpioh 3 0>,
|
||||||
|
<ST_MORPHO_L_13 0 &gpioa 13 0>, /* shared with SWD connected to STLINK */
|
||||||
|
<ST_MORPHO_L_15 0 &gpioa 14 0>, /* shared with SWD connected to STLINK */
|
||||||
|
<ST_MORPHO_L_17 0 &gpioa 15 0>,
|
||||||
|
<ST_MORPHO_L_23 0 &gpioc 13 0>,
|
||||||
|
<ST_MORPHO_L_25 0 &gpioc 14 0>,
|
||||||
|
<ST_MORPHO_L_27 0 &gpioc 15 0>,
|
||||||
|
<ST_MORPHO_L_28 0 &gpiob 1 0>,
|
||||||
|
<ST_MORPHO_L_30 0 &gpiob 2 0>,
|
||||||
|
<ST_MORPHO_L_32 0 &gpioa 10 0>,
|
||||||
|
<ST_MORPHO_L_34 0 &gpiob 4 0>,
|
||||||
|
<ST_MORPHO_L_36 0 &gpiob 14 0>,
|
||||||
|
<ST_MORPHO_L_38 0 &gpiob 13 0>,
|
||||||
|
|
||||||
|
<ST_MORPHO_R_1 0 &gpioa 0 0>,
|
||||||
|
<ST_MORPHO_R_2 0 &gpioc 4 0>,
|
||||||
|
<ST_MORPHO_R_3 0 &gpioa 12 0>,
|
||||||
|
<ST_MORPHO_R_4 0 &gpioc 5 0>,
|
||||||
|
<ST_MORPHO_R_5 0 &gpioa 11 0>,
|
||||||
|
<ST_MORPHO_R_11 0 &gpioa 5 0>,
|
||||||
|
<ST_MORPHO_R_12 0 &gpioc 6 0>,
|
||||||
|
<ST_MORPHO_R_13 0 &gpioa 6 0>,
|
||||||
|
<ST_MORPHO_R_14 0 &gpioc 0 0>,
|
||||||
|
<ST_MORPHO_R_15 0 &gpioa 7 0>,
|
||||||
|
<ST_MORPHO_R_16 0 &gpioa 8 0>,
|
||||||
|
<ST_MORPHO_R_17 0 &gpioa 4 0>,
|
||||||
|
<ST_MORPHO_R_19 0 &gpioa 9 0>,
|
||||||
|
<ST_MORPHO_R_21 0 &gpioc 2 0>,
|
||||||
|
<ST_MORPHO_R_22 0 &gpiob 0 0>,
|
||||||
|
<ST_MORPHO_R_23 0 &gpioc 1 0>,
|
||||||
|
<ST_MORPHO_R_25 0 &gpiob 10 0>,
|
||||||
|
<ST_MORPHO_R_26 0 &gpiob 9 0>,
|
||||||
|
<ST_MORPHO_R_27 0 &gpiob 8 0>,
|
||||||
|
<ST_MORPHO_R_28 0 &gpiob 15 0>,
|
||||||
|
<ST_MORPHO_R_29 0 &gpiob 5 0>,
|
||||||
|
<ST_MORPHO_R_30 0 &gpiob 11 0>,
|
||||||
|
<ST_MORPHO_R_31 0 &gpiob 3 0>,
|
||||||
|
<ST_MORPHO_R_33 0 &gpiob 12 0>,
|
||||||
|
<ST_MORPHO_R_35 0 &gpiob 6 0>, /* SB7=ON, SB2=OFF, SB6=OFF */
|
||||||
|
<ST_MORPHO_R_36 0 &gpioa 1 0>,
|
||||||
|
<ST_MORPHO_R_37 0 &gpiob 7 0>, /* SB9=ON, SB4=OFF, SB10=OFF */
|
||||||
|
<ST_MORPHO_R_38 0 &gpioc 3 0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
source [find interface/stlink.cfg]
|
||||||
|
|
||||||
|
transport select hla_swd
|
||||||
|
|
||||||
|
source [find target/stm32wlx.cfg]
|
||||||
|
|
||||||
|
# Debug compatible reset configuration (default)
|
||||||
|
reset_config srst_only srst_nogate
|
||||||
|
|
||||||
|
# Sleep mode compatible reset configuration (stock firmware compatible)
|
||||||
|
# reset_config srst_only srst_nogate connect_assert_srst
|
||||||
10
zephyr/dts/bindings/power-switch.yaml
Normal file
10
zephyr/dts/bindings/power-switch.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
description: GPIO pin to switch a power output on or off
|
||||||
|
|
||||||
|
compatible: "power-switch"
|
||||||
|
|
||||||
|
properties:
|
||||||
|
gpios:
|
||||||
|
type: phandle-array
|
||||||
|
required: true
|
||||||
|
description: |
|
||||||
|
The GPIO connected to the gate driver for the MOSFET.
|
||||||
6
zephyr/g2h_lorawan_heat_control.overlay
Normal file
6
zephyr/g2h_lorawan_heat_control.overlay
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/ {
|
||||||
|
load_switch: load_switch {
|
||||||
|
compatible = "power-switch";
|
||||||
|
gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
};
|
||||||
3
zephyr/prj.conf
Normal file
3
zephyr/prj.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
CONFIG_LORA=y
|
||||||
|
CONFIG_LORAWAN=y
|
||||||
|
CONFIG_LORAMAC_REGION_EU868=y
|
||||||
Loading…
Reference in New Issue
Block a user