How do I send more than one CAN message?

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

How do I send more than one CAN message?

Jump to solution
3,066 Views
eungsoolee
Contributor II

Hello~

I succeeded in sending one CAN message.
However, an error occurred when trying to send more than two CAN messages.

pastedImage_1.png

pastedImage_2.png

How do i send more than one CAN Message.?

1 Solution
2,506 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi eungsoolee‌,

Thank you for your time.

For #1 - it's my mistake i've not been paying attention to your exact target.

Since you are using s12zvmc128, then please use the new file attached mscan0_s12zvm.c and save it under  ..\mctbx_9s12zvm\mctbx_s12zvm\src\c_library folder.

Indeed the differences are minimal but it is recommended to use the new file.

For  #2 - please find attached a new version of the model. I save it with Simulink 8.4 to avoid any potential opening issues with newer version of Matlab.

Capture.JPG

Best regards,
Daniel

View solution in original post

0 Kudos
9 Replies
2,505 Views
eungsoolee
Contributor II

Hi Daniel

I did the CAN Module Test today.
And the results is successful.
I am grateful for your response.

Thank you.

2,505 Views
eungsoolee
Contributor II

Hi Daniel 

I read your answer.

But I do not have time to test the CAN Module this week.

I will report your response during next week.

And there are additional questions.

1)

your update file is "mscan0_s12zvmc256.c".
But my MCU is s12zvmc128.

When I open the C file, the difference between mscan0_s12zvmc.C and mscan0_s12zvmc256.C is that the function name is the biggest part. Should I test by changing only the function name?

2)

My version of Simulink is 8.5.
You seem to be using version 8.6
So... I can not open your file because the version of Simulink is based on 8.6.
Can you upload it again with different versions?

pastedImage_1.png

Thank you.

0 Kudos
2,507 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi eungsoolee‌,

Thank you for your time.

For #1 - it's my mistake i've not been paying attention to your exact target.

Since you are using s12zvmc128, then please use the new file attached mscan0_s12zvm.c and save it under  ..\mctbx_9s12zvm\mctbx_s12zvm\src\c_library folder.

Indeed the differences are minimal but it is recommended to use the new file.

For  #2 - please find attached a new version of the model. I save it with Simulink 8.4 to avoid any potential opening issues with newer version of Matlab.

Capture.JPG

Best regards,
Daniel

0 Kudos
2,505 Views
eungsoolee
Contributor II

Hi

I followed your advice....

But...The error message disappears in matlab, but the CAN application SW does not work properly.

pastedImage_1.png

                               <Snapshot of CAN application SW monitoring using CANoe>

Have you sent more than 2 messages using the model?

The attached file below is Application SW for CAN Test.
Can you check the wrong part of my model?

0 Kudos
2,505 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi Eungsoo Lee, 

We found the problem and thanks to you eungsoolee we can now provide a hotfix, but first we would like to have your confirmation that works OK on your setup.

Please do the following steps:

#1: go to ..\MCToolbox\mctbx_9s12zvm\mctbx_s12zvmc256\src\c_library\ folder

#2: make a back-up copy of the mscan0_s12zvmc256.c file 

#3: copy-paste the file attached mscan0_s12zvmc256.c file into this thread that contains the fix to ..\MCToolbox\mctbx_9s12zvm\mctbx_s12zvmc256\src\c_library\

#4: start Matlab and clean up the previous generated code (delete the entire folder that was generated for your model)

#5: regenerate the code for your model

Now it should work fine.

In addition please find attached a model we used to validate the fix. You may want to adapt it for your setup.

Capture.JPG

Hope this helps!

Once we have your confirmation that everything is fine we can then prepare an official hotfix patch.

Thank you!

Daniel

0 Kudos
2,504 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi Eungsoo Lee,

Did you had a chance to test the fix for this issue ?

Thank you!

Daniel

0 Kudos
2,508 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi eungsoo Lee,

I'm going to have a look - i suspect an issue in the toolbox. 

We did test it for multiple CAN msgs but from a single buffer. It like a function call that send a new data buffer to be transmitted at each step.

Give us some time to look in details and we'll come back with a resolution.

Thank you for your patience!

Best regards,
Daniel

0 Kudos
2,507 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi Eungsoo Lee, 

Just a shot update on this issue. It is logged as AST-606 in our data base and an engineer is currently investigating this to searching for a solution. 

Thanks for your understanding!

Best regards,
Daniel

0 Kudos
2,509 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi eungsoo Lee,

Let us try first to get rid of the errors and confirm you can sent more messages using this setup.

Go to your install directory for the toolbox and look for a file called: {install dir}\mctbx_9s12zvm\mctbx_s12zvmc256\mctbx_s12zvmc256\mscripts\mcd_s12zvmc256_block_mscan0_check.p

This file is responsible for consistency checks. Just rename the file extension from .p -> .none

This hack will prevent Matlab to load the functions for checking the consistencies.

Then, reload your model (it would be good to restart the Matlab) and compile. The error msg should be gone. Test your application to see if your get your msg sent over CAN network. 

If the application works then we can give you a hot fix for this issue.

Thank you!

Best regards,

Daniel

0 Kudos