S32k144 EVB CAN Communication using MBD

cancel
Showing results for 
Search instead for 
Did you mean: 

S32k144 EVB CAN Communication using MBD

Jump to solution
403 Views
Contributor II

Hi,

I am trying to send CAN message with 4 signals. These signals should be sent in Motorola format and I want to pack the data in the following format.

The following shows the layout for CAN message:

Can you please let me know how can I achieve this with the NXP MBD toolbox in MATLAB?

Is there a way I can use the dbc file directly?

Thanks,

Rubeena

Labels (4)
1 Solution
278 Views
NXP Employee
NXP Employee

Hello @parveez,

I had a look on your model and there are multiple reasons for its behaviour.

If I understand correctly, you want to connect with FreeMaster over the USB cable/Serial connection and to transfer messages over CAN bus.

If so, this is what I've found in the attached model.

1. FreeMaster setup: Razvan mentioned above the pins required for the connection. For the FreeMaster you have selected other pins that the ones connected to OpenSDA.

mariuslucianand_0-1600117914068.png

2. The FCAN_Receive block makes some settings in the step function, configuring the RX message buffer. And in the model that you send, the code generated by the Receive block was inserted before the FCAN Configuration code, which means that the board was ending up running a dummy handler. To set the execution order for some important blocks, like the Config, Send and Receive, you can right click on the block, open the Properties and insert a priority.

mariuslucianand_2-1600118702289.png

Finally the execution order looks like this: First is the FCAN COnfig, then the Transmit and then the receive.

mariuslucianand_1-1600118669995.png

Last but not least, are you powering the board externally using the J16 connector? because as far as I know, in order to use the CAN transciever, you need to power the board using the external supply.

I can't test the communication because I don't have for now a CAN analyzer but the FreeMaster over USB works.

Hope this helps,

Marius 

View solution in original post

10 Replies
82 Views
Contributor I

I was looking for the same info, tried doing the same but it didn't worked. Thanks for spreading the knowledge!

My Balance Now
0 Kudos
74 Views
NXP Employee
NXP Employee

Hello @Elson_Sarah ,

Can you provide more details? Do you have the same exact model? Have you tried to rearrange the CAN blocks?

Regards,

Marius

0 Kudos
326 Views
Contributor II

Hello constantinrazvan.chivu‌,

Thank you for the information.

I have another question, can I have S32K144 EVB CAN communicate with other devices and view CAN and other parameters/calibrations on FreeMaster?

Thanks,

Rubeena

326 Views
NXP Employee
NXP Employee

Hello rparveez@mtu.edu ,

Yes, you can certainly have S32K144 EVB communicate on any CAN bus with other devices - you just have to make the physical connections. Regarding the 2nd part of the question, yes, you can view and modify parameters using FreeMASTER - the only thing you should do is add the FreeMASTER Config block into your model. You can start from one of our examples.

Kind regards,

Razvan.

0 Kudos
326 Views
Contributor II

constantinrazvan.chivu‌,

Thank you for your response.

I tried this, the FreeMaster config to use LPUART0 and FCAN module:0

After building and downloading the code, the FreeMaster does not connect to the board.

Also, I have blue LED to blink once code is downloaded. This doesn't work either. 

When I try building other modules which did not have CAN communication blocks, the FreeMaster connected to the board and the blue LED blinks.

I am not sure what is the problem, is it due to CAN config? Do you have an examples where two devices communicate over CAN and some parameters that on FreeMaster? 

Thanks,

Rubeena 

0 Kudos
326 Views
NXP Employee
NXP Employee

Hello rparveez@mtu.edu ,

You should first make sure you have the selected pins connected to your PC. For example, for FreeMASTER over LPUART, if you only have the USB cable from the EVB to the PC and nothing else, you will not be able to communicate with it. The pins that are used for the USB are PTC6 and PTC7, from LPUART1 instance. You should check out the quick start guide (here). In every peripheral configuration block you should make sure the pins are correctly selected. You can find examples for FreeMASTER and CAN in our example library (that comes installed with the toolbox).

pastedImage_2.png

Kind regards,

Razvan.

0 Kudos
293 Views
Contributor I

Hi Razvan,

I have done the configuration. But still not able to connect to freeMaster. 

Please find the attached dummy model. Can you please let me know what is possibly going wrong?

Thanks,

Rubeena 

0 Kudos
279 Views
NXP Employee
NXP Employee

Hello @parveez,

I had a look on your model and there are multiple reasons for its behaviour.

If I understand correctly, you want to connect with FreeMaster over the USB cable/Serial connection and to transfer messages over CAN bus.

If so, this is what I've found in the attached model.

1. FreeMaster setup: Razvan mentioned above the pins required for the connection. For the FreeMaster you have selected other pins that the ones connected to OpenSDA.

mariuslucianand_0-1600117914068.png

2. The FCAN_Receive block makes some settings in the step function, configuring the RX message buffer. And in the model that you send, the code generated by the Receive block was inserted before the FCAN Configuration code, which means that the board was ending up running a dummy handler. To set the execution order for some important blocks, like the Config, Send and Receive, you can right click on the block, open the Properties and insert a priority.

mariuslucianand_2-1600118702289.png

Finally the execution order looks like this: First is the FCAN COnfig, then the Transmit and then the receive.

mariuslucianand_1-1600118669995.png

Last but not least, are you powering the board externally using the J16 connector? because as far as I know, in order to use the CAN transciever, you need to power the board using the external supply.

I can't test the communication because I don't have for now a CAN analyzer but the FreeMaster over USB works.

Hope this helps,

Marius 

View solution in original post

110 Views
Contributor I

Hi @mariuslucianand,

This solution worked for me with one controller. But something went wrong with the controller and I was not able to fix it. So I purchased a new controller, now I am not able to verify CAN communication. I used Vector CANAlyzer but I do not see any communication. I have 12V connected to the board and Pin J107 (1-2) are also connected. 

Can you please help me what else I can do? 

Here is the problem I had with my old controller and was not able to fix: https://community.nxp.com/t5/S32K/S32K144-not-working/m-p/1160684 

0 Kudos
326 Views
NXP Employee
NXP Employee

Hello rparveez@mtu.edu ,

Unfortunately you can't use a dbc file for now -- we're looking into expanding the support to cover that as well.

I'm sorry but I can't see the image you posted. With our toolbox, you can just input the data you want to send, the ID you want it to have and set-up if you want standard or extended format and if you need it to have RTR set. From this information, the whole CAN frame is put together and sent over the CAN bus.

We have a video that goes through some examples, after a brief introduction of the CAN protocol -- might find some answers there. You can find it here.

Kind regards,

Razvan.

0 Kudos