Hello Nxp team,
Currently, we are facing an issue with can message transmit using Gpt timer configuration in MATLAB MBDT.
The issue is we are transmitting the can message in 1ms, 10ms, 100ms using gpt timer.
In the above picture, we are configured the can message block for Can0, Can2 & Gpt.
And using Gpt we are configured three Gpt interrupt block for 1ms, 10ms, 100ms.
In each function call sub system, we are transmitting the can messages for Can0 module.
but the can message what we are transmitting in 1ms is getting transmitted (checked using Pcan analyzer) other than 1ms, 10ms and 100ms system can message are not getting transmitted.
But with Dio block we can be able to turn on the Led's - Red for 1ms, Blue for 10ms, Green for 100ms.
With can transmit block only the message is not getting transmitted for 10ms & 100ms.
I have attached the file below,
Kindly help us to resolve this issue.
Thanks & regards,
Esakki.P
@DrKarthi @Kavin_raj_mbd @dragostoma @Irina_Costachescu @Robin_Shen @stefanvlad @Adrian_Gherca @nxp
已解决! 转到解答。
Hello and thank you for your interest in using FreeMASTER over CAN.
As I understand you are trying to debug or monitor some variables using FreeMASTER over CAN communication and you assigned to the FreeMASTER Config block the FLEXCAN0 controller (instance CAN 0 of the microcontroller).
In MBDT 1.5.0, FreeMASTER over CAN support was added with the mention that the CAN instance used by the FreeMASTER debugging tool cannot be used for any other purpose. This means that if FLEXCAN0 is assigned in the FreeMASTER block the application must use another CanController for communicating over CAN (e.g. FLEXCAN 4).
Therefore, new CanControllers need to be created in the configuration project (S32 Configuration Tool / EB Tresos) in order to have them available in the drop down list of the FreeMASTER config block. These new CanControllers are each one connected to different tranceivers, each with its own specific initialization procedure, e.g. setting the En and Stb pins and more.
Also, for every new CanController introduced, the Tx and Rx pins associated with it need to be configured as well.
Please check this article for a complete tutorial on how to do this.
Just letting you know that in the MBDT 1.6.0 release, a new version of FreeMASTER over can will be available.
In this version FreeMASTER will only use one CanHardwareObject from the configuration project meaning that it will be possible to use the same CanController(CAN instance) for the FreeMASTER debugging tool as well as for the rest of the application.
Meanwhile, FreeMASTER over UART communication can still be used, if no CanController is available, other than the one used by the application itself.
Hello and thank you for your interest in using FreeMASTER over CAN.
As I understand you are trying to debug or monitor some variables using FreeMASTER over CAN communication and you assigned to the FreeMASTER Config block the FLEXCAN0 controller (instance CAN 0 of the microcontroller).
In MBDT 1.5.0, FreeMASTER over CAN support was added with the mention that the CAN instance used by the FreeMASTER debugging tool cannot be used for any other purpose. This means that if FLEXCAN0 is assigned in the FreeMASTER block the application must use another CanController for communicating over CAN (e.g. FLEXCAN 4).
Therefore, new CanControllers need to be created in the configuration project (S32 Configuration Tool / EB Tresos) in order to have them available in the drop down list of the FreeMASTER config block. These new CanControllers are each one connected to different tranceivers, each with its own specific initialization procedure, e.g. setting the En and Stb pins and more.
Also, for every new CanController introduced, the Tx and Rx pins associated with it need to be configured as well.
Please check this article for a complete tutorial on how to do this.
Just letting you know that in the MBDT 1.6.0 release, a new version of FreeMASTER over can will be available.
In this version FreeMASTER will only use one CanHardwareObject from the configuration project meaning that it will be possible to use the same CanController(CAN instance) for the FreeMASTER debugging tool as well as for the rest of the application.
Meanwhile, FreeMASTER over UART communication can still be used, if no CanController is available, other than the one used by the application itself.
Hello,
The issue you described, most likely, happens because the hardware registers responsible for CAN message transmission (message buffer) is written two times (when 1ms and 10ms gpt notifications occur) or even three times (when the 1ms, 10ms gpt and 100ms notifications occur).
This means that the CAN transmit buffer is overwritten before the actual transmission happens and only the notification that occurs the last in that millisecond, where two or three notifications overlap, will have the "chance" to write the message buffer for transmission.
If you want to send multiple CAN messages in the same millisecond, as it can happen with the setup you provided, there are two options:
1) Introduce different values for the Pdu ID input of the Can_Write blocks (e.g. 0, 1, 2) , as this will specify different CAN transmit message buffer for each GPT notification where you used this block.
2) Use different CanHardwareObjects from the existing ones in the configuration project or create new ones as necessary. Then select different Hardware Object wherever the Can_Write block is used.
Hello @Adrian_Gherca
Thanks for your reply,
Your solution helped me to resolve that issue. now we can be able to read Can messages at any gpt using solution - 2 method.
And right now, we are facing another issue that,
CAN-Freemaster Monitoring:
After the logic created inside the model, we are using Freemaster block to monitor the parameters inside the logic.
But while we are configuring the Freemaster with Can (FLEXCAN0) inside model and flash into our hardware and trying to check the can message with Pcan device.
The message that we are transmitting inside the logic is not getting received and if we try using the transmit the message in Pcan, that also is not getting received if we are using the freemaster block with can (FLEXCAN0).
But if we use the Freemaster with serial communication, the message that we are transmitting inside the logic is received successfully in Pcan.
I have attached the file with this post.
Kindly help us to resolve this issue
Thanks & regards,
Esakki