Gibberish receiving when transmitting custom etherType Ethernet Frame

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

Gibberish receiving when transmitting custom etherType Ethernet Frame

Jump to solution
437 Views
R_S002
Contributor III

Hello @PavelL and NXP Community,

I'm sending Ethernet frames with a custom EtherType (0xA5A5) between S32K344 and TJA1103 connected via media converters. I have run and tested LWIP_S32K344 on the same hardware, and it works flawlessly. Below, I have mentioned the transmission code, as well as the frames received on Wireshark. 

/*
 * tx_eth_udp.c
 *
 * Purpose: Build and transmit a valid Ethernet -> IPv4 -> UDP frame
 * Platform: S32K344 + TJA1103 (RMII)
 * Author: RohanS002 Gettobyte
 * Date: 11-Oct-2025
 */
 
#include "Mcal.h"
#include "Clock_Ip.h"
#include "Siul2_Port_Ip_Cfg.h"
#include "Siul2_Port_Ip.h"
#include "Gmac_Ip.h"
#include "string.h"
#include "stdint.h"
#include "stdbool.h"
 
/* ===== app control ===== */
volatile int exit_code = 0;
 
/* ===== GMAC/PHY globals ===== */
#define INST_GMAC_0     (0U)
Gmac_Ip_StatusType Status = 0;
 
/* Replace with your actual MACs for both boards */
static uint8 MacAddr_Src[6U] = { 0x10, 0x11, 0x22, 0x77, 0x77, 0x77 }; /* this board */
static uint8 MacAddr_Dest[6U] = { 0x10, 0x11, 0x22, 0x77, 0x77, 0x78 }; /* peer board */
 
/* ===== PHY discovery scratch ===== */
static uint16 phy_addr; /* discovered PHY address (0..31) */
static uint16 register_value_0;
static uint16 register_value_1;
 
/* ===== TX structures ===== */
static Gmac_Ip_BufferType TxBuffer = { 0 };
static Gmac_Ip_TxInfoType TxInfo = { 0 };
static Gmac_Ip_TxOptionsType TxOptions = {
TRUE, /* add CRC/FCS and pad in hardware */
GMAC_CRC_AND_PAD_INSERTION, GMAC_CHECKSUM_INSERTION_PROTO_PSEUDOH /* we compute checksums in software */
};
 
/* ====== Simple busy-wait delay (approx) ====== */
/* Adjust for your clock; this is just to pace packets for Wireshark */
static void delay_cycles(volatile uint32_t cycles) {
while (cycles--) {
__asm("nop");
}
}
 
/*
 * Ethernet Frame Format (IEEE 802.3 / Ethernet II)
 *
 * +------------+------------+-----------+------------------+-----------+
 * | Destination|   Source   | EtherType |      Payload     |    FCS    |
 * |   MAC (6B) |   MAC (6B) |   (2B)    |    (46–1500 B)   |   (4B)    |
 * +------------+------------+-----------+------------------+-----------+
 *
 * Field Details:
 * - Destination MAC (6 bytes): Who the frame is sent to
 * - Source MAC      (6 bytes): Who is sending the frame
 * - EtherType/Length(2 bytes): Protocol indicator
 * e.g. 0x0800 = IPv4, 0x0806 = ARP, custom = 0x88B5 etc.
 * - Payload         (46–1500 bytes): Actual data being sent
 * - FCS             (4 bytes): CRC checksum (auto-inserted by GMAC HW)
 *
 * In our code:
 * [0..5]   -> txFrame.dstMac
 * [6..11]  -> txFrame.srcMac
 * [12..13] -> txFrame.etherType
 * [14..N]  -> txFrame.payload
 * [N+1..]  -> FCS (handled automatically by hardware)
 */
 
/* A structure to represent an Ethernet frame in a user-friendly way. */
typedef struct {
uint8 dstMac[6];
uint8 srcMac[6];
uint16 etherType;
uint8 payload[64]; /* A buffer for the payload data. */
uint16 payloadLen; /* The actual length of the payload. */
} EthFrame_t;
 
/**
 * @brief Constructs a raw Ethernet frame into a GMAC hardware buffer.
 * @param txBuf A pointer to the GMAC transmit buffer where the frame will be built.
 * @param frame A pointer to the user-friendly frame structure containing the data.
 */
static void BuildEthernetFrame(Gmac_Ip_BufferType *txBuf,
const EthFrame_t *frame) {
/* Get a pointer to the beginning of the hardware buffer's data area. */
uint8 *ptr = txBuf->Data;
 
/* Copy the 6-byte destination MAC address into the buffer. */
memcpy(ptr, frame->dstMac, 6U);
ptr += 6U; // Move the pointer forward by 6 bytes.
 
/* Copy the 6-byte source MAC address. */
memcpy(ptr, frame->srcMac, 6U);
ptr += 6U; // Move the pointer forward.
 
/* Copy the 2-byte EtherType, handling big-endian byte order manually. */
*ptr++ = (uint8) ((frame->etherType >> & 0xFFU); // Most Significant Byte (MSB)
*ptr++ = (uint8) (frame->etherType & 0xFFU); // Least Significant Byte (LSB)
 
/* Copy the payload data into the buffer. */
memcpy(ptr, frame->payload, frame->payloadLen);
ptr += frame->payloadLen; // Move the pointer past the payload.
 
/* Set the total length of the buffer. The FCS (CRC) will be added by the hardware. */
txBuf->Length = (uint32) (ptr - txBuf->Data);
}
 
/* ====== PHY init (TJA110x via MDIO) ====== */
static void Eth_Phy_Init(void) {
/* Enable MDIO (Management Data I/O) for PHY communication */
Gmac_Ip_EnableMDIO(INST_GMAC_0, FALSE, 48000000U);
 
/* --- Discover PHY address by reading PHY ID1/ID2 --- */
for (phy_addr = 0U; phy_addr < 32U; ++phy_addr) {
(void) Gmac_Ip_MDIORead(INST_GMAC_0, phy_addr, 2U, &register_value_0,
1U);
(void) Gmac_Ip_MDIORead(INST_GMAC_0, phy_addr, 3U, &register_value_1,
1U);
 
/* TJA110x ID: 0x001B / 0xB013 (adjust if your silicon differs) */
if ((register_value_0 == 0x001B) && (register_value_1 == 0xB013)) {
break;
}
}
 
/* Reset PHY */
(void) Gmac_Ip_MDIOWrite(INST_GMAC_0, phy_addr, 0U, 0x8000U, 1U);
/* Wait for reset done (bit15 clears) */
do {
(void) Gmac_Ip_MDIORead(INST_GMAC_0, phy_addr, 0U, &register_value_0,
1U);
} while (register_value_0 & 0x8000U);
 
/* Basic sanity checks (optional but good while bringing up) */
/* ePHY enable check */
(void) Gmac_Ip_MDIOReadMMD(INST_GMAC_0, phy_addr, 1, 0x8048U,
&register_value_0, 1U);
/* master/slave */
(void) Gmac_Ip_MDIOReadMMD(INST_GMAC_0, phy_addr, 1, 0x0834U,
&register_value_0, 1U);
/* xMII config (Rev-RMII) */
(void) Gmac_Ip_MDIOReadMMD(INST_GMAC_0, phy_addr, 30, 0xAFC6U,
&register_value_0, 1U);
 
/* Link status poll (bit2 of 0x8102) */
do {
(void) Gmac_Ip_MDIOReadMMD(INST_GMAC_0, phy_addr, 30, 0x8102U,
&register_value_0, 1U);
} while (((register_value_0 & (1U << 2)) == 0U));
}
 
/* ====== Main ====== */
int main(void) {
/* Put MAC into RMII mode through DCM (per your original code) */
IP_DCM_GPR->DCMRWF1 = (IP_DCM_GPR->DCMRWF1
& ~DCM_GPR_DCMRWF1_MAC_CONF_SEL_MASK)
| DCM_GPR_DCMRWF1_MAC_CONF_SEL(2U);
 
/* Clocks / Pins / GMAC driver (generated by RTD config tool) */
Clock_Ip_Init(&Clock_Ip_aClockConfig[0]);
Siul2_Port_Ip_Init(
NUM_OF_CONFIGURED_PINS_PortContainer_0_BOARD_InitPeripherals,
g_pin_mux_InitConfigArr_PortContainer_0_BOARD_InitPeripherals);
 
Status = Gmac_Ip_Init(INST_GMAC_0, &Gmac_0_ConfigPB);
DevAssert(Status == GMAC_STATUS_SUCCESS);
 
/* Bring up PHY and wait for link */
Eth_Phy_Init();
 
/* Declare a local variable to hold the Ethernet frame data. */
EthFrame_t txFrame;
 
/* --- Assemble the Ethernet Frame --- */
/* Copy the retrieved hardware MAC as the source address. */
memcpy(txFrame.srcMac, MacAddr_Src, 6U);
/* Copy the predefined destination MAC address. */
memcpy(txFrame.dstMac, MacAddr_Dest, 6U);
/* Set a custom EtherType (e.g., for a proprietary protocol). 0xBB80 = 48000 */
txFrame.etherType = 0xA5A5U;
/* Set the payload length. Ethernet requires a minimum frame size, so payloads < 46 bytes get padded. */
txFrame.payloadLen = 46U;
 
/* Fill the payload with dummy data (a simple ascending sequence of numbers). */
for (uint16 i = 0; i < txFrame.payloadLen; i++) {
txFrame.payload[i] = (uint8) i;
}
 
/* --- Prepare for Transmission --- */
/* Request a free transmit buffer from the GMAC driver's internal queue. */
Status = Gmac_Ip_GetTxBuff(INST_GMAC_0, 0U, &TxBuffer, NULL_PTR);
DevAssert(Status == GMAC_STATUS_SUCCESS); // Halt if no buffer is available.
 
/* Call the helper function to copy the assembled frame into the hardware buffer. */
BuildEthernetFrame(&TxBuffer, &txFrame);
 
/* ==== Send once per second so Wireshark is easy to read ==== */
for (;;) {
 
/* --- Send the Frame --- */
/* Instruct the GMAC hardware to send the contents of the buffer. */
Status = Gmac_Ip_SendFrame(INST_GMAC_0, 0U, &TxBuffer, &TxOptions);
DevAssert(Status == GMAC_STATUS_SUCCESS); // Halt if sending fails.
 
/* Wait for the frame to be transmitted */
do {
Status = Gmac_Ip_GetTransmitStatus(INST_GMAC_0, 0U, &TxBuffer,
&TxInfo);
} while (Status == GMAC_STATUS_BUSY);
 
DevAssert((GMAC_STATUS_SUCCESS == Status) || (0U != TxInfo.ErrMask));
 
/* ~1 second delay (tune for your clock: this is a rough software wait) */
delay_cycles(10000000U);
 
if (exit_code != 0) {
break;
}
}
 
return exit_code;
}

 

Tags (2)
0 Kudos
Reply
1 Solution
420 Views
PavelL
NXP Employee
NXP Employee

Hello @R_S002 ,

I believe that this code row:

*ptr++ = (uint8) ((frame->etherType >> & 0xFFU); // Most Significant Byte (MSB)
 
should look like:

*ptr++ = (uint8)((frame->etherType >> 8 ) & 0xFFU); // Most Significant Byte (MSB)
 

Best regards,

Pavel

View solution in original post

0 Kudos
Reply
1 Reply
421 Views
PavelL
NXP Employee
NXP Employee

Hello @R_S002 ,

I believe that this code row:

*ptr++ = (uint8) ((frame->etherType >> & 0xFFU); // Most Significant Byte (MSB)
 
should look like:

*ptr++ = (uint8)((frame->etherType >> 8 ) & 0xFFU); // Most Significant Byte (MSB)
 

Best regards,

Pavel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2187991%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EGibberish%20receiving%20when%20transmitting%20custom%20etherType%20Ethernet%20Frame%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187991%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F233505%22%20target%3D%22_blank%22%3E%40PavelL%3C%2FA%3E%20and%20NXP%20Community%2C%3C%2FP%3E%3CP%3EI'm%20sending%20Ethernet%20frames%20with%20a%20custom%20EtherType%20(0xA5A5)%20between%20S32K344%20and%20TJA1103%20connected%20via%20media%20converters.%20I%20have%20run%20and%20tested%20LWIP_S32K344%20on%20the%20same%20hardware%2C%20and%20it%20works%20flawlessly.%20Below%2C%20I%20have%20mentioned%20the%20transmission%20code%2C%20as%20well%20as%20the%20frames%20received%20on%20Wireshark.%26nbsp%3B%3C%2FP%3E%3CDIV%3E%2F*%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20tx_eth_udp.c%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20Purpose%3A%20Build%20and%20transmit%20a%20valid%20Ethernet%20-%26gt%3B%20IPv4%20-%26gt%3B%20UDP%20frame%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20Platform%3A%20S32K344%20%2B%20TJA1103%20(RMII)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20Author%3A%20RohanS002%20Gettobyte%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20Date%3A%2011-Oct-2025%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%23include%20%22Mcal.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22Clock_Ip.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22Siul2_Port_Ip_Cfg.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22Siul2_Port_Ip.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22Gmac_Ip.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22string.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22stdint.h%22%3C%2FDIV%3E%3CDIV%3E%23include%20%22stdbool.h%22%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%20app%20control%20%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3Evolatile%20int%20exit_code%20%3D%200%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%20GMAC%2FPHY%20globals%20%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3E%23define%20INST_GMAC_0%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B(0U)%3C%2FDIV%3E%3CDIV%3EGmac_Ip_StatusType%20Status%20%3D%200%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20Replace%20with%20your%20actual%20MACs%20for%20both%20boards%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20uint8%20MacAddr_Src%5B6U%5D%20%3D%20%7B%200x10%2C%200x11%2C%200x22%2C%200x77%2C%200x77%2C%200x77%20%7D%3B%20%2F*%20this%20board%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20uint8%20MacAddr_Dest%5B6U%5D%20%3D%20%7B%200x10%2C%200x11%2C%200x22%2C%200x77%2C%200x77%2C%200x78%20%7D%3B%20%2F*%20peer%20board%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%20PHY%20discovery%20scratch%20%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20uint16%20phy_addr%3B%20%2F*%20discovered%20PHY%20address%20(0..31)%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20uint16%20register_value_0%3B%3C%2FDIV%3E%3CDIV%3Estatic%20uint16%20register_value_1%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%20TX%20structures%20%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20Gmac_Ip_BufferType%20TxBuffer%20%3D%20%7B%200%20%7D%3B%3C%2FDIV%3E%3CDIV%3Estatic%20Gmac_Ip_TxInfoType%20TxInfo%20%3D%20%7B%200%20%7D%3B%3C%2FDIV%3E%3CDIV%3Estatic%20Gmac_Ip_TxOptionsType%20TxOptions%20%3D%20%7B%3C%2FDIV%3E%3CDIV%3ETRUE%2C%20%2F*%20add%20CRC%2FFCS%20and%20pad%20in%20hardware%20*%2F%3C%2FDIV%3E%3CDIV%3EGMAC_CRC_AND_PAD_INSERTION%2C%20GMAC_CHECKSUM_INSERTION_PROTO_PSEUDOH%20%2F*%20we%20compute%20checksums%20in%20software%20*%2F%3C%2FDIV%3E%3CDIV%3E%7D%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%3D%20Simple%20busy-wait%20delay%20(approx)%20%3D%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3E%2F*%20Adjust%20for%20your%20clock%3B%20this%20is%20just%20to%20pace%20packets%20for%20Wireshark%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20void%20delay_cycles(volatile%20uint32_t%20cycles)%20%7B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ewhile%20(cycles--)%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E__asm(%22nop%22)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20Ethernet%20Frame%20Format%20(IEEE%20802.3%20%2F%20Ethernet%20II)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%2B------------%2B------------%2B-----------%2B------------------%2B-----------%2B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%7C%20Destination%7C%26nbsp%3B%20%26nbsp%3BSource%26nbsp%3B%20%26nbsp%3B%7C%20EtherType%20%7C%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Payload%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7C%26nbsp%3B%20%26nbsp%3B%20FCS%26nbsp%3B%20%26nbsp%3B%20%7C%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%7C%26nbsp%3B%20%26nbsp%3BMAC%20(6B)%20%7C%26nbsp%3B%20%26nbsp%3BMAC%20(6B)%20%7C%26nbsp%3B%20%26nbsp%3B(2B)%26nbsp%3B%20%26nbsp%3B%20%7C%26nbsp%3B%20%26nbsp%3B%20(46%E2%80%931500%20B)%26nbsp%3B%20%26nbsp%3B%7C%26nbsp%3B%20%26nbsp%3B(4B)%26nbsp%3B%20%26nbsp%3B%20%7C%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%2B------------%2B------------%2B-----------%2B------------------%2B-----------%2B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20Field%20Details%3A%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20-%20Destination%20MAC%20(6%20bytes)%3A%20Who%20the%20frame%20is%20sent%20to%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20-%20Source%20MAC%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20(6%20bytes)%3A%20Who%20is%20sending%20the%20frame%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20-%20EtherType%2FLength(2%20bytes)%3A%20Protocol%20indicator%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20e.g.%200x0800%20%3D%20IPv4%2C%200x0806%20%3D%20ARP%2C%20custom%20%3D%200x88B5%20etc.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20-%20Payload%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B(46%E2%80%931500%20bytes)%3A%20Actual%20data%20being%20sent%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20-%20FCS%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B(4%20bytes)%3A%20CRC%20checksum%20(auto-inserted%20by%20GMAC%20HW)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20In%20our%20code%3A%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%5B0..5%5D%26nbsp%3B%20%26nbsp%3B-%26gt%3B%20txFrame.dstMac%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%5B6..11%5D%26nbsp%3B%20-%26gt%3B%20txFrame.srcMac%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%5B12..13%5D%20-%26gt%3B%20txFrame.etherType%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%5B14..N%5D%26nbsp%3B%20-%26gt%3B%20txFrame.payload%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%5BN%2B1..%5D%26nbsp%3B%20-%26gt%3B%20FCS%20(handled%20automatically%20by%20hardware)%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20A%20structure%20to%20represent%20an%20Ethernet%20frame%20in%20a%20user-friendly%20way.%20*%2F%3C%2FDIV%3E%3CDIV%3Etypedef%20struct%20%7B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Euint8%20dstMac%5B6%5D%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Euint8%20srcMac%5B6%5D%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Euint16%20etherType%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Euint8%20payload%5B64%5D%3B%20%2F*%20A%20buffer%20for%20the%20payload%20data.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Euint16%20payloadLen%3B%20%2F*%20The%20actual%20length%20of%20the%20payload.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%7D%20EthFrame_t%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F**%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%40brief%20Constructs%20a%20raw%20Ethernet%20frame%20into%20a%20GMAC%20hardware%20buffer.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%3Ca%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F197964%22%3E%40Param%3C%2Fa%3E%20txBuf%20A%20pointer%20to%20the%20GMAC%20transmit%20buffer%20where%20the%20frame%20will%20be%20built.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%20%3Ca%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F197964%22%3E%40Param%3C%2Fa%3E%20frame%20A%20pointer%20to%20the%20user-friendly%20frame%20structure%20containing%20the%20data.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20void%20BuildEthernetFrame(Gmac_Ip_BufferType%20*txBuf%2C%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Econst%20EthFrame_t%20*frame)%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Get%20a%20pointer%20to%20the%20beginning%20of%20the%20hardware%20buffer's%20data%20area.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Euint8%20*ptr%20%3D%20txBuf-%26gt%3BData%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Copy%20the%206-byte%20destination%20MAC%20address%20into%20the%20buffer.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ememcpy(ptr%2C%20frame-%26gt%3BdstMac%2C%206U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eptr%20%2B%3D%206U%3B%20%2F%2F%20Move%20the%20pointer%20forward%20by%206%20bytes.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Copy%20the%206-byte%20source%20MAC%20address.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ememcpy(ptr%2C%20frame-%26gt%3BsrcMac%2C%206U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eptr%20%2B%3D%206U%3B%20%2F%2F%20Move%20the%20pointer%20forward.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Copy%20the%202-byte%20EtherType%2C%20handling%20big-endian%20byte%20order%20manually.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E*ptr%2B%2B%20%3D%20(uint8)%20((frame-%26gt%3BetherType%20%26gt%3B%26gt%3B%20%3CLI-EMOJI%20id%3D%22lia_smiling-face-with-sunglasses%22%20title%3D%22%3Asmiling_face_with_sunglasses%3A%22%3E%3C%2FLI-EMOJI%3E%20%26amp%3B%200xFFU)%3B%20%2F%2F%20Most%20Significant%20Byte%20(MSB)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E*ptr%2B%2B%20%3D%20(uint8)%20(frame-%26gt%3BetherType%20%26amp%3B%200xFFU)%3B%20%2F%2F%20Least%20Significant%20Byte%20(LSB)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Copy%20the%20payload%20data%20into%20the%20buffer.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ememcpy(ptr%2C%20frame-%26gt%3Bpayload%2C%20frame-%26gt%3BpayloadLen)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eptr%20%2B%3D%20frame-%26gt%3BpayloadLen%3B%20%2F%2F%20Move%20the%20pointer%20past%20the%20payload.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Set%20the%20total%20length%20of%20the%20buffer.%20The%20FCS%20(CRC)%20will%20be%20added%20by%20the%20hardware.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EtxBuf-%26gt%3BLength%20%3D%20(uint32)%20(ptr%20-%20txBuf-%26gt%3BData)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%3D%20PHY%20init%20(TJA110x%20via%20MDIO)%20%3D%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3Estatic%20void%20Eth_Phy_Init(void)%20%7B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Enable%20MDIO%20(Management%20Data%20I%2FO)%20for%20PHY%20communication%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EGmac_Ip_EnableMDIO(INST_GMAC_0%2C%20FALSE%2C%2048000000U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20---%20Discover%20PHY%20address%20by%20reading%20PHY%20ID1%2FID2%20---%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Efor%20(phy_addr%20%3D%200U%3B%20phy_addr%20%26lt%3B%2032U%3B%20%2B%2Bphy_addr)%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIORead(INST_GMAC_0%2C%20phy_addr%2C%202U%2C%20%26amp%3Bregister_value_0%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E1U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIORead(INST_GMAC_0%2C%20phy_addr%2C%203U%2C%20%26amp%3Bregister_value_1%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E1U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20TJA110x%20ID%3A%200x001B%20%2F%200xB013%20(adjust%20if%20your%20silicon%20differs)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eif%20((register_value_0%20%3D%3D%200x001B)%20%26amp%3B%26amp%3B%20(register_value_1%20%3D%3D%200xB013))%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ebreak%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Reset%20PHY%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIOWrite(INST_GMAC_0%2C%20phy_addr%2C%200U%2C%200x8000U%2C%201U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Wait%20for%20reset%20done%20(bit15%20clears)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Edo%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIORead(INST_GMAC_0%2C%20phy_addr%2C%200U%2C%20%26amp%3Bregister_value_0%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E1U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%20while%20(register_value_0%20%26amp%3B%200x8000U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Basic%20sanity%20checks%20(optional%20but%20good%20while%20bringing%20up)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20ePHY%20enable%20check%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIOReadMMD(INST_GMAC_0%2C%20phy_addr%2C%201%2C%200x8048U%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26amp%3Bregister_value_0%2C%201U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20master%2Fslave%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIOReadMMD(INST_GMAC_0%2C%20phy_addr%2C%201%2C%200x0834U%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26amp%3Bregister_value_0%2C%201U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20xMII%20config%20(Rev-RMII)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIOReadMMD(INST_GMAC_0%2C%20phy_addr%2C%2030%2C%200xAFC6U%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26amp%3Bregister_value_0%2C%201U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Link%20status%20poll%20(bit2%20of%200x8102)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Edo%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E(void)%20Gmac_Ip_MDIOReadMMD(INST_GMAC_0%2C%20phy_addr%2C%2030%2C%200x8102U%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26amp%3Bregister_value_0%2C%201U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%20while%20(((register_value_0%20%26amp%3B%20(1U%20%26lt%3B%26lt%3B%202))%20%3D%3D%200U))%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%2F*%20%3D%3D%3D%3D%3D%3D%20Main%20%3D%3D%3D%3D%3D%3D%20*%2F%3C%2FDIV%3E%3CDIV%3Eint%20main(void)%20%7B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Put%20MAC%20into%20RMII%20mode%20through%20DCM%20(per%20your%20original%20code)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EIP_DCM_GPR-%26gt%3BDCMRWF1%20%3D%20(IP_DCM_GPR-%26gt%3BDCMRWF1%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26amp%3B%20~DCM_GPR_DCMRWF1_MAC_CONF_SEL_MASK)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20DCM_GPR_DCMRWF1_MAC_CONF_SEL(2U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Clocks%20%2F%20Pins%20%2F%20GMAC%20driver%20(generated%20by%20RTD%20config%20tool)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EClock_Ip_Init(%26amp%3BClock_Ip_aClockConfig%5B0%5D)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ESiul2_Port_Ip_Init(%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ENUM_OF_CONFIGURED_PINS_PortContainer_0_BOARD_InitPeripherals%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eg_pin_mux_InitConfigArr_PortContainer_0_BOARD_InitPeripherals)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStatus%20%3D%20Gmac_Ip_Init(INST_GMAC_0%2C%20%26amp%3BGmac_0_ConfigPB)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EDevAssert(Status%20%3D%3D%20GMAC_STATUS_SUCCESS)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Bring%20up%20PHY%20and%20wait%20for%20link%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EEth_Phy_Init()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Declare%20a%20local%20variable%20to%20hold%20the%20Ethernet%20frame%20data.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EEthFrame_t%20txFrame%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20---%20Assemble%20the%20Ethernet%20Frame%20---%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Copy%20the%20retrieved%20hardware%20MAC%20as%20the%20source%20address.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ememcpy(txFrame.srcMac%2C%20MacAddr_Src%2C%206U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Copy%20the%20predefined%20destination%20MAC%20address.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ememcpy(txFrame.dstMac%2C%20MacAddr_Dest%2C%206U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Set%20a%20custom%20EtherType%20(e.g.%2C%20for%20a%20proprietary%20protocol).%200xBB80%20%3D%2048000%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EtxFrame.etherType%20%3D%200xA5A5U%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Set%20the%20payload%20length.%20Ethernet%20requires%20a%20minimum%20frame%20size%2C%20so%20payloads%20%26lt%3B%2046%20bytes%20get%20padded.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EtxFrame.payloadLen%20%3D%2046U%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Fill%20the%20payload%20with%20dummy%20data%20(a%20simple%20ascending%20sequence%20of%20numbers).%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Efor%20(uint16%20i%20%3D%200%3B%20i%20%26lt%3B%20txFrame.payloadLen%3B%20i%2B%2B)%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EtxFrame.payload%5Bi%5D%20%3D%20(uint8)%20i%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20---%20Prepare%20for%20Transmission%20---%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Request%20a%20free%20transmit%20buffer%20from%20the%20GMAC%20driver's%20internal%20queue.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStatus%20%3D%20Gmac_Ip_GetTxBuff(INST_GMAC_0%2C%200U%2C%20%26amp%3BTxBuffer%2C%20NULL_PTR)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EDevAssert(Status%20%3D%3D%20GMAC_STATUS_SUCCESS)%3B%20%2F%2F%20Halt%20if%20no%20buffer%20is%20available.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Call%20the%20helper%20function%20to%20copy%20the%20assembled%20frame%20into%20the%20hardware%20buffer.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EBuildEthernetFrame(%26amp%3BTxBuffer%2C%20%26amp%3BtxFrame)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20%3D%3D%3D%3D%20Send%20once%20per%20second%20so%20Wireshark%20is%20easy%20to%20read%20%3D%3D%3D%3D%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Efor%20(%3B%3B)%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20---%20Send%20the%20Frame%20---%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Instruct%20the%20GMAC%20hardware%20to%20send%20the%20contents%20of%20the%20buffer.%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStatus%20%3D%20Gmac_Ip_SendFrame(INST_GMAC_0%2C%200U%2C%20%26amp%3BTxBuffer%2C%20%26amp%3BTxOptions)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EDevAssert(Status%20%3D%3D%20GMAC_STATUS_SUCCESS)%3B%20%2F%2F%20Halt%20if%20sending%20fails.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20Wait%20for%20the%20frame%20to%20be%20transmitted%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Edo%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStatus%20%3D%20Gmac_Ip_GetTransmitStatus(INST_GMAC_0%2C%200U%2C%20%26amp%3BTxBuffer%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26amp%3BTxInfo)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%20while%20(Status%20%3D%3D%20GMAC_STATUS_BUSY)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EDevAssert((GMAC_STATUS_SUCCESS%20%3D%3D%20Status)%20%7C%7C%20(0U%20!%3D%20TxInfo.ErrMask))%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F*%20~1%20second%20delay%20(tune%20for%20your%20clock%3A%20this%20is%20a%20rough%20software%20wait)%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Edelay_cycles(10000000U)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eif%20(exit_code%20!%3D%200)%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ebreak%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ereturn%20exit_code%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188046%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Gibberish%20receiving%20when%20transmitting%20custom%20etherType%20Ethernet%20Frame%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188046%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253472%22%20target%3D%22_blank%22%3E%40R_S002%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EI%20believe%20that%20this%20code%20row%3A%3C%2FP%3E%0A%3CDIV%3E%3CSPAN%3E*ptr%2B%2B%20%3D%20(uint8)%20((frame-%26gt%3BetherType%20%26gt%3B%26gt%3B%26nbsp%3B%3CLI-EMOJI%20id%3D%22lia_smiling-face-with-sunglasses%22%20title%3D%22%3Asmiling_face_with_sunglasses%3A%22%3E%3C%2FLI-EMOJI%3E%26amp%3B%200xFFU)%3B%20%2F%2F%20Most%20Significant%20Byte%20(MSB)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Eshould%20look%20like%3A%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CP%3E%3CSPAN%3E%3C!--ScriptorStartFragment--%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%20class%3D%22scriptor-paragraph%22%3E%3CSPAN%3E*%3C%2FSPAN%3E%3CSPAN%3Eptr%3C%2FSPAN%3E%3CSPAN%3E%2B%3C%2FSPAN%3E%3CSPAN%3E%2B%3C%2FSPAN%3E%20%3CSPAN%3E%3D%3C%2FSPAN%3E%20%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Euint8%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Eframe%3C%2FSPAN%3E%3CSPAN%3E-%26gt%3Bether%3C%2FSPAN%3E%3CSPAN%3EType%3C%2FSPAN%3E%20%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%26nbsp%3B8%20)%26nbsp%3B%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CLI-EMOJI%20id%3D%22lia_smiling-face-with-sunglasses%22%20title%3D%22%3Asmiling_face_with_sunglasses%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FFONT%3E%3C%2FSTRONG%3E%3CSPAN%3E%26amp%3B%3C%2FSPAN%3E%3CSPAN%3E%200xFFU%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%20%3CSPAN%3E%2F%2F%20Most%20Significant%20Byte%20(MSB)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EPavel%3C%2FP%3E%3C%2FLINGO-BODY%3E