FlexCAN Bus Error Interrupts and Values not Available [MPC5744P, MBD]

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

FlexCAN Bus Error Interrupts and Values not Available [MPC5744P, MBD]

Jump to solution
1,689 Views
abhishek_kumar1
Contributor IV

Dear All

I am trying to implement FlexCAN Communication and I wanted to implement and handle errors on CAN bus. When we view on any CAN analyzer we observe bus errors. I wanted to implement the same.

CAN_ESR1 register for MPC5744P information

Question

How can we read the register and how can we configure CAN_CTRL1 register and get ISR?

         BOFFMSK Interrupt 

         ERRMSK Interrupt 

         TWRNMSK Interrupt 

         RWRNMSK Interrupt 

We need this ti fully implement CAN communication.

Best Regards,

Abhishek

mariuslucianandreiext-rafael.barbosa@chassisbrakes.com

1 Solution
1,374 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

You'll have to go to the root directory of the toolbox and run from there the mbd_mpc_path script. After you run it succesfuly, you'll no longer have the other problem.

Kind regards,

Razvan.

View solution in original post

10 Replies
1,374 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

You could use read/write register blocks (that you can find in the Utilities part of our library):

pastedImage_1.pngpastedImage_2.png

You can use these blocks to configure every peripheral, every register that you'd like to (not limited to CAN only). Note that you must be careful for other prerequisites peripherals might have (such as enabling the clocks for it - disregarded, will cause the application to crash). What I want to point out is that although this block gives you full control, you must be wary of other (peripheral dependent) aspects.

In your case, if you want to set CTRL1 register, you could use the write register block inside a Initialize function block,

pastedImage_5.png

but make sure to set the priority is set accordingly (you write to CTRL1 after the CAN configuration blocks writes to it) - otherwise your settings would be overwritten.

As for the error handling, we currently do not support it - all other events besides the errors are handled by our toolbox. I'll get back to you on how we can work around this issue in a few days - maybe we'll consider adding support for it in our next release.

Kind regards,

Razvan.

0 Kudos
1,374 Views
abhishek_kumar1
Contributor IV

Dear mariuslucianandrei‌,

Thanks for the input but I get the error when I get the Write_Register block.

pastedImage_3.png

Somehow, It looks into MPC5748G folder instead of MPC5744P folder. It fails to find a mat file. 

Best Regards

Abhishek

0 Kudos
1,374 Views
constantinrazva
NXP Employee
NXP Employee

Hello again abhishek.kumar@chassisbrakes.com‌,

I understand from gabriela_catana that this issue might be fixed by resetting the path for our toolbox - could you do that and let us know if it fixes it? We're going to investigate this issue nonetheless.

For resetting the path:

restoredefaultpath;

mbd_mpc_path();

Kind regards,

Razvan.

0 Kudos
1,374 Views
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

I did that and I get the Error as shown below

pastedImage_1.png

Beat Regards

Abhishek 

0 Kudos
1,374 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

It seems now it does not see the functions - did you run mbd_mpc_path as well? If yes, could you run again the same 3 commands as before (and write the values of devicePath, deviceName and peripheralList)?

Kind regards,

Razvan.

0 Kudos
1,379 Views
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

Please see, I think restoredefaultpath somehow changed the target path. 


>> restoredefaultpath
>> mbd_mpc_path
Undefined function or variable 'mbd_mpc_path'.

>> mbd_mpc_path()
Undefined function or variable 'mbd_mpc_path'.

>> mbd_mpc_path();
Undefined function or variable 'mbd_mpc_path'.

>> devicePath = mbd_mpc_find_target_path(fullfile('mbdtbx_mpc', 'devices'))
Undefined function or variable 'mbd_mpc_find_target_path'.

0 Kudos
1,375 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

You'll have to go to the root directory of the toolbox and run from there the mbd_mpc_path script. After you run it succesfuly, you'll no longer have the other problem.

Kind regards,

Razvan.

1,379 Views
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

It works

0 Kudos
1,379 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

That is a strange behavior indeed - can you run some commands in the MATLAB terminal and share the output with us?

devicePath = mbd_mpc_find_target_path(fullfile('mbdtbx_mpc', 'devices'));

deviceName = mbd_mpc574x_get_target_mcu();

peripheralList = dir(fullfile(devicePath, deviceName, 'registers', '*.mat'));

If you could let us know what values these 3 variables have would be helpful in debugging this issue.

Kind regards,

Razvan.

p.s.: mariuslucianandrei‌ is the guy you usually talk to; I'm the guy you sometimes talk to :smileyhappy:

0 Kudos
1,379 Views
abhishek_kumar1
Contributor IV

Dear  constantinrazvan.chivu

Please see the results

deviceName : 'MPC5744P'

devicePath: C:\Users\XXXXXX\Documents\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_MPC57xx\mbdtbx_mpc\devices\MPC5748G\registers 

peripheralList is empty

peripheralList =

0×1 empty struct array with fields:

name
folder
date
bytes
isdir
datenum

pastedImage_1.png

Beat Regards, 

Abhishek

0 Kudos