S32K3x4-Q172 CAN transmission failed

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

S32K3x4-Q172 CAN transmission failed

1,313 Views
REM
Contributor II

Hello,

I'm trying to establish CAN communication between an S32K3x4-Q172 EVB and a Vector VN164 using the MBDT.

I'using the CAN transmit exemple, and I've reffered to configure my Matlab model and the TJA1153 :

https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/how-to-use-MBDT-to-initialize-the-TJA11...

https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Communicating-over-the-CAN-Bus/ta-p/175845...

But the MCU isn't sending anything.

I've noticed that in the generated file mbdt_tja1153.c is missing and not generated and I can't find it in MathWorks\MATLAB Add-Ons\Toolboxes\NXP_MBDToolbox_S32K3xx\mbdtbx_s32k3\src

Could that be the problem?

0 Kudos
Reply
9 Replies

1,258 Views
Adrian_Gherca
NXP Employee
NXP Employee

Since you've already mentioned that you are using the CAN transmit example and assuming that you are using this evaluation board: S32K3x4-Q172 General-Purpose Development Board (no answer provided to the question from the previous comment), I would suggest you try these steps for activating and testing the CAN communication:

1. Make sure that "s32k3xx_can_transmit_ebt" is the example you are using
2. Click on the "TJA_1043" button. By doing this, the initialization for CAN transceiver TJA_1043 will be enabled in the model's "initialize" function

Adrian_Gherca_0-1718482852420.png
3. Aditionally, please check:
    - which CAN transceiver from the evaluation board is used by the CAN controller selected in your application: TJA1153, TJA1043 or another one. Schematic can be downloaded from the Design Resources tab of the NXP page where your EVB documentation can be found
    - to which pins of the microcontroller are the transceiver's CAN0_EN and CAN0_STB connected to
    - if these two pins of the microcontroller are created and configured in the EBTresos/S32CT and that their state (High/Low) corresponds to transceivers requirements:

Adrian_Gherca_1-1718483003173.png

More details are available in the article you've already referred to.

0 Kudos
Reply

1,218 Views
REM
Contributor II

Hello Adrian,

I'm indeed using this the S32K3x4-Q172  EVB

I used the "s32k3xx_can_transmit_ebt.mdl" example and I selected the TJA1043 and now I don't have an initialization error anymore (I checked on Freemaster and the status level is 0).

The EVB is still not transmitting any CAN message. I can see on freemaster that the status level of the can_write block is 2 and the red LED is on.

I'll resend my modified simulink and the mex file.

Thank you for your help.

 

 

 

0 Kudos
Reply

1,207 Views
Adrian_Gherca
NXP Employee
NXP Employee

While checking the implementation in your model I noticed that the microcontroller pins that correspond to the transceiver's EN and STB inputs need to be set to High in TJA1043_Init block

Adrian_Gherca_0-1718626900390.png

Please test this and come back if any other error occurs.

0 Kudos
Reply

1,112 Views
REM
Contributor II

Hello Adrian,

I created a CAN receive model based on the "s32k342_can_receive_ebt.mdl", I flashed it and I'm able to receive CAN messages on my EVB from a Vectror VN1640A. 
I know that my set up is correct but I'm still unable send CAN messages,I only know that the CAN_Write Status is 2 according to freemaster (I named the variable send_level instead of CAN_Write Status)

REM_1-1718871926264.png

 

0 Kudos
Reply

1,093 Views
Adrian_Gherca
NXP Employee
NXP Employee

Hello,

Having a working CAN reception is a good sign. Among others it means that the hardware setup is ok and that the CAN transceiver TJA1043 is correctly initialized.

I assume that the CAN receive model based on the "s32k342_can_receive_ebt.mdl" you created, is another model than the one attached to the previous comment (CAN_Transmit.zip), where the transmission is still not working.

Looking at your attached FreeMASTER snippet I see that the variable Send_Level (CAN_Write Status) has the value 2 (FLEXCAN_STATUS_BUSY).
It seems that there was an attempt to send a CAN message but, after that, the Tx Interrupt flag is not cleared. This would be the job for the Hardware Interrupt Callback block set for Interrupt: CanIf_TxConfirmation (as you can see in the s32k3xx_can_transmit_ebt example).

I'm not sure how your VN is configured but, if in your physical CAN network there is no device capable of acknowledging the CAN message sent by your S32K3x4-Q172 EVB, then the transmission will get stuck with the Busy status.

Probably your VN is set to work in sniffing mode, meaning that it sees the messages on the CAN bus but it does not acknowledge any of them.
A short test that would confirm this, is to power off and then back on the EVB for several times. Check if the EVB transmits any message once immediately after power on.

0 Kudos
Reply

1,004 Views
REM
Contributor II

Hello,

The VN wasn't running,so it wasn't capable of acknowledging the CAN message sent by the S32K3x4-Q172 EVB and I would get the error. 

After making sure that it's running I was able to exchange messages on the CAN bus with it.

When I tried to connect it to a MicroAutobox II, which is flashed with a SW to exchange information and the proper dbc file, it doesn't send nor receive information from it.

But when I use a Y CAN cable creating a network using the S32K3x4-Q172 EVB, VN and MicroAutobox I'm able to establish a communication between the EVB and MicroAutobox.

Do you know why I have to connect the VN to establish communication?

Thank you for your help

0 Kudos
Reply

1,193 Views
REM
Contributor II

Hello Adrian,

I set the CAN0_EN and CAN0_STB to high and I'm still unable to send CAN messages

REM_1-1718631324021.png

 

0 Kudos
Reply

1,282 Views
Adrian_Gherca
NXP Employee
NXP Employee

Hello,

You should be able to find "mbdt_tja.a" instead of "mbdt_tja1153.c". If this is the case then the problem lies somewhere else.

Is this the board you are using?..
https://www.nxp.com/products/no-longer-manufactured/s32k3x4-q172-general-purpose-development-board:S...

Also, can you please send us the .mex file?
It might be the case that the actual transceiver on your board is TJA1043 not TJA1153.

0 Kudos
Reply

1,273 Views
REM
Contributor II

Hello Adrian,

I was able to find the "mbdt_tja.a". 
I'll upload the .mex.

Thank you for your help 

0 Kudos
Reply