element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Internet of Things
  • Technologies
  • More
Internet of Things
Forum How to implement BME688 to LoRaWAN_End_Node on Nucleo-WL55JC1
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Internet of Things to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 3 replies
  • Subscribers 502 subscribers
  • Views 1339 views
  • Users 0 members are here
  • lorawan
  • BME688
  • sensor
  • nucleo
Related

How to implement BME688 to LoRaWAN_End_Node on Nucleo-WL55JC1

huytyskland
huytyskland over 3 years ago

Currently, I am working with an IoT application on the board Nucleo-WL55JC1 with the sensor BME688. The example I am using is LoRaWAN_End_Node downloaded from STM32Cube MX. 

What I did: I initialized the the BME688 and set up some configuration after the initialization of MX_LoRaWAN_Init(). I, then, set up some configuration outside the while loop. I "extern"ed the variables below so that I can used them elsewhere:

struct bme68x_dev bme;
struct bme68x_conf conf;
struct bme68x_heatr_conf heatr_conf;

Order of initialization are below:

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_LoRaWAN_Init();
MX_I2C3_Init();
/* USER CODE BEGIN 2 */
int8_t rslt = bme68x_interface_init(&bme, BME68X_I2C_INTF);
rslt = bme68x_init(&bme);
 
//Set up the measurement
conf.filter = BME68X_FILTER_OFF;
conf.odr = BME68X_ODR_NONE;
conf.os_hum = BME68X_OS_16X;
conf.os_pres = BME68X_OS_1X;
conf.os_temp = BME68X_OS_2X;
rslt = bme68x_set_conf(&conf, &bme);
heatr_conf.enable = BME68X_ENABLE;
heatr_conf.heatr_temp = 300;
heatr_conf.heatr_dur = 100;
rslt = bme68x_set_heatr_conf(BME68X_SEQUENTIAL_MODE, &heatr_conf, &bme);
 
rslt = bme68x_set_op_mode(BME68X_SEQUENTIAL_MODE, &bme);

For obtaining the temperature/pressure/humidity/gas level, I got the data of the sensor in the function SendTxData in the file lora_app.c:

struct bme68x_data data;
  uint32_t del_period;
  uint8_t n_fields;
 
#ifdef CAYENNE_LPP
  uint8_t channel = 0;
#else
  uint16_t pressure = 0;
  int16_t temperature = 0;
  uint16_t humidity = 0;
  uint32_t i = 0;
  int32_t latitude = 0;
  int32_t longitude = 0;
  uint16_t altitudeGps = 0;
#endif /* CAYENNE_LPP */
 
  //EnvSensors_Read(&sensor_data);
  del_period = bme68x_get_meas_dur(BME68X_SEQUENTIAL_MODE, &conf, &bme) + (heatr_conf.heatr_dur * 1000);
  bme.delay_us(del_period, bme.intf_ptr);
  int8_t rslt = bme68x_get_data(BME68X_SEQUENTIAL_MODE, &data, &n_fields, &bme);
  float senTemp = data.temperature;
  float senPres = data.pressure;
  float senHumid = data.humidity;

The problem: as in the code, I set the sensor to work in sequential mode, however, the whole setup stopped working after the first measurement. The same thing happened when I set the sensor to work in parallel mode. Sleep mode worked okay and for Forced mode, I could achieve the first measurement before the sensor turned to sleep mode (correct).

image

Question: Where should I start tracking the problem or how do I fix this problem?

I hope to have responses from you.

Thank you very much, Huy Nguyen.

  • Sign in to reply
  • Cancel
Parents
  • shabaz
    shabaz over 3 years ago

    I have no idea (it is going to be hard for anyone to respond who has not used the same code as you, which will restrict it to very few people perhaps).

    Just from the debug you've shown, there is a 'join failed' error. Could it be that the join to the LoRaWAN network was not possible, and anything BME related is a red herring until you resolve that? You might need to raise this on a ST forum, if it is their stack.

    If it is unrelated to LoRaWAN, then it could be worth creating a simpler non-LoRaWAN small project just to test out your BME code,  and confirm that is working before adding it to the proper project code. That's how I would go about it all.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • huytyskland
    huytyskland over 3 years ago in reply to shabaz

    Hello Shabaz,

    Thank you for your response. First of all, I also had a small project in which I tested the BME688 on the Nucleo board and that project worked well (the project had nothing related to the LoRaWAN_End_Node example). Then I brought the whole code and added to the LoRaWAN_End_Node example and the issue occurred.

    Later, I narrowed the problem down to how to add a task to LoRaWAN_End_Node example. To be specific, I would divide the BME688's operation as tasks and register it to the LoRaWAN_End_Node. I am still stuck at that point.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • huytyskland
    huytyskland over 3 years ago in reply to shabaz

    Hello Shabaz,

    Thank you for your response. First of all, I also had a small project in which I tested the BME688 on the Nucleo board and that project worked well (the project had nothing related to the LoRaWAN_End_Node example). Then I brought the whole code and added to the LoRaWAN_End_Node example and the issue occurred.

    Later, I narrowed the problem down to how to add a task to LoRaWAN_End_Node example. To be specific, I would divide the BME688's operation as tasks and register it to the LoRaWAN_End_Node. I am still stuck at that point.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • ressamendy
    ressamendy 2 months ago in reply to huytyskland

    https://github.com/teapotlaboratories/bwlr1e

    You can find bme688 and the Lorawan project at this address. The project also includes solar energy support. It also includes schematics and code. I think examining the code will be helpful.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube