cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert the DWT CYCCNT to ns ?

gapryun
Associate II
Posted on July 15, 2014 at 17:26

Dear

I have read Ch16.2 Trace component DWT, the definition guide of Cortex M3 2nd. But I still confuse it. 

If I take the CYCCNT, the corresponding time is CYCCNT * 168 MHz * 1e9 ?

Am I correct?  

Thanks 
3 REPLIES 3
Posted on July 15, 2014 at 17:36

You understand the basic relationship between frequency and period, right?

At 168 MHz each tick is about 5.95ns

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/How%20to%20convert%20the%20systick%20to%20ns&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=5]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fHow%20to%20convert%20the%20systick%20to%20ns&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https%3A%2F%2Fmy.st.com%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FAllItems.aspx¤tviews=5
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gapryun
Associate II
Posted on July 15, 2014 at 17:49

Sorry, clivel, My smartphone have strange problem so it did not submit my question.  For now, I have updated. And thank you for your nice reply.

Posted on July 15, 2014 at 17:58

This forum does not work well with smartphones or tablets

>> CYCCNT * 168 MHz * 1e9

You need to make an initial, and final measurement, and subtract them to understand how many ticks occurred in the measurement period.

Then  (DeltaTicks / 168000000.0) * 1e9 would give you nanoseconds
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..