LoRa-E5-Mini-EndNode
所属分类:自然语言处理
开发工具:C
文件大小:19227KB
下载次数:0
上传日期:2021-11-30 07:23:25
上 传 者:
sh-1993
说明: LoRa-E5-小型终端节点,,
(LoRa-E5-Mini-EndNode,,)
文件列表:
.cproject (30386, 2021-11-30)
.mxproject (29102, 2021-11-30)
.project (1277, 2021-11-30)
.settings (0, 2021-11-30)
.settings\language.settings.xml (2345, 2021-11-30)
.settings\stm32cubeide.project.prefs (162, 2021-11-30)
Core (0, 2021-11-30)
Core\Inc (0, 2021-11-30)
Core\Inc\adc.h (1410, 2021-11-30)
Core\Inc\adc_if.h (2668, 2021-11-30)
Core\Inc\aht20.h (708, 2021-11-30)
Core\Inc\board_resources.h (8186, 2021-11-30)
Core\Inc\dma.h (1460, 2021-11-30)
Core\Inc\gpio.h (1383, 2021-11-30)
Core\Inc\i2c.h (1434, 2021-11-30)
Core\Inc\main.h (2900, 2021-11-30)
Core\Inc\platform.h (2384, 2021-11-30)
Core\Inc\rtc.h (1410, 2021-11-30)
Core\Inc\stm32_lpm_if.h (2614, 2021-11-30)
Core\Inc\stm32wlxx_hal_conf.h (11737, 2021-11-30)
Core\Inc\stm32wlxx_it.h (2219, 2021-11-30)
Core\Inc\stm32wlxx_nucleo_conf.h (2408, 2021-11-30)
Core\Inc\subghz.h (1434, 2021-11-30)
Core\Inc\sys_app.h (3599, 2021-11-30)
Core\Inc\sys_conf.h (2936, 2021-11-30)
Core\Inc\sys_debug.h (3376, 2021-11-30)
Core\Inc\sys_sensors.h (2800, 2021-11-30)
Core\Inc\timer_if.h (4765, 2021-11-30)
Core\Inc\usart.h (1958, 2021-11-30)
Core\Inc\usart_if.h (3336, 2021-11-30)
Core\Inc\utilities_conf.h (6020, 2021-11-30)
Core\Inc\utilities_def.h (3345, 2021-11-30)
Core\Src (0, 2021-11-30)
Core\Src\adc.c (3026, 2021-11-30)
Core\Src\adc_if.c (6880, 2021-11-30)
Core\Src\aht20.c (2377, 2021-11-30)
Core\Src\board_resources.c (6281, 2021-11-30)
Core\Src\dma.c (1702, 2021-11-30)
... ...
# LoRa-E5-Mini-EndNode with I2C
## Contents
This is a LoRaWAN end node example for the Seeed LoRa-E5 Mini dev board using
v1.1.0 of the FW. The code provided by Seeed is based on v1.0.0 and
running the STM32 code generation tool Stm32CubeMx undoes some of the
necessary changes to the code which renders the code with many compilation
errors and practically useless.
When testing this device, my test setup included 2 types of sensors:
* AHT20 temperatur & humidity (I use the
[Adafruit breakout](https://www.adafruit.com/product/4566)
This sensor uses I2C.
* PMS - Particle "counter" which communicates using UART.
TODO: search reference for particle sensor.
These sensors can be activated in the code by defining
#define USE_AHT20_SENSOR
#define USE_PMS_SENSOR
in `Core/inc/sys_conf.h`. Without these defines the sensors are not
used and random numbers are transmitted over Lorawan instead, this
is the default setting now.
I have set up this project for the Nucleo STM32WL55 board from scratch
like it is done in v.1.1.0. There are some important changes with
respect to v.1.0.0, CubeMX now only creates a skeleton and the user
adds all necessary code as "user code" to get a functional application.
This renders the code generation tool more versatil and user code and
code automatically generated are clearly separated.
The necessary changes have then been included for the custom board which
differs from the Nucleo board mainly in number of LEDs (1), buttons (1)
and pins necessary to control the radio switch (2 instead of 3).
These code changes have been obtained from the original Seeed
v.1.0.0 version at https://github.com/seeed-lora/LoRa-E5-LoRaWAN-End-Node.git
and have been included as "user code".
The I2C2 and UART peripherals have been added for communicating with
external sensors. User code is provided for initializing and reading
the AHT20 sensor (similar to AHT20 arduino library) and for reading out
the PMS sensor over UART.
Data is transferred over LoRaWAN in CayenneLPP format, as
* 10 * temperature in celsius
* 10 * relative humidity
## Application Setup
There are 2 ways for changing/configuring this application:
* Automatic code generation by running CubeMX (click on the .ioc file,
configure your project and then run code creation). This only affects
code outside of the ranges
/* USER CODE BEGIN xxx */
...
/* USER CODE END xxx */
You would do this for example if you want to add/remove some peripheral like
UART or I2C. You also can configure LoraWan parameters with CubeMX.
* Edit the files manually, but be careful to introduce your changes
ONLY between `USER CODE BEGIN` and `USER CODE END`.
This is usually your application specific code.
This separation between generated and user code is what not works well
in the original code provided by Seeed and was the reason to make this app.
A little hint: Commit your changes before you run the code generation and
check with `git status` and `git diff` what the code generation tool has
changed. This sometimes reveals that you have written "user code" outside
of the specified ranges and that the code generator has just removed this
code.
When on Linux I run `dos2unix` on all text files after code generation.
Otherwise `git status` returns all files, just because of the line endings
generated by the tool. I have not yet found a way to configure this in
STM32CubeIDE.
## LoRaWan settings
These can be set from the configuration tool (.ioc file) in STM32CubeIDE,
selecting "Middleware -> LoraWAN -> LoRaWAN comissioning". These settings
are (over)written to `se-identity.h` upon code creation. So if you intent to
use code creation it is probably better to define your keys here instead of
directly editing `se-identity.h`
* "App/Join EUI" is mapped to LORAWAN_JOIN_EUI
* "Application Key" is mapped to LORAWAN_APP_KEY in se-identity.h
* "Network Key" is mapped to LORAWAN_NWK_KEY
The "Static Device Address" should not be used anyhow for security reasons
and thus network and application session keys will not be used.
If you prefer, you can directly edit `se-identity.h` but it will
be overwritten by code creation. So please don't open an issue "Why does
my device not connect anymore after code creation?" :)
### Settings in "The Things Network" (TTN)
In order to get accepted by TTN the settings in this application need
to correspond to your application setup in TTN. The names map as follows
* TTN "AppEUI" corresponds to LORAWAN_JOIN_EUI in `se-identity.h`
* TTN "DevEUI" corresponds to LORAWAN_DEVICE_EUI in `se-identity.h`
* TTN "AppKEY" corresponds to LORAWAN_APP_KEY in `se-identity.h`
For your device, in "Payload formatters" use "CayenneLPP". This should
be enough to get you up and running. Please let me know if something
important is missing in these instructions.
## License
This software component is licensed by ST under Ultimate Liberty license
SLA0044, the "License"; https://www.st.com/SLA0044.
## Note
This repository is the result of a hackaton at the TTN summer academy 2021,
a nice opportunity to learn LoRaWAN and meet nice people. I have added
the slides for the mini presentation we all gave in file `ForestWatcher.odp`.
## Links
* [The Board](https://wiki.seeedstudio.com/LoRa_E5_mini/)
* [Application Note AN5406](https://www.st.com/resource/en/application_note/dm00660451-how-to-build-a-lora-application-with-stm32cubewl-stmicroelectronics.pdf)
* [AT commands for stock firmware](https://files.seeedstudio.com/products/317990687/res/LoRa-E5%20AT%20Command%20Specification_V1.0%20.pdf)
* [Post in ST community about v1.1.0 vs. v1.0.0](https://community.st.com/s/question/0D53W00000zGZk4SAG/how-to-on-stm32cubefwwlv110)
* [AHT20 datasheet](https://cdn-learn.adafruit.com/assets/assets/000/091/676/original/AHT20-datasheet-2020-4-16.pdf?1591047915)
* [AHT20 arduino library](https://github.com/adafruit/Adafruit_AHTX0)
近期下载者:
相关文件:
收藏者: