CAN TX Not Working on S32K344EVB-T172 (MBD Ver 1.8.0)

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

CAN TX Not Working on S32K344EVB-T172 (MBD Ver 1.8.0)

Jump to solution
1,442 Views
hyunsiksong
Contributor II

Hello,
I am currently trying to test CAN TX using the Model-Based Design (MBD) approach, but the CAN transmission is not working. I would appreciate your support.

My test environment is as follows:
- Board: S32K344EVB-T172
- MBD Version: MBD Ver 1.8.0 (RTD V7.0.0)
- MATLAB: 2025b
- Configuration Tool: S32CT (V2025.R1.8)
- CAN Tool: VehicleSPY Basic with ValueCAN4
- FreeMASTER: Version 3.2

Reference document:
https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Interacting-with-Digital-Inputs-Outputs-on...

Test Description :
The test reads an ADC value from a potentiometer, converts it to voltage (in mV), and transmits it via CAN with ID 0x100.
The ADC result (ADC_Voltage_mv, 0–5000 mV) is verified to be working correctly in FreeMASTER.

CAN transceiver (TJA1443) initial configuration:
- CAN0_EN (PTC21) = HIGH
- CAN0_STB_N (PTC20) = HIGH

CAN configuration:
- FlexCAN0
- 500 kbps (Sampling Point: 87.5%)
- Standard ID (11-bit)
- 8-byte payload
- CAN TX Polling mode

Hardware Connection
- S32K344EVB-T172 board J32: Pin 1 (CAN_HIGH), Pin 2 (CAN_LOW)
- Connected to ValueCAN4 Channel 1: Pin 2 → CAN_LOW, Pin 7 → CAN_HIGH
- Bitrate set to 500 kbps
- 120-ohm termination resistor enabled
- CAN DB configuration:
ID 0x100 (8 bytes)
ID 0x101 (8 bytes)
Factor = 1, Offset = 0

Test Result
- No simulation errors
- Build and deployment completed successfully
- ADC works correctly
- CAN TX is not observed on VehicleSPY

I have attached the source files for review. I would appreciate any expert advice regarding the possible cause.

Attachment: CAN_TX_TEST.zip
- Model: CAN_TX_TEST.slx
- Executable: CAN_TX_TEST.elf
- Configuration file: CAN_TX_TESTConfig.mex
- CAN DB: CAN_DB_TEST_20260227.dbc
- FreeMASTER project: CAN_TX_TEST.pmpx

Thank you in advance for your support.

0 Kudos
Reply
1 Solution
567 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

I downloaded and build your model and it works as you described, the ADC works fine but the CAN doesn't work.

First of all, please confirm what board revision you have because they have different CAN transceivers: 

  • RevA - RevB have TJA1153
  • RevB1 has TJA1443

From the image you sent, it seems that you have RevB, but please confirm as the image is compressed and doesn't have the best quality.

If you have RevB, the TJA1153 must be initialized, it is not enough to set up the EN and STB_N pins. You can find an example on how to initialize it in the "s32k3xx_can_transmit_ebt" example. 

Basically, you have to do these steps in this exact order (set priorities for each block to make sure the order is followed):

  1. SetControllerMode
  2. Can_DisableControllerInterrupts
  3. TJA1153 Initialization
  4. Can_EnableControllerInterrupts

SorinIBancila_0-1776262523574.png

 

Inside the CAN Transceiver Initialization variant, you must have an MATLAB function block that contain the initialization for the TJA1153.

SorinIBancila_1-1776262638434.png

The inputs for the MATLAB functions can be found in the image below:

  • canExtHwId -> the hardware object id for the can tx polling (used to send commands to TJA1153 to initialize it)
  • canEnDioChannel - Enable pin
  • canStbDioChannel - Standy_N pin
  • canErrnDioChannel - Error_N pin

SorinIBancila_2-1776262677343.png

 

For the MATLAB function, you also need to install MinGW compiler. You can find it in the Addons Manager in MATLAB.

I have also attached the SLX file that has the initialization part updated.

 

Best regards,

Sorin Bancila

 

View solution in original post

0 Kudos
Reply
3 Replies
568 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

I downloaded and build your model and it works as you described, the ADC works fine but the CAN doesn't work.

First of all, please confirm what board revision you have because they have different CAN transceivers: 

  • RevA - RevB have TJA1153
  • RevB1 has TJA1443

From the image you sent, it seems that you have RevB, but please confirm as the image is compressed and doesn't have the best quality.

If you have RevB, the TJA1153 must be initialized, it is not enough to set up the EN and STB_N pins. You can find an example on how to initialize it in the "s32k3xx_can_transmit_ebt" example. 

Basically, you have to do these steps in this exact order (set priorities for each block to make sure the order is followed):

  1. SetControllerMode
  2. Can_DisableControllerInterrupts
  3. TJA1153 Initialization
  4. Can_EnableControllerInterrupts

SorinIBancila_0-1776262523574.png

 

Inside the CAN Transceiver Initialization variant, you must have an MATLAB function block that contain the initialization for the TJA1153.

SorinIBancila_1-1776262638434.png

The inputs for the MATLAB functions can be found in the image below:

  • canExtHwId -> the hardware object id for the can tx polling (used to send commands to TJA1153 to initialize it)
  • canEnDioChannel - Enable pin
  • canStbDioChannel - Standy_N pin
  • canErrnDioChannel - Error_N pin

SorinIBancila_2-1776262677343.png

 

For the MATLAB function, you also need to install MinGW compiler. You can find it in the Addons Manager in MATLAB.

I have also attached the SLX file that has the initialization part updated.

 

Best regards,

Sorin Bancila

 

0 Kudos
Reply
522 Views
hyunsiksong
Contributor II
Hello Sorin Bancila,

Thank you for your detailed solution regarding my inquiry.

First, the board we are using is RevB.
Therefore, it appears that the TJA1153 is used.

There is no explicit part number marked on the component, so it is difficult to confirm directly. However, the board has a label: “SCH-53148 RevB 700-53148 Rev X5”.

Initially, I only configured the EN and STB_N pins for the TJA1153, but I now understand that the initialization sequence is critical. Following the TJA1153 initialization procedure you provided, I was able to confirm that CAN TX is now working properly.

In conclusion, the issue was caused by an incorrect initialization sequence of the TJA1153.

Thank you very much for providing the solution.

Best regards,
Hyunsik Song
1,311 Views
hyunsiksong
Contributor II
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2324362%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECAN%20TX%20Not%20Working%20on%20S32K344EVB-T172%20(MBD%20Ver%201.8.0)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2324362%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3CBR%20%2F%3EI%20am%20currently%20trying%20to%20test%20CAN%20TX%20using%20the%20Model-Based%20Design%20(MBD)%20approach%2C%20but%20the%20CAN%20transmission%20is%20not%20working.%20I%20would%20appreciate%20your%20support.%3C%2FP%3E%3CP%3EMy%20test%20environment%20is%20as%20follows%3A%3CBR%20%2F%3E-%20Board%3A%20S32K344EVB-T172%3CBR%20%2F%3E-%20MBD%20Version%3A%20MBD%20Ver%201.8.0%20(RTD%20V7.0.0)%3CBR%20%2F%3E-%20MATLAB%3A%202025b%3CBR%20%2F%3E-%20Configuration%20Tool%3A%20S32CT%20(V2025.R1.8)%3CBR%20%2F%3E-%20CAN%20Tool%3A%20VehicleSPY%20Basic%20with%20ValueCAN4%3CBR%20%2F%3E-%20FreeMASTER%3A%20Version%203.2%3C%2FP%3E%3CP%3EReference%20document%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FNXP-Model-Based-Design-Tools%2FInteracting-with-Digital-Inputs-Outputs-on-MR-CANHUBK344%2Fta-p%2F1746789%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FNXP-Model-Based-Design-Tools%2FInteracting-with-Digital-Inputs-Outputs-on-MR-CANHUBK344%2Fta-p%2F1746789%3C%2FA%3E%3C%2FP%3E%3CP%3ETest%20Description%20%3A%3CBR%20%2F%3EThe%20test%20reads%20an%20ADC%20value%20from%20a%20potentiometer%2C%20converts%20it%20to%20voltage%20(in%20mV)%2C%20and%20transmits%20it%20via%20CAN%20with%20ID%200x100.%3CBR%20%2F%3EThe%20ADC%20result%20(ADC_Voltage_mv%2C%200%E2%80%935000%20mV)%20is%20verified%20to%20be%20working%20correctly%20in%20FreeMASTER.%3C%2FP%3E%3CP%3ECAN%20transceiver%20(TJA1443)%20initial%20configuration%3A%3CBR%20%2F%3E-%20CAN0_EN%20(PTC21)%20%3D%20HIGH%3CBR%20%2F%3E-%20CAN0_STB_N%20(PTC20)%20%3D%20HIGH%3C%2FP%3E%3CP%3ECAN%20configuration%3A%3CBR%20%2F%3E-%20FlexCAN0%3CBR%20%2F%3E-%20500%20kbps%20(Sampling%20Point%3A%2087.5%25)%3CBR%20%2F%3E-%20Standard%20ID%20(11-bit)%3CBR%20%2F%3E-%208-byte%20payload%3CBR%20%2F%3E-%20CAN%20TX%20Polling%20mode%3C%2FP%3E%3CP%3EHardware%20Connection%3CBR%20%2F%3E-%20S32K344EVB-T172%20board%20J32%3A%20Pin%201%20(CAN_HIGH)%2C%20Pin%202%20(CAN_LOW)%3CBR%20%2F%3E-%20Connected%20to%20ValueCAN4%20Channel%201%3A%20Pin%202%20%E2%86%92%20CAN_LOW%2C%20Pin%207%20%E2%86%92%20CAN_HIGH%3CBR%20%2F%3E-%20Bitrate%20set%20to%20500%20kbps%3CBR%20%2F%3E-%20120-ohm%20termination%20resistor%20enabled%3CBR%20%2F%3E-%20CAN%20DB%20configuration%3A%3CBR%20%2F%3EID%200x100%20(8%20bytes)%3CBR%20%2F%3EID%200x101%20(8%20bytes)%3CBR%20%2F%3EFactor%20%3D%201%2C%20Offset%20%3D%200%3C%2FP%3E%3CP%3ETest%20Result%3CBR%20%2F%3E-%20No%20simulation%20errors%3CBR%20%2F%3E-%20Build%20and%20deployment%20completed%20successfully%3CBR%20%2F%3E-%20ADC%20works%20correctly%3CBR%20%2F%3E-%20CAN%20TX%20is%20not%20observed%20on%20VehicleSPY%3C%2FP%3E%3CP%3EI%20have%20attached%20the%20source%20files%20for%20review.%20I%20would%20appreciate%20any%20expert%20advice%20regarding%20the%20possible%20cause.%3C%2FP%3E%3CP%3EAttachment%3A%20CAN_TX_TEST.zip%3CBR%20%2F%3E-%20Model%3A%20CAN_TX_TEST.slx%3CBR%20%2F%3E-%20Executable%3A%20CAN_TX_TEST.elf%3CBR%20%2F%3E-%20Configuration%20file%3A%20CAN_TX_TESTConfig.mex%3CBR%20%2F%3E-%20CAN%20DB%3A%20CAN_DB_TEST_20260227.dbc%3CBR%20%2F%3E-%20FreeMASTER%20project%3A%20CAN_TX_TEST.pmpx%3C%2FP%3E%3CP%3EThank%20you%20in%20advance%20for%20your%20support.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2326164%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CAN%20TX%20Not%20Working%20on%20S32K344EVB-T172%20(MBD%20Ver%201.8.0)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2326164%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20previously%20shared%20link%20was%20incorrect.%20Here%20is%20the%20correct%20one.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FNXP-Model-Based-Design-Tools%2FCommunicating-over-the-CAN-Bus%2Fta-p%2F1758456%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FNXP-Model-Based-Design-Tools%2FCommunicating-over-the-CAN-Bus%2Fta-p%2F1758456%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2351654%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CAN%20TX%20Not%20Working%20on%20S32K344EVB-T172%20(MBD%20Ver%201.8.0)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2351654%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3EI%20downloaded%20and%20build%20your%20model%20and%20it%20works%20as%20you%20described%2C%20the%20ADC%20works%20fine%20but%20the%20CAN%20doesn't%20work.%3C%2FP%3E%0A%3CP%3EFirst%20of%20all%2C%20please%20confirm%20what%20board%20revision%20you%20have%20because%20they%20have%20different%20CAN%20transceivers%3A%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ERevA%20-%20RevB%3C%2FSTRONG%3E%20have%20%3CSTRONG%3ETJA1153%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ERevB1%3C%2FSTRONG%3E%20has%20%3CSTRONG%3ETJA1443%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EFrom%20the%20image%20you%20sent%2C%20it%20seems%20that%20you%20have%20RevB%2C%20but%20please%20confirm%20as%20the%20image%20is%20compressed%20and%20doesn't%20have%20the%20best%20quality.%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20RevB%2C%20the%20TJA1153%20must%20be%20initialized%2C%20it%20is%20not%20enough%20to%20set%20up%20the%20EN%20and%20STB_N%20pins.%20You%20can%20find%20an%20example%20on%20how%20to%20initialize%20it%20in%20the%20%22s32k3xx_can_transmit_ebt%22%20example.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBasically%2C%20you%20have%20to%20do%20these%20steps%20in%20this%20exact%20order%20(set%20priorities%20for%20each%20block%20to%20make%20sure%20the%20order%20is%20followed)%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESetControllerMode%3C%2FLI%3E%0A%3CLI%3ECan_DisableControllerInterrupts%3C%2FLI%3E%0A%3CLI%3ETJA1153%20Initialization%3C%2FLI%3E%0A%3CLI%3ECan_EnableControllerInterrupts%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SorinIBancila_0-1776262523574.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SorinIBancila_0-1776262523574.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SorinIBancila_0-1776262523574.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F382458i8C1610CD13B45D9C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SorinIBancila_0-1776262523574.png%22%20alt%3D%22SorinIBancila_0-1776262523574.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EInside%20the%20%3CSTRONG%3ECAN%20Transceiver%20Initialization%20variant%2C%26nbsp%3B%3C%2FSTRONG%3Eyou%20must%20have%20an%20MATLAB%20function%20block%20that%20contain%20the%20initialization%20for%20the%20TJA1153.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SorinIBancila_1-1776262638434.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SorinIBancila_1-1776262638434.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SorinIBancila_1-1776262638434.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F382460iDD976A0372C36371%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SorinIBancila_1-1776262638434.png%22%20alt%3D%22SorinIBancila_1-1776262638434.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20inputs%20for%20the%20MATLAB%20functions%20can%20be%20found%20in%20the%20image%20below%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EcanExtHwId%20-%26gt%3B%20the%20hardware%20object%20id%20for%20the%20can%20tx%20polling%20(used%20to%20send%20commands%20to%20TJA1153%20to%20initialize%20it)%3C%2FLI%3E%0A%3CLI%3EcanEnDioChannel%20-%20Enable%20pin%3C%2FLI%3E%0A%3CLI%3EcanStbDioChannel%20-%20Standy_N%20pin%3C%2FLI%3E%0A%3CLI%3EcanErrnDioChannel%20-%20Error_N%20pin%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22SorinIBancila_2-1776262677343.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SorinIBancila_2-1776262677343.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SorinIBancila_2-1776262677343.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F382461i96E5600135F86ABE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SorinIBancila_2-1776262677343.png%22%20alt%3D%22SorinIBancila_2-1776262677343.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EFor%20the%20MATLAB%20function%2C%20you%20also%20need%20to%20install%20MinGW%20compiler.%20You%20can%20find%20it%20in%20the%20Addons%20Manager%20in%20MATLAB.%3C%2FP%3E%0A%3CP%3EI%20have%20also%20attached%20the%20SLX%20file%20that%20has%20the%20initialization%20part%20updated.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3ESorin%20Bancila%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2351871%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CAN%20TX%20Not%20Working%20on%20S32K344EVB-T172%20(MBD%20Ver%201.8.0)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2351871%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHello%20Sorin%20Bancila%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%20for%20your%20detailed%20solution%20regarding%20my%20inquiry.%3CBR%20%2F%3E%3CBR%20%2F%3EFirst%2C%20the%20board%20we%20are%20using%20is%20RevB.%3CBR%20%2F%3ETherefore%2C%20it%20appears%20that%20the%20TJA1153%20is%20used.%3CBR%20%2F%3E%3CBR%20%2F%3EThere%20is%20no%20explicit%20part%20number%20marked%20on%20the%20component%2C%20so%20it%20is%20difficult%20to%20confirm%20directly.%20However%2C%20the%20board%20has%20a%20label%3A%20%E2%80%9CSCH-53148%20RevB%20700-53148%20Rev%20X5%E2%80%9D.%3CBR%20%2F%3E%3CBR%20%2F%3EInitially%2C%20I%20only%20configured%20the%20EN%20and%20STB_N%20pins%20for%20the%20TJA1153%2C%20but%20I%20now%20understand%20that%20the%20initialization%20sequence%20is%20critical.%20Following%20the%20TJA1153%20initialization%20procedure%20you%20provided%2C%20I%20was%20able%20to%20confirm%20that%20CAN%20TX%20is%20now%20working%20properly.%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20conclusion%2C%20the%20issue%20was%20caused%20by%20an%20incorrect%20initialization%20sequence%20of%20the%20TJA1153.%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%20very%20much%20for%20providing%20the%20solution.%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20regards%2C%3CBR%20%2F%3EHyunsik%20Song%3C%2FLINGO-BODY%3E