This example project will show user how to use and configure the basic functionalities of WKPU + FlexCAN.
------------------------------------------------------------------------------
* Test HW: S32K3X4EVB-T172 (SCH-53148 REV B2)
* MCU: S32K344
* IDE: S32DS3.5 & S32DS3.6
* SDK release: RTD 6.0.0
* Debugger: PE Micro
* Target: internal_FLASH
------------------------------------------------------------------------------
This example routine configures the FlexCAN0 instance for reception. Since RevB2 of the EVB was used for development, CAN TRXCVR used is TJA1443. TJA1443 is initialized in main code (CAN0_STB = 1 & CAN0_EN = 1).
FlexCAN bitrate:
- Bitrate: 500 Kbps
- Sampling point: 81.25%
Individual mask is set to 0x0, meaning all IDs are accepted.
Main routine:
- Waits for SW5 to be pressed, or for FlexCAN interrupt.
- If SW5 is pressed, turns off green LED, disables FlexCAN and switches CORE_CLK to FIRC. It then configures both PTB19 (SW6) and PTA6 (CAN0_RX) for interrupt wakeups.
- If either SW6 is pressed or a CAN message is received (edge detect on PTA6), MCU wakes up and will wait for SW5 to be pressed again.
FlexCAN is configured for INTERRUPT; If a CAN frame is received, bRxFlag is set to 1 inside the callback, blue LED is toggled, and an ACK frame is sent back. CAN communication can be tested either with another EVB, or with a PCAN analyzer connected to J32.
PCAN-View log for dummy and ACK messages:
This example is provided as is with no guarantees and no support.