Execution Measurement on MBDT KVx

cancel
Showing results for 
Search instead for 
Did you mean: 

Execution Measurement on MBDT KVx

Jump to solution
86 Views
CauTran
Contributor I

Hi, 

I want to measure the execution time for my application based on MBDT KVx. 

How can I do this one? 

0 Kudos
1 Solution
67 Views
nxa11767
NXP Employee
NXP Employee

Hi @CauTran ,

 

We currently don't have enabled for the toolbox the Code execution profiling support, but you can try to use the Timer blocks to measure the execution time of a subsystem.

You can configure for e.g the PIT timer from MCUX configuration Tool in free running mode (set the period to the max value)

nxa11767_5-1637841903292.png

 

In the model, place all your code in a subsystem for e.g; add the Start/Stop Timer block - one block that will start the timer and another to stop the timer and a register read block to read the CVAL0 value (if channel 0 enabled). Add priorities to the blocks and subsystems (right click on the block/subsystem and set Priority)- Start Timer higher priority ( 0 - is highest priority), then your subsystem that you want to measure, the Read Register block and last Stop Timer block. You need to read first the CVAL0 register and then stop the Timer, because the StopTimer call will reset the registers.

nxa11767_0-1637840664693.png

 

And to get number of ticks you just need to substract from max timer value the value of CVAL0 (PIT timer counts down - at start is equal with period set in configuration tool and goes down from there).

nxa11767_4-1637841749910.png

 

Hope this helps,

Alexandra

 

View solution in original post

0 Kudos
3 Replies
54 Views
CauTran
Contributor I

Hi @nxa11767 , 

Can you give me this example for that topic? 

Thank you so much.

0 Kudos
35 Views
nxa11767
NXP Employee
NXP Employee

Hi @CauTran ,

See attached the example. It has also a freemaster block to see the counted ticks variable. 

 

BR,
Alexandra

0 Kudos
68 Views
nxa11767
NXP Employee
NXP Employee

Hi @CauTran ,

 

We currently don't have enabled for the toolbox the Code execution profiling support, but you can try to use the Timer blocks to measure the execution time of a subsystem.

You can configure for e.g the PIT timer from MCUX configuration Tool in free running mode (set the period to the max value)

nxa11767_5-1637841903292.png

 

In the model, place all your code in a subsystem for e.g; add the Start/Stop Timer block - one block that will start the timer and another to stop the timer and a register read block to read the CVAL0 value (if channel 0 enabled). Add priorities to the blocks and subsystems (right click on the block/subsystem and set Priority)- Start Timer higher priority ( 0 - is highest priority), then your subsystem that you want to measure, the Read Register block and last Stop Timer block. You need to read first the CVAL0 register and then stop the Timer, because the StopTimer call will reset the registers.

nxa11767_0-1637840664693.png

 

And to get number of ticks you just need to substract from max timer value the value of CVAL0 (PIT timer counts down - at start is equal with period set in configuration tool and goes down from there).

nxa11767_4-1637841749910.png

 

Hope this helps,

Alexandra

 

View solution in original post

0 Kudos