cancel
Showing results for 
Search instead for 
Did you mean: 

How to properly add a task to LoRaWAN_End_Node

HNguy.25
Associate III

Hello everyone,

Situation: Currently, I am trying to intergrate BME688 to the board Nucleo-WL55JC1. To be specific, on the board, I downloaded and ran the LoRaWAN_End_Node example. Then, instead of obtaining temperature/humidity/pressure from a function from the example (I assumed the original data obtaining function is EnvSensors_Read(&sensor_data) in lora_app.c), I want to use the sensor BME688 to give me those measurement.

What I did: I initialized the BME688 sensor as well as set up some constrains for it after the MX_LoRaWAN_Init(). Then I set the BME688 data obtaining process as a function and register it as a task. The task has an equal priority as the SendTxData() function.

Result: the program stopped right at the first measurement.

Question:

  1. Was my procedure of intergrating BME688 into LoRaWAN_End_Node example correct or I missed something else? I assume the fault was when I set the BME688 data obtaining process with an equal priority as SendTxData()?
  2. If I was wrong at that part, what else should I consider when adding BME688?

P/s: this post related to this post (https://community.st.com/s/feed/0D53W00001n9fiGSAQ).

I attached main.c and lora_app.c below. 

I hope to have your opinions on this question.

Thank you, Huy Nguyen.

2 REPLIES 2
Bruno_ST
ST Employee

Hello @Community member​ 

In my opinion, if you want to create a new task, add a new entry under CFG_SEQ_Task_Id_t with a new name in Inc/utility_def.h.

If you just need to retreive data from you sensor, then you may just need to call RetrieveBMEData() under SendTxData(), no ?

If you want only that code to be called at regular interval, you can use UTIL_TIMER_Create()

BR,

Bruno

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sorry for replying late. Your second suggestion helped me to finish the task.

Thank you very much, Huy Nguyen.