S32K144 time configuration

cancel
Showing results for 
Search instead for 
Did you mean: 

S32K144 time configuration

Jump to solution
124 Views
Contributor I

I want to know  the execution sequence(the temporal logic) if I use the Funtion-Call Generator in a model.

And Can you tell me the difference between the Funtion-Call Generator and the Interrupt_Timer? Can the Function-Call  be used as the Interrupt_Timer?

I also want to know if there is a difference between MBD and the common-used "main" function. 

pastedImage_3.pngpastedImage_1.pngpastedImage_2.png

1 Solution
70 Views
NXP Employee
NXP Employee

Hello 1750632@tongji.edu.cn ,

The function call generator is going to trigger a subsystem by a 'software interrupt' if you may, while the PIT block will use a hardware trigger to call your subsystem. This is the main difference between them - software vs hardware scheduling.

Now for the fixed-step size, that is the parameter that controls the main loop period. Let me quickly go over the main parts of the code generated by our toolbox:

 
pastedImage_2.png

 

  • Step – a function called periodically, with a frequency controlled by the Discrete Step value set in the model -- this is the main loop
  • Interrupts – asynchronous events that can be further grouped into 2 categories:
    • Events that occur at a known period – e.g. a LPIT block that is used to trigger the Fast loop system for motor control applications – the important part is that you control the frequency at which this event occurs
    • Events that have an unknown period – e.g. receiving a message via UART/SPI/I2C/etc. – this is something that you have no control over, it can happen any time
  • Initialization – this is a function called only once, at the beginning
  • IDLE – this is the time period in which the Step function finished execution and awaits to be re-triggered and you have no ISR to execute (no such events were generated)

As for the main function, you can find it implemented in mbd_main.c file - there you'll see the initialization for the PIT block that will control the main loop.

Hope this is helpful.

Kind regards,

Razvan.

View solution in original post

1 Reply
71 Views
NXP Employee
NXP Employee

Hello 1750632@tongji.edu.cn ,

The function call generator is going to trigger a subsystem by a 'software interrupt' if you may, while the PIT block will use a hardware trigger to call your subsystem. This is the main difference between them - software vs hardware scheduling.

Now for the fixed-step size, that is the parameter that controls the main loop period. Let me quickly go over the main parts of the code generated by our toolbox:

 
pastedImage_2.png

 

  • Step – a function called periodically, with a frequency controlled by the Discrete Step value set in the model -- this is the main loop
  • Interrupts – asynchronous events that can be further grouped into 2 categories:
    • Events that occur at a known period – e.g. a LPIT block that is used to trigger the Fast loop system for motor control applications – the important part is that you control the frequency at which this event occurs
    • Events that have an unknown period – e.g. receiving a message via UART/SPI/I2C/etc. – this is something that you have no control over, it can happen any time
  • Initialization – this is a function called only once, at the beginning
  • IDLE – this is the time period in which the Step function finished execution and awaits to be re-triggered and you have no ISR to execute (no such events were generated)

As for the main function, you can find it implemented in mbd_main.c file - there you'll see the initialization for the PIT block that will control the main loop.

Hope this is helpful.

Kind regards,

Razvan.

View solution in original post