Can I use two TIM Channels at the same time?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can I use two TIM Channels at the same time?

908 Views
eungsoolee
Contributor II

Hi 

 

I have a question.

 

---------------------------
Test environment

CPU: S12ZVMC128
Sensor: Hall Sensor Type
Communication: CAN

-----------------------------------------------

The simulation situation is as follows.
CAN RX MSG ID: 0x01, 0x03, 0x04
CAN TX MSG ID:
    Period (2.5ms): 0x07, 0x09
    Period (10ms): 0x06, 0x08

Hall Signal Capture using Hall Sensor Port.

 

- Problem situation
  When the CAN Function Module and the Hall Sensor Capture Module are individually tested, they operate without problems. However, the Hall Sensor Port block does not work when two modules are integrated and tested.

 

1) .Is there a problem with MBD Toolbox when using two TIM channels?

 

2) If there is a problem, how should I send CAN MSG with periodicity?

 

Attach the Test Program below.
Please check and advise if anything goes wrong.

 

I will be waiting for reply.

Original Attachment has been moved to: TestProgram.mdl.zip

0 Kudos
1 Reply

803 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi eungsoolee‌,

1) .Is there a problem with MBD Toolbox when using two TIM channels?

 ANS: It should not be - even when you have tested the HALL alone in fact you have used 2 TIM Channels

- TIM.1 for Hall captures

- TIM.0 for system clock/timer to trigger the Simulink step function on (fixed step parameter)

If you allow me a small observation about your hall modelling - you should also have a TIM overflow block to check if the counter overflows in case you want to compute a speed like information from Hall sensors (especially at slow speeds)

2) If there is a problem, how should I send CAN MSG with periodicity?

For the RX path i would probably have used a CAN Receive Data Trigger block to get the RX msg based on a interrupt when a new msg is received.

For TX path it is correct to use a TIM 

Coming back to you issue - first thing i your try is to profile the application using the Profile Function and the Freemaster to check if the execution of each subsystem is matching your design constrains and no overflow occurs.

Then, for debugging the application i your turn to CodeWarrior MCU with attach option enabled to see the PC flow.

Hope this helps!

Daniel

0 Kudos