2418210_en-US

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

2418210_en-US

2418210_en-US

[RTD701 MCAL] FRDM-A-S32K344 CAN <-> ETH Gateway Interrupt
****************************************************************************
*   Detailed Description:
*
*   CAN <-> Ethernet gateway demo for FRDM-A-S32K344.
*
*   CAN FD frames are encapsulated into raw Ethernet frames and
*   transmitted over the 100BASE-TX link.  Received Ethernet frames
*   are decapsulated and forwarded to the CAN FD bus.
*
*   Key Functionality:
*   - Interrupt-driven CAN FD reception via CanIf_RxIndication callback.
*   - Interrupt-driven Ethernet reception via EthIf_RxIndication callback
*     (EthCtrlEnableIngressQueueInterrupt, GMAC0_CH_RX_IRQHandler).
*   - GMAC TX confirmation interrupt processing (GMAC0_CH_TX_IRQHandler).
*   - Custom gateway format for CAN ID, DLC, flags and
*     payload (up to 64 bytes CAN FD) in a fixed 72-byte Ethernet payload.
*   - PHY CAN transceiver initialization.
*   - Ethernet PHY auto-detection and MDIO configuration via EthPhy driver.
*   - PHY initialization selectable at compile time:
*       PHY_INIT_BY_PIN_STRAPPING  (default)
*       PHY_INIT_BY_SOFTWARE       (MDIO register write)
*
*   Main Loop Flow:
*   - CAN  -> ETH : CanIf_bRxFlag set by ISR -> App_EthTransmit()
*   - ETH  -> CAN : ethReceiveFlag set by ISR -> App_CanTransmit()
*
*   Notes:
*   - Red LED set if Gateway_Init returns E_NOT_OK.
*   - Green LED toggles upon CAN reception.
*   - Blue LED toggles upon ETH reception.
*   - EthIf.c contains the custom EthIf_RxIndication gateway implementation.
*   - During S32 Configuration Tool code generation select "Keep Existing"
*     for EthIf.c to avoid overwriting the custom callback.
*   - Eth_43_GMAC_ReleaseRxBuffer() must be called unconditionally inside
*     EthIf_RxIndication.
*
*   -------------------------------------------------------------------------
*   Test HW   : FRDM-A-S32K344 Rev A
*   MCU       : S32K344_257BGA
*   IDE       : S32DS 3.6.10
*   RTD       : S32K3_RTD_7_0_1_D2602_ASR_REL_4_9_REV_0000_20260206
*   AUTOSAR   : 4.9.0
*   Debugger  : P&E Micro
*   Target    : Internal_FLASH
*   CAN       : CAN FD, 500 Kbps nominal / 2 Mbps data, TJA1043 transceiver
*   Ethernet  : RMII 100BASE-TX, DP83848 PHY
****************************************************************************
ETH Reception with Wireshark:ETH Reception with Wireshark:ETH Reception with Wireshark:
CAN Reception with PCAN-USB.CAN Reception with PCAN-USB.CAN Reception with PCAN-USB.
Note 1: Inside project you can comment NODE_1 and define NODE_2 as 1 to enable simple routine which sends out a CAN frame if SW3 is pressed, and an ETH frame if SW2 is pressed.
Note 2: For a real gateway application, use a queue or ring buffer instead of one global frame; otherwise, a second CAN frame can overwrite the first before Ethernet transmission completes. This example is for demostration purposes only.
Tags (1)
No ratings
Version history
Last update:
Tuesday
Updated by: