Questions about library

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Questions about library

跳至解决方案
2,274 次查看
a8Chcx
Contributor V

Hi,

 

I have the following questions about Fusion Library 5.0:

1) Systick shows 53 for 9 axis fusion. Does it mean the function for 9 axis fusion need (53/120MHz)==0.44uS to run once?

2) Fusion task is lower priority than sampling task, will be interrupt by sampling task. I tested the time required to read ACC around 237uS. If the fusion task is interrupted by sampling task, the systick should be much longer?

3) My own project is not using MQX. I am using PIT0/1/2 for data sampling, fusion and MAGCal. PIT0 priority is higher than PIT1/2. PIT1 priority is higher than PIT2.

When I call 9 axis fusion function, it takes around 1.6ms? Why does it make so big difference?

 

Thanks,

 

Christie

标签 (1)
0 项奖励
回复
1 解答
2,017 次查看
a8Chcx
Contributor V

Hi Mike,

I found the reason. I need to use -O3 instead of -O0 to do the optimization. Now almost the same as demo project...

Thanks,

Christie

在原帖中查看解决方案

0 项奖励
回复
4 回复数
2,017 次查看
michaelestanley
NXP Employee
NXP Employee

Christie,

In order:

  1. You're off by a few orders of magnitude.  The display is in K-ticks.  So 53,000/120,000,000 = 0.44ms.  And yes, this is the time for the fusion to run once.
  2. Well not much, as we see the fusion task is longer than you thought.  But conceptually, yes.  On the K64F, which I think you are using, there's generally enough time between two consequtive samples to run the fusion without interruption.
  3. You've got your priorities straight.  Are you measuring time using the systick counter here, or via a scope and GPIO?  If the latter, my first question is "What frequency have you programmed the MCU's clock to?"  If the former, what systick count are you getting?   FYI, the numbers in the datasheet exclude the magnetic calibration and sensor sampling tasks.

Mike

0 项奖励
回复
2,017 次查看
a8Chcx
Contributor V

Hi Mike,

1) My mistake. in K-ticks, the measuring time is reasonable.

2) I measure the timing between your demo project and my own project:

-----Sampling time in my project is about 1183uS===7100/60MHz.

-----9-axis data fusion in my project==1600uS==95700/60MHz, in your demo project==442uS

-----6-axis GB data fusion in my project==317uS==19000/60MHz, in your demo project==94uS

-----9-axis GY data fusion in my project===96uS==5750/60MHz, in your demo project==25uS

All functions in both projects are working fine. Do you think that there is any performance difference in data fusion result?

3) I am using KDS 3.0.0 and KSDK 1.2.0 to develop my own project. Both projects are running on the same demo board. In my project, I am using 120MHz for core, 60 MHz for BUS clock. I am using 60MHz for PIT0/1/2. I am using PIT0 ticks to measure the time. My measuring time is just for data fusion function.

Is possible to be related to CPU floating setting or math library difference between two projects?

Thanks,

Christie

0 项奖励
回复
2,018 次查看
a8Chcx
Contributor V

Hi Mike,

I found the reason. I need to use -O3 instead of -O0 to do the optimization. Now almost the same as demo project...

Thanks,

Christie

0 项奖励
回复
2,017 次查看
michaelestanley
NXP Employee
NXP Employee

That will do it!  Glad the mystery has been cleared up.

Mike

0 项奖励
回复