[RTD600 MCAL & IP] S32K3X4EVB-T172 FlexCAN Example Interrupt/Polling

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

[RTD600 MCAL & IP] S32K3X4EVB-T172 FlexCAN Example Interrupt/Polling

[RTD600 MCAL & IP] S32K3X4EVB-T172 FlexCAN Example Interrupt/Polling

This post presents two complementary FlexCAN communication examples for the S32K3X4EVB-T172 evaluation board, showcasing both low-level IP layer and AUTOSAR MCAL layer implementations. These examples are basic routines for configuring the component in normal/user mode, as the RTD examples are configured for loopback mode.

To test CAN communication, another board or a CAN analyzer must be used.

Since Rev. B2 of S32K3X4EVB-T172 was used to test the project, TJA1043 transceiver is mounted on the board and used to test the examples.

------------------------------------------------------------------------------
* Test HW: S32K3X4EVB-T172
* MCU: S32K344
* Compiler: S32DS 3.6.2
* SDK release: RTD 6.0.0
* Debugger: PE Micro
* Target: internal_FLASH
------------------------------------------------------------------------------


Example 1: FlexCAN IP Layer (LLD)

This project demonstrates a basic FlexCAN setup using the IP-level driver. It configures a standard CAN message; with transmission through POLLING and reception using INTERRUPT.

If TJA1153 transceiver is used, macro TJA1153 must be uncommented at the top of the project, and it will be initialized through a custom configuration sequence. If not used and the macro is commented, normal transceiver initialization is done (only CAN0_EN_PINCAN0_STB_PIN set to HIGH).

Rx Filter mask type is individual and set to receive STD ID 123h
Tx MB is set to STD ID 001h.

FlexCAN bitrate was calculated with MPC5xxx/S32Kxx/LPCxxxx: CAN / CAN FD bit timing calculation. FlexCAN bitrate settings are 500kbps with 81.25% sample point 

  • FPE_CLK: 24MHz
  • Synch seg: 1
  • Prop seg: 4
  • Phase 1 seg: 8
  • Phase 2 seg: 3
  • Prescaler: 3
  • RJW: 3 

 

Example 2: FlexCAN MCAL Layer (HLD)

This project configures both Can_43_FLEXCAN and CanIf modules for CAN communication. Transmission is done via POLLING, while reception is configured via INTERRUPT

Tx MB is set to STD ID 123h.
Acceptance mask is set to 0x0 (accept all IDs).

CAN messages are sent using Can_43_FLEXCAN_Write() and received using the CanIf_RxIndication() callback. After CanIf_bRxFlag is set, an ACK message is sent back. The GREEN LED toggles every 10 received messages.

FlexCAN bitrate was calculated with MPC5xxx/S32Kxx/LPCxxxx: CAN / CAN FD bit timing calculation. FlexCAN bitrate settings are 500kbps with 81.25% sample point 

  • FPE_CLK: 24MHz
  • Synch seg: 1
  • Prop seg: 4
  • Phase 1 seg: 8
  • Phase 2 seg: 3
  • Prescaler: 3
  • RJW: 3 

If TJA1153 transceiver is used, macro TJA1153_EVB_TRCV must be used. If not, use TJA1043_EVB_TRCV for standard transceiver initialization (CAN0_STB & CAN0_EN pins set to HIGH). 

 

Julin_AragnM_0-1768503828389.png

 

Julin_AragnM_1-1768503835901.png

 

 

These examples are provided as is with no guarantees and no support. These are basic routines meant to be used as reference only.

Attachments
No ratings
Version history
Last update:
‎01-15-2026 04:30 PM
Updated by: