Rogue I2C read starting when I force Zephyr to shut down

Hi,

I'm using SDK 2.1.0 for this project.

I found that when I shut down using the following:

pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0}); // Force a hard off where the interrupt wakeup resets the processor
I am getting an unexpected I2C read starting on my I2C bus. I have both a periodic k_work_delayable task that does a manual read on this bus, and also an interrupt service routine that kicks off a worker to do the same.
Before I shut down I turn off my ISR and I cancel my delayable task, so I don't think there's a pending read trying to kick off, but that's my best guess about why it's happening. I also tried adding a global variable in my task that performs the read so that if my shutting_down variable is true it skips the read.
 
Do you have any ideas on how to make sure I don't have a pending read or task before shutting down, or any thoughts on why this kicks off when I call the shutdown function? Maybe part of shutting down is to hurry up and close out any pending tasks?
Thanks,
Glen
Related