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

Issue while reading data from ICM20948 after power cycle.

Hi,

I am using nrf52832 with icm20948 (I2C) on custom board and I am using icm20948 for angle measurement. For custom application I added some features i.e, before reading the door angle I need to write some global data into nrf internal flash and then I am setting  flag to start angle measurement. First time when I load the code no issue everything seems to be fine, but after power cycle  I need follow the same procedure i.e,  before reading the door angle I need to write some global data into nrf internal flash and then setting  flag to start angle measurement but at this time when I open the door, angle measurement is wrong. Also I have tested without writing global data into flash at that time its working fine, I have tested for more than 10 power cycle every time its working fine. 

But  after writing data into flash, once when power cycle is asserted door angle is not proper. Please let me know where i am missing. Let me know if any information is required from my end. 

Thanks

  • Hi

    Have you done any debugging to try and find out what is causing this? Are you writing the door angle to flash as well or are you using some peripheral to read it straight from the sensor, and how are you reading this measurement? Are you able to see an error code at all while debugging? How exactly, is the angle measurement wrong? Is it shifted or just corrupt/invalid?

    Best regards,

    Simon

  • Hi Simon, thank you so much for your response 

    One thing I forgot to inform  I am using freeRTOS in our project!!

    No I am not writing door angle to flash and I am sending door angle to nordic connect app over BLE. Data from ICM20948 is read using I2C and it is copied to one of the global variable and this variable is over written when door angle increase or decrease, that data is update to mobile app over BLE , no other peripherals are use to read data from sensor.  I am using interrupt method to read angle once I open the door ICM20948 will wake up and start reading the door angle , but after power cycle I need to set the door angle read flag at that time I am writing data into flash and then only it can read the angle, after this process, if I open the door, angle will read continuously though door is at stand still but angle reading continue to increase!!! 

    thanks  

  • Hi again

    Thank you for the update. Can you try commenting out just the flash write function (sd_flash_write or whatever you're using) in your application (just the single line calling the flash write), and see if you can still see these continuous readings. Our guess is that there is something before or after the flash write has occurred that causes the flag to be set to a wrong value, triggering these readings.

    Best regards,

    Simon

  • Thank you Simonr ,

    I have fixed that issue by removing ICM20948 data, that was writing into flash. 

Related