jliphard / wearable_nRF52_Firmware

This is a native Nordic SDK application for controlling an nRF52-based wearable. It logs data and can also push them to an iPhone.
14 stars 4 forks source link

Code freezes after a few mins of datalogging #1

Open jliphard opened 7 years ago

jliphard commented 7 years ago

Issue not related to either FLASH or ADC. Issue not related to time, since when you slow down the timer, it still freezes after same number of cycles *Might be related to NRF_LOG_DEBUG output, which freezes things after a certain number of characters have been sent to the JLinkRTTClient

jliphard commented 7 years ago

screen shot 2017-07-14 at 2 28 38 pm

always freezes around TH = 288.

jliphard commented 7 years ago

might be related to memory consumption / memory leak somewhere....

jliphard commented 7 years ago

Problem caused by repeated call of BME280_Read_PTH(&resultPTH_1[0]);

something in the underlying TWI/I2C bus....

void readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest) { ret_code_t err_code = 0; //0xF7 to 0xFE (temperature, pressure and humidity) //readBytes(BME280_ADDRESS_1, BME280_PRESS_MSB, 9, &rawData[0]);

m_xfer_done = false;
err_code = nrf_drv_twi_tx(&i2c, address, subAddress, 1, true);
while (m_xfer_done == false) {};

//comes back with error code
//SEGGER_RTT_printf(0, "ReadBytes code: %d\n", err_code);
//here is the problem????
//APP_ERROR_CHECK(err_code);

if (err_code == NRF_SUCCESS)
{
    m_xfer_done = false;
    //NRF_LOG_DEBUG("readBytes - Reading\r\n");
    err_code = nrf_drv_twi_rx(&i2c, address, dest, count);
    //SEGGER_RTT_printf(0, "ReadBytes RX code: %d\n", err_code);
    //APP_ERROR_CHECK(err_code);
    while (m_xfer_done == false) {};
};

//NRF_LOG_DEBUG("readBytes done\r\n");
//NRF_LOG_FLUSH();

}

disabling this cures the problem.... err_code = nrf_drv_twi_rx(&i2c, address, dest, count);

jliphard commented 7 years ago

resolved - was RTC1 issue.