Blocking behavior when intergrating BME688 to Nucleo board

Viewed 28

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).

What I got from hterm is as below:

APPLICATION_VERSION: V1.2.0 MW_LORAWAN_VERSION: V2.4.0 MW_RADIO_VERSION: V1.2.0 L2_SPEC_VERSION: V1.0.4 RP_SPEC_VERSION: V2-1.0.1

OTAA
AppKey: 2B:7E:15:16:28:AE:D2:A6:AB:F7:15:88:09:CF:4F:3C
NwkKey: 2B:7E:15:16:28:AE:D2:A6:AB:F7:15:88:09:CF:4F:3C
ABP
AppSKey: 2B:7E:15:16:28:AE:D2:A6:AB:F7:15:88:09:CF:4F:3C
NwkSKey: 2B:7E:15:16:28:AE:D2:A6:AB:F7:15:88:09:CF:4F:3C
IDs
DevEui: 00:80:E1:15:05:00:56:CE
AppEui: 01:01:01:01:01:01:01:01
DevAddr: 05:00:56:CE 0s036:TX on freq 868300000 Hz at DR 0

1s521:MAC txDone

6s554:RX_1 on freq 868300000 Hz at DR 0

6s752:IRQ_RX_TX_TIMEOUT

6s752:MAC rxTimeOut

7s554:RX_2 on freq 869525000 Hz at DR 0

7s752:IRQ_RX_TX_TIMEOUT

7s752:MAC rxTimeOut

= JOIN FAILED 11s323:VDDA: 254

11s323:temp: 26

11s327:TX on freq 868100000 Hz at DR 0

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.

0 Answers
Related