This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

After OTA , BMP280 reading switches between 0 and correct values.

I have custom board with BMP280 sensor & nrf 52832.I have interfaced BMP280 using twi interface. I am using SDK 15.2.0. and soft devices s132 V6.1.0 to transmit advertising packets with advertising interval 1s. I had the DFU already working. When I program the application via JLink it works perfectly fine, also the download of the application via secure DFU itself doesn't cause any issues. I have referred following link https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader.


I have read BMP280 after every 5 second. My application starts advertising,but BMP280 reading switches between 0 and correct values continuously. If I programmed application with soft device only(without Secure boot loader) it works fine and bme readings didn't switch between 0 and correct values.

Parents
  • Hi Prashant,

    Do you have a logic analyzer ? If you can capture the TWI communication between the nRF52 and the BMP280 after DFU and compare it with the activity before DFU we can find what could be wrong. 

    Do you have the issue even after you reset the device (after DFU) ? The DFU bootloader shouldn't affect TWI communication. 

  • Thanks for quick reply. No ,I don't have logic analyzer. . The snippet on sensor  code as follows. I have used following code in adv_update function.  I am using GPREGRET2 for storing bmp count .can it be the reason for switching bmp values between 0 and correct values?.

    uint32_t  retain_bmp_cnt[1];
    uint32_t      err_code;
    
    err_code = sd_power_gpregret_get(1,retain_bmp_cnt);
    APP_ERROR_CHECK(err_code);
    		
    		retain_bmp_cnt[0]++;
    if(retain_bmp_cnt[0]>= 5)
    {
    	twi_init();
    	set_configeration();
    	updateData();
    	nrfx_twi_disable(&m_twi);
    	err_code = sd_power_gpregret_clr(1,0xFF);
    	APP_ERROR_CHECK(err_code);
    	err_code = sd_power_gpregret_set(1,0);
    	APP_ERROR_CHECK(err_code);
    }
    else
    {
    	err_code = sd_power_gpregret_clr(1,0xFF);
    	APP_ERROR_CHECK(err_code);
    	err_code = sd_power_gpregret_set(1,retain_bmp_cnt[0]);
    	APP_ERROR_CHECK(err_code);
    }
    	

Reply
  • Thanks for quick reply. No ,I don't have logic analyzer. . The snippet on sensor  code as follows. I have used following code in adv_update function.  I am using GPREGRET2 for storing bmp count .can it be the reason for switching bmp values between 0 and correct values?.

    uint32_t  retain_bmp_cnt[1];
    uint32_t      err_code;
    
    err_code = sd_power_gpregret_get(1,retain_bmp_cnt);
    APP_ERROR_CHECK(err_code);
    		
    		retain_bmp_cnt[0]++;
    if(retain_bmp_cnt[0]>= 5)
    {
    	twi_init();
    	set_configeration();
    	updateData();
    	nrfx_twi_disable(&m_twi);
    	err_code = sd_power_gpregret_clr(1,0xFF);
    	APP_ERROR_CHECK(err_code);
    	err_code = sd_power_gpregret_set(1,0);
    	APP_ERROR_CHECK(err_code);
    }
    else
    {
    	err_code = sd_power_gpregret_clr(1,0xFF);
    	APP_ERROR_CHECK(err_code);
    	err_code = sd_power_gpregret_set(1,retain_bmp_cnt[0]);
    	APP_ERROR_CHECK(err_code);
    }
    	

Children
Related