cancel
Showing results for 
Search instead for 
Did you mean: 

ISR function timing period issue

bhavan_kumar
Associate II

Hi 

       We are working on STM32H503 MCU which has ARM Cortex 33. In datasheet it is provided that 12 cycles or instruction to enter into an interrupt function. Configured system clock as 250MHz, with that we could reach an interrupt function within 48ns. But in practical it's taking around 146ns. we have enabled a GPIO pin as high inside the ISR function which takes 5 (20ns) instructions. So, 146ns-20ns = 126ns taking to enter into an ISR function. Please provide me a solution to achieve the interrupt function within 48ns.

 

Regards

Bhavan

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The solution would be to write your code in assembly. Sort of. You'll still have delays.

With C, you're going to have overhead as the function enters, and values are loaded into registers.

Also note there is a delay between the GPIO high instruction executing and the pin actually going high. This is due to the nature of the system trying to be as fast as it can--things are buffered and sent out when possible. This is not analogous to a slow 8-bit microcontroller anymore.

You can also have delays between an edge occurring and the actual ISR getting triggered.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

The solution would be to write your code in assembly. Sort of. You'll still have delays.

With C, you're going to have overhead as the function enters, and values are loaded into registers.

Also note there is a delay between the GPIO high instruction executing and the pin actually going high. This is due to the nature of the system trying to be as fast as it can--things are buffered and sent out when possible. This is not analogous to a slow 8-bit microcontroller anymore.

You can also have delays between an edge occurring and the actual ISR getting triggered.

If you feel a post has answered your question, please click "Accept as Solution".

What does the interrupt/response need to do?

For tight margins, use HW, perhaps a CPLD, or DMA, TIM, PSSI, DCMI

Takes this time to enter, and exit, stack would want to be in TCM. Code that causes a FLASH line fetch, probably going to induce a ~35 ns delay. Put vector table, and code in ITCM

Input pins also have a resynchronizer circuit to allow signals to cross clock domains, figure 3 cycles at GPIO AHB/APB clock.

Again perhaps state a reason/goal that defines what you're doing and why.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..