User Activity

I am trying to get SMbus communication to work and it works fine most of the time but I have seen that after sometime it gets stuck at I2C event I2C_EVENT_MASTER_BYTE_TRANSMITTING. I have implemented a timeout function which retries event 255 times ...
I am currently trying to put STM8 in sleep mode after 30 minutes if no activity is observed on I2C. I am able to use timer4 to get a delay in ms upto 1 secs but I am unable to get delay in minutes. Do I need to use RTC for this? If so can someone ...