cancel
Showing results for 
Search instead for 
Did you mean: 

How can I know the elapsed time between breakpoints in EWARM?

Ken Inoue
Associate III
Posted on October 19, 2017 at 12:25

How can I know the elapsed time between breakpoints in EWARM?

1 ACCEPTED SOLUTION

Accepted Solutions
S.Ma
Principal
Posted on October 19, 2017 at 15:37

On a general note, I think the core has a CYCLECOUNT register which needs to be enabled. By substracting the values between breakpoints (or even stored on a global variable), knowing the core clock frequency can yield the time between two points in the code. (with global variable, max value can be also tracked over some operating time). For IAR specifics, don't know.

View solution in original post

4 REPLIES 4
S.Ma
Principal
Posted on October 19, 2017 at 15:37

On a general note, I think the core has a CYCLECOUNT register which needs to be enabled. By substracting the values between breakpoints (or even stored on a global variable), knowing the core clock frequency can yield the time between two points in the code. (with global variable, max value can be also tracked over some operating time). For IAR specifics, don't know.

Posted on October 19, 2017 at 16:54

Yes, ST's M3 and M4 designs have the DWT_CYCCNT, one could use the BKPT instruction and time tag specific points in the code, and report the delta time in R0, for example.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on October 20, 2017 at 12:43

Dear Mr./Ms. KIC8462852 EPIC204278916

Thank you for your reply. I found 

CYCLECOUNT register. I enabled the CYCLECOUNT register by setting the DWT Control register's CYCNTENA bit (DWT_CTRL.CYCNTEN) to 1. 

But I have something I can not understand. I made a program that flashes the LED by TIM counter overflow every 500 ms. Below is the interrupt part of the program. I set a breakpoint here.

0690X00000608VsQAI.png

And as shown in the picture below, I was able to get CCSTEP = 134. 

0690X00000608jmQAA.png

But what does this 134 mean? I am using STM32F401RETx Nucleo-F401RE, and SYSCLK is 84MHz. 

0690X00000608hSQAQ.png

So, 134/(84*10^6)=1.595us. I want this answer to be 500 ms. 

Best Regards,

Ken Inoue

Posted on October 20, 2017 at 12:53

Dear Mr./Ms. Clive One

Thank you for your reply. First, I would like you to see my answer to Mr./Ms.KIC 8462852 EPIC 204278916. As written there, I made a program that flashes the LED by TIM counter overflow every 500 ms. And I got the picture below. 

0690X00000608hXQAQ.png

what does this 134 mean?

Best Regards,

Ken Inoue