Change CAN messages sampling time

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

Change CAN messages sampling time

347件の閲覧回数
Aris_
Contributor II

Hi All,

I'm working on the example "MR-CANHUBK344 Can S32CT". Thanks to your great support I could convert the "CAN FD" protocol to a "standard CAN" one.

Now I would like to have some control on the sampling time of the messages that are sent. For instance, my NXP-S32K344 is sending instructions to a device via CAN which need to receive instructions every 20ms (pressure controller). To reduce the network load, we don't want to send all messages at this frequency, but rather at around 1 message every 0.5s.

I'm struggling finding how to set that up. By default, the example sends 1 message per second and it's not related to the "fixed step size" of 0.1 set in the "Configuration parameters>Slover" menu. Therefore, I wonder what is triggering the sending of CAN messages and what could be done to tune it.

Thanks again for your support,
Aris

0 件の賞賛
返信
1 返信

322件の閲覧回数
robertv
NXP Employee
NXP Employee

Hello @Aris_ ,

You are right in thinking that by changing the "Fixed step size" you can control the frequency at which the main application is being executed. 

The model was built based on the idea that the input of an ADC can be reflected on the output of a PWN controlled LED, so the fixed step size was set to 0.1 to provide a responsive interaction between the ADC and PWN. The fact that you mention that the CAN only transmits 1 message every second definitely sounds like there is something that does not work properly.

Let's start by making sure that we know which frequency the model is running at. You could simply add a Dio block set to FlipChannel, to toggle an LED on and off every cycle. This way, it should be visible whether the loop executes every 0.1s or every 1s.

If the LED is blinking in time with the CAN message being sent, then I would suggest setting the "Fixed step size" value to 0.5 (your desired frequency for CAN) and performing a cleanup of the folder in which the model is found (modelName_Config, modelName.slx, slprj). Make sure to not remove the configuration file, with the extension .mex, in case you performed changes inside the configuration.

If the LED is toggling every 0.1s, and the CAN only sends messages every 1s, then that points us to something more directly related to CAN. Could you check the CAN settings of the device the board is connected to and share with me any of the parameters that could have an impact on the action of receiving CAN messages? 

Regards,
Robert V

 

0 件の賞賛
返信