FTM Input Edge Capture - Stops working with FTM Input TOF ISR and ADC

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FTM Input Edge Capture - Stops working with FTM Input TOF ISR and ADC

ソリューションへジャンプ
3,322件の閲覧回数
Sam_ECU
Contributor V

Hallo,

I've an application using the FTM Input Edge Capture Block to measure the tooth of a crankshaft.   Within the model is also an ADC Block to measure the voltage of the passive crankshaft sensor.  The application is working in Freemaster and with an oscilloscope.

Sam_ECU_0-1634657280077.png

Sam_ECU_1-1634657313908.png

Below a screenshot of the timestamp from the FTM Input Edge.

Sam_ECU_2-1634657425420.png

I've encountered two issues that I need help with.

 

Issue #1

As soon as I add a FTM Input TOR ISR to the model, the FTM Input Edge Capture appears in the application to generate rubbish (Freemaster + Oscilloscope).  Generally it looses all connection to the board in Freemaster as well. The Block has been used as in the example "ftm_hall_sensor_tof_s32k14x.slx".  It's the only change to the model.

Sam_ECU_4-1634657651169.png

What is the issue?

 

Issue #2

As soon as I change ADC Block to generate the data from the Potentiometer on the evaluation board (rather then look at the other sensor), the FTM Input Edge Capture appears in the application to generate rubbish or nothing at all. It's the only change to the model.

Sam_ECU_5-1634658381117.png

Sam_ECU_6-1634658511749.png

What is the issue?

 

 

 

タグ(5)
0 件の賞賛
返信
1 解決策
3,234件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @Sam_ECU ,

The issue you are facing is caused by the Simulink priorities of the blocks, taken in account by the Embedded coder when generating the code. The FTM Input TOF ISR block has priority 1, while the FTM has no priority so it will first generate the code for the TOF ISR.

mariuslucianand_1-1635788854991.pngOf course, at first glance, there should be no issue here because both of the blocks are not executed every step time. But the problem is that in the initialize function, the code will start first to enable the TOF interrupt in the FTM and then to enable the FTM peripheral which causes the issue you may see with the board. 

So please set the priority value 1 for the FTM input Edge Capture and priority 2 for the TOF ISR, and this should solve the issue. 

Hope this helps,

Marius

 

元の投稿で解決策を見る

0 件の賞賛
返信
7 返答(返信)
3,253件の閲覧回数
Hansen110
Contributor I

But with that not only did I get Channel 0 capture events for the missing edges, I also got Channel 1 capture events for them.  Until now Channel 0 was configured for input capture with no edges (ELS0A and ELS0B = 00) which apparently not only disables the Channel 0 capture function, it also disconnects the Channel 0 input from the XOR feeding Channel 1.Now it appears that my code is working correctly with Channel 0 configured for capturing both edges (probably any configuration for Channel 0 except ELS0A,B = 00 would work.

 

sky light pay card

0 件の賞賛
返信
3,310件の閲覧回数
Sam_ECU
Contributor V

Changing to Module 2 and another channel I've been able to make the ADC-Potentiometer work.

The TOF just causes the board to timeout and the code to not work at all.

 

0 件の賞賛
返信
3,300件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @Sam_ECU 

Can you please share with me the model which is not working with the FreeMaster?

Regards,

Marius

0 件の賞賛
返信
3,270件の閲覧回数
Sam_ECU
Contributor V

Hello @mariuslucianand 

Please find attached.

One model is without the FTM Timer Overflow Block.  Works fine.

The second model is with the FTM Timer Overflow Block.  It corrupts the code and can't make any connection to freemaster.

0 件の賞賛
返信
3,235件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @Sam_ECU ,

The issue you are facing is caused by the Simulink priorities of the blocks, taken in account by the Embedded coder when generating the code. The FTM Input TOF ISR block has priority 1, while the FTM has no priority so it will first generate the code for the TOF ISR.

mariuslucianand_1-1635788854991.pngOf course, at first glance, there should be no issue here because both of the blocks are not executed every step time. But the problem is that in the initialize function, the code will start first to enable the TOF interrupt in the FTM and then to enable the FTM peripheral which causes the issue you may see with the board. 

So please set the priority value 1 for the FTM input Edge Capture and priority 2 for the TOF ISR, and this should solve the issue. 

Hope this helps,

Marius

 

0 件の賞賛
返信
3,195件の閲覧回数
Sam_ECU
Contributor V

Hallo @mariuslucianand 

That was indeed the issue and makes perfect sense.

As an information point, the example provided in "ftm_hall_sensor_tof_s32k14x.slx" has the priority set as 1 for the "FTM Timer Overflow" Block.

Also, when I import the "FTM Timer Overflow" Block from the MBDT-Toolbox, by default the priority is set as 1.

Thanks for the help.

Sam

0 件の賞賛
返信
3,170件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @Sam_ECU,

I am glad it works now!

Also, thank you for noticing the priority behavior with a freshly added block from our Simulink Library, I will open an internal ticket for that!

Regards,

Marius

0 件の賞賛
返信