How do I send messages perodically using the NXP toolbox?

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

How do I send messages perodically using the NXP toolbox?

2,980 次查看
praktikant2fs35
Contributor II

Hi,

I'd like to send a couple of messages with the FCAN_Send block with a low  sample time (e.g. 1ms). I already tried to use a subsystem as atomic unit but depending on the number of blocks which were used in the simulink model the messages were sent only with a higher sample time. I also tried to use the Perodic_Interrupt_Timer as trigger. That worked very well but the number of channels is limited. Is it possible to trigger more than one subsystem with one Periodic_Interrupt_Timer? The Function_Call Split sadly causes an error. I tried to solve this issue by triggering a subsystem which contained ten Function_Call Generators that were used to trigger ten subsystems with the FCAN_Send block and  PIT_Interrupt_Enable_Disable blocks.  I managed to send ten different messages with the desired sample time. My solution is not very elagant and I don't really understand how the PIT_Interrupt_Enable_Disable blocks work. So I'd like to know whether there is a easier solution to send the messages periodically with a desired sample time? Furthermore it would be interesting to know how to use the Periocic_Interrupt_Timer and the PIT_Interrupt_Enable_Disable to trigger ten different subsystems.

Any help on this issue would be highly appreciated! Thanks in advance!

0 项奖励
回复
6 回复数

2,673 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello praktikant2fs3551.scw@zf.com‌,

First of all you didn't specified which MBDT toolbox or Matlab version or board (e.g S32K or MPC57xx) are you using.

However, let me get this straight: you want at some point in your application to start sending one  by one messages at 1ms between them? Or do you want to sent 10 messages, all at once at 1ms between those groups?

Our toolboxes provides three PIT blocks (on MPC but is the same on S32K's LPIT):

1. PIT_Config - this block configures a PIT channel by setting the interval between interrupts in us or ticks. It also offers the possibility to start immediately after initialization the counter or to start at a certain point in your application by using the PIT_Counter_Start_Stop block.

2. PIT_Counter_Start_Stop - this block starts or stops the PIT channel counter. It the channel counter is stopped then no interrupt will be triggered either if it is active or not. 

3. PIT_Interrupt_Enable_Disable - As the name says this block enables or disables the interrupt. This means that the it only disables the interrupt, but the channel counter might still be active.

So basically a PIT channel has a counter register. The PIT_Config configures the channel when to trigger an interrupt. The PIT_Counter_Start_Stop starts or stops the counter register while the PIT_Interrupt_Enable_Disable enables or disables if the interrupt should be triggered when the values from the counter matches the PIT config value. 

Waiting for your reply,

Marius

0 项奖励
回复

2,673 次查看
praktikant2fs35
Contributor II

Hello Marius,

I'm using the following tools: Matlab R2016b, NXP_MBDToolbox_S32K1xx version 4.0.0 and the S32K144EVB-Q100

I intend to send 10 different messages all at once with a defined sample time. If you consider the bus load it is not possible to send 10 messages with a sample time of 1ms. In my model the sample time varies. For example one time I'd like to send 10 messages the first with 1ms,  the second with 2ms, the third with three and so on. Next time I'd like to send 5 messages with 2ms and 5 with 10ms. Every message should be sent periodically with the defined sample time.

Thanks,

Sebastian

0 项奖励
回复

2,673 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello praktikant2fs3551.scw@zf.com‌,

Could you send me your model to investigate your issue? I understand that you are facing a weird behaviour for the PIT enable disable blocks on the latest version.

Best Regards,

Marius

0 项奖励
回复

2,672 次查看
praktikant2fs35
Contributor II

Hello Marius and Daniel,

attached you can find my Simulink models. Fortunately they work as desired but maybe you can explain me how to find out the best setting of the PIT_enable_disable blocks. Probably you will only need the Simulink models with the name ten_messages_. The Converter blocks just do a bit of bitshifting. In the old version the interesting blocks are the Send block (with the PIT_enable_deisable) and the Trigger Generator. In the new version you should focus on the block called Multiple Send. The task of the whole model is to read a dbc-file and to send the messages which are specified in the dbc-file periodically. I saved the blocks in a simulink library and wrote a description. You can find the library, my dbc-file and the description attached. As I said you probably only need the simulink models but maybe the other files can help you understanding my problem.

Thanks,

Sebastian

Von: Marius-lucian Andrei

Gesendet: Donnerstag, 3. Oktober 2019 14:54

An: SCW Praktikant 2 FS3551 SCW ETDC2

Betreff: You have been mentioned by Marius-lucian Andrei in Re: How do I send messages perodically using the NXP toolbox? in NXP Community

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

You have been mentioned

by Marius-lucian Andrei<https://community.nxp.com/people/mariuslucianandrei?et=notification.mention> in Re: How do I send messages perodically using the NXP toolbox? in NXP Community - View Marius-lucian Andrei's reference to you<https://community.nxp.com/message/1214483?commentID=1214483&et=notification.mention#comment-1214483>

0 项奖励
回复

2,672 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello praktikant2fs3551.scw@zf.com‌,

I had a look on your latest model and I should mention the following:

The MBDT Toolbox uses the LPIT0_Channel0 Interrupt to call periodically the step function, while the PIT0 Channel 3 is also used for the Profiler Block.

The model attached contains all the messages logic called inside a subsystem by the LPIT0 Channel1. The problem is that your model contains a couple of blocks that enables or disables the PIT0 Channel 2 without containing the LPIT0 Channel 2 Config block. This means that the Channel 2 is not even initialized. There is also the S62 block that contains an enable and a disable block one after another.

Now, inside the Enable Disable block there is a checkbox. If the checkbox is checked it will enable the interrupt, also it will disable it. But in order this to work the user must add a PIT block on the same channel.

Hope this helps,

Marius

0 项奖励
回复

2,672 次查看
praktikant2fs35
Contributor II

Hello Marius,

I know that my model does not make that much sense but have you tried to delete or comment out the “unlogic” PIT_enable_disable blocks? Because as far as I know the model would not work without them. And my actual question is whether there is another option to send the messages periodically with the desired sample time or to trigger with one PIT block ten FCAN_Send blocks using the PIT_enable_disable block of the same channel. I first tried to use in my model the PIT_enable_disable blocks with the same channel (1) and that did not work.

Thanks,

Sebastian

Von: mariuslucianandrei

Gesendet: Freitag, 11. Oktober 2019 10:34

An: SCW Praktikant 2 FS3551 SCW ETDC2

Betreff: Re: - Re: How do I send messages perodically using the NXP toolbox?

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: How do I send messages perodically using the NXP toolbox?

reply from Marius-lucian Andrei<https://community.nxp.com/people/mariuslucianandrei?et=watches.email.thread> in NXP Model-Based Design Tools - View the full discussion<https://community.nxp.com/message/1217725?commentID=1217725&et=watches.email.thread#comment-1217725>

0 项奖励
回复