jakymiwm
(Jakymiwm)
May 10, 2021, 2:08pm
7
Can you please share?
https://www.genericnode.com/docs/
To
https://www.genericnode.com/docs/getting-started/
To
https://www.genericnode.com/docs/getting-started/se-hands-on-guide/
To
Long videos.
I am sorry, I have been looking for how to register the node using the links and the QR code and can not find the information.
descartes
(Nick McCloud)
May 10, 2021, 2:18pm
8
I followed the Sensor Edition Software Setup to get the device running.
It is early days for the documentation as the firmware is developed, I’ve not seen a “Out the box” setup guide, only the programming guide - which gives much of the information for setup with keys etc.
jakymiwm
(Jakymiwm)
May 10, 2021, 3:25pm
9
Thank you @descartes , I will give that a try.
Just try the included examples.
LoRaWAN keys (for relevant examples) are placed in conf/app_conf.h (currently only for OTAA).
1 Like
Baxter
(Baxter)
May 13, 2021, 3:31pm
11
I also got it up and running with the ST-link V2 and the LoRawan example, I see the messages in the console, anyone has a decoder / payload formatter at hand for the example? otherwise I will have to go thru the code
descartes
(Nick McCloud)
May 13, 2021, 5:22pm
12
If you mean the Basic_LoRaWAN (basic_lorawan) code, you should see some real magic in the device console that is instantly decodable without JavaScript because as far as I know, it just sends AA BB CC:
{
UTIL_TIMER_Time_t nextTxIn = 0;
UTIL_TIMER_Create(&TxLedTimer, 0xFFFFFFFFU, UTIL_TIMER_ONESHOT, OnTimerLedEvent, NULL);
UTIL_TIMER_SetPeriod(&TxLedTimer, 200);
// User can add any indication here (LED manipulation or Buzzer)
UTIL_TIMER_Start(&TxLedTimer);
AppData.Port = LORAWAN_APP_PORT;
AppData.BufferSize = 3;
AppData.Buffer[0] = 0xAA;
AppData.Buffer[1] = 0xBB;
AppData.Buffer[2] = 0xCC;
if (LORAMAC_HANDLER_SUCCESS == LmHandlerSend(&AppData, LORAWAN_DEFAULT_CONFIRMED_MSG_STATE, &nextTxIn, false))
{
APP_LOG(ADV_TRACER_TS_ON, ADV_TRACER_VLEVEL_L, "SEND REQUEST\r\n");
}
else if (nextTxIn > 0)
1 Like
Baxter
(Baxter)
May 13, 2021, 5:43pm
13
I actually get this payload 4077580B26800C010290A70921631BF0
I think i should use the freefall, but seems it only has temperature and battery level, no example with all sensors?
descartes
(Nick McCloud)
May 14, 2021, 10:36am
14
Which app did you compile for?
Because …
descartes
(Nick McCloud)
May 14, 2021, 11:07am
15
It occurs to me that you are probably seeing the out-the-box demo payload. The free-fall source only sends a count of free-falls, just one unsigned byte. The README.md in the Software folder only talks about dummy payloads.
I don’t think the source for the startup app has been released …
@elsalahy & @cndrxn , could you put the demo app on GitHub please
1 Like
Baxter
(Baxter)
May 14, 2021, 6:00pm
16
Thx Nick, @elsalahy your video is awesome! I am still struggling with getting all sensor data and sending it, so would really appreciate some demo on that.
1 Like
descartes
(Nick McCloud)
May 14, 2021, 8:13pm
17
Can you answer my questions, it’s the only thing that motivates me to answer further questions …
Baxter
(Baxter)
May 15, 2021, 4:36am
18
Hi Nick, i typed it and delete it yesterday to avoid being the nagging noob
so the payload 4077580B26800C010290A70921631BF0 (and 60% changes) is from the basic_lorawan, i am not able to understand where it comes from yet. I did flash/upload using the cube/stlinkv2 and I flashed the basic with LED and it worked. (I can confirm that it was flashed)
I wanted to use the freefall because it gives an example of reading sensor and sending it… and i think i understand it.
descartes
(Nick McCloud)
May 15, 2021, 3:10pm
20
Neither am I, I’d best go and find a debugger and step my way through the code.
If asked a question a reply is sort of polite and expected, it’s more the reverse, if you’re being hassled with questions, just say so.
This is new product so we all have things to learn about it!
kersing
(Jac Kersing)
May 15, 2021, 10:54pm
21
That is the raw packet as forwarded by the gateway. You need to look at “Uplink Data Message” for the data in the packet. (And that is 0xAA 0xBB 0xCC in my tests)
2 Likes
Baxter
(Baxter)
May 16, 2021, 5:10am
22
Thx Jac, you are right, that was “raw message”
I had to activate the javascript formatter first
and then the message was shown
Thx!
now I need to play around with the sensors
1 Like
descartes
(Nick McCloud)
May 16, 2021, 9:21am
23
There isn’t a JS formatter in the device repository so unless you entered a formatter that would have no effect. All’s that happened here is you’ve looked on the application / device console where the payload is decoded for you.
Have you used the v2 stack much?
Baxter
(Baxter)
May 16, 2021, 2:33pm
24
descartes:
re isn’t a JS formatter in the device repository so unless you entered a formatter that would have no effect. All’s that happened here is you’ve looked on the application / device console where the payload is decoded for you.
Have you used the v2 stack much?
Hi Nick, I see, you are right. I am quite familiar with V2, mixed the “payload” and “Raw payload” in V3.
Baxter
(Baxter)
May 16, 2021, 8:42pm
25
now i’m trying to add read temperature and send over lora
/**
******************************************************************************
* @file lora_app.c
* @author MCD Application Team
* @brief Application of the LRWAN Middleware
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
#include "app.h"
This file has been truncated. show original
but while debugging, i see the SHT is not initializing, i see there might be a reported issue
opened 11:46AM - 31 Jul 20 UTC
technical debt
**Summary:**
Sensor I2C init functions can call BSP init, or the BSP init ca… n be called alone.
Need to add a handling for the senors init functions in case multiple sensors are on the same bus, in order to ensure only one BSP init is called.
**Why do we need this?**
To avoid un-needed re-iinit of the bus and have a coherant implementation.
**What is already there? What do you see now?**
Template init of the sensors.
**What is missing? What do you want to see?**
Flags, function checks, and harmonized implementation.
**How do you propose to implement this?**
<!--
If unsure, add the discussion label and (temporarily) assign the expert
If you cannot assign people, please @mention the experts
-->
- Add Flag if the bus is initialized already,
- Pass the I2C handler as a reference instead of using extern.
- Handle multi-sensor bus init functions checks and returns.
**Environment:**
Baremetal.
**Acceptance Criteria:**
<!--
Please explain the necessary conditions to be satisfied for this feature to be considered implemented.
These may include important test cases that need to pass, expected resource consumption improvements etc.
-->
- Should not affect sensors functionality in any way.
- Basic app must compile and run smothly.
**What can you do yourself and what do you need help with?**
All
will continue next weekend Unless Nick has a hint
cndrxn
(Orkhan Amiraslan)
May 19, 2021, 8:39am
26
@Baxter @descartes a while back I made a hacky branch to add temperature humidity readings and send them over LoRaWAN. The app name is called "basic_lorawan_th
.
This is where all the action happens:
generic-node-se/lora_app.c at feature/basic_lorawan_TH · TheThingsIndustries/generic-node-se (github.com)
static void SendTxData(void)
{
UTIL_TIMER_Time_t nextTxIn = 0;
UTIL_TIMER_Create(&TxLedTimer, 0xFFFFFFFFU, UTIL_TIMER_ONESHOT, OnTimerLedEvent, NULL);
UTIL_TIMER_SetPeriod(&TxLedTimer, 200);
UTIL_TIMER_Start(&TxLedTimer);
// User can add any indication here (LED manipulation or Buzzer)
GNSE_BSP_LED_Toggle(LED_BLUE);
GNSE_BSP_Sensor_I2C1_Init();
sensirion_i2c_init(); // placefiller function
int32_t temperature = 0;
int32_t humidity = 0;
int16_t status = 0;
uint16_t temp_int = 0;
uint16_t humidity_int = 0;
if (SHTC3_probe() != SHTC3_STATUS_OK)
{
APP_PPRINTF("\r\n Failed to initialize SHTC3 Sensor, entering error state\r\n");
GNSE_BSP_LED_On(LED_RED);
while (1)
{
}
}
status = SHTC3_measure_blocking_read(&temperature, &humidity);
if (status == SHTC3_STATUS_OK)
{
//Remove the division by 1000 to observe the higher resolution
APP_PPRINTF("\r\n Measured Temperature: %d'C & Relative Humidity: %d \r\n", temperature/100, humidity/100);
}
else
{
APP_PPRINTF("\r\n Failed to read data from SHTC3 sensor, Error status: %d \r\n", status);
GNSE_BSP_LED_On(LED_RED);
while (1)
{
}
}
temp_int = (uint16_t)((temperature/100)+400); // add offset value for the temp
humidity_int = (uint16_t)(humidity/100);
AppData.Port = LORAWAN_APP_PORT;
AppData.BufferSize = 5;
AppData.Buffer[0] = (uint8_t)(temp_int >> 8 ); // HI byte
AppData.Buffer[1] = (uint8_t)(temp_int & 0xFF); // LO byte
AppData.Buffer[2] = (uint8_t)(humidity_int >> 8 ); // HI byte 2
AppData.Buffer[3] = (uint8_t)(humidity_int & 0xFF); // LO byte 2
AppData.Buffer[4] = 0xAA; // placeholder
if (LORAMAC_HANDLER_SUCCESS == LmHandlerSend(&AppData, LORAWAN_DEFAULT_CONFIRMED_MSG_STATE, &nextTxIn, false))
{
APP_LOG(TS_ON, VLEVEL_L, "SEND REQUEST\r\n");
}
else if (nextTxIn > 0)
{
APP_LOG(TS_ON, VLEVEL_L, "Next Tx in : ~%d second(s)\r\n", (nextTxIn / 1000));
}
}
And simple payload formatter looked like this:
function decodeUplink(input) {
var data = {};
data.temperature = ((input.bytes[0] << 8) + input.bytes[1]-400)/10;
data.humidity = ((input.bytes[2] << 8) + input.bytes[3])/10;
return {
data: data,
};
}
1 Like
Baxter
(Baxter)
May 23, 2021, 8:32pm
27
Thanks Orkhan, works like a charm!
Also love the +400 for temperature, helps get along with temps below zero!
1 Like