I am working in spartan 6 XC6SLX45 . I have instantiated microblaze processor and programs it through Xilinx Software development kit. I have enabled cache for external DDR access where my .bss segments are stored. I have a timer running . The reset value of timer is set as per my requirement of 9.48 us. The interrupt handler was working fine with time period as required. Until I called a function that resides in another file. When I called the function again handler finishes execution in some 7us but gets triggered only after some 11us each time. Totally the handler gets called in every 18us. Why does this happen? Any suggestions welcome..
I noticed one more thing. I removed every other content in my interrupt handler and retained just a toggle variable. Then the time period is correct 9.48us. When I introduced a simple for loop like for(i=0.i<num;I++); in the handler the handler is called every 9.48us when num =8 and all. When num is value like 15 the handler is called in 9.48us most of time ,sometimes it switches in more time randomly. If I disable cache then the handler is called in same time interval everytime (not 9.48 us , some larger time due to DDR access). Someone please suggest a solution.