Ethernet Communication

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

Ethernet Communication

Jump to solution
3,579 Views
Govind89
Contributor II

I am new to i.MX RT1170 development and using the EVKBMIMXRT1170 board. I'm working with the built-in example code evkbmimxrt1170_enet_txrx_transfer_cm7 for Ethernet functionality, but I'm finding it difficult to understand how it works.

I would like to request a simpler, bare-metal code example that focuses just on basic Ethernet operations:

  • Ethernet configuration

  • Ethernet initialization

  • Ethernet frame transmission

  • Ethernet frame reception

I need this in API-style simple code without RTOS, using MCUXpresso IDE. Please provide guidance and the simplest base code for Ethernet functionality on my EVKBMIMXRT1170 development board.
i.MX-RT1170 MCUXpresso-IDE 

Tags (2)
0 Kudos
Reply
1 Solution
3,471 Views
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

I suggest you can check the example in SDK import Wizard.

mayliu1_0-1746098335143.png

Best Regards

MayLiu

View solution in original post

0 Kudos
Reply
5 Replies
3,550 Views
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

Thank you so much for your interest in our products and for using our community.

I think the project you imported is already without FREERTOS, if you want more Ethernet demo, you can check by import  SDK example. 

mayliu1_0-1745898661549.png

If you want know more about the SDK API. you can refer to the document "MCUXpresso SDK API Reference Manual"

https://mcuxpresso.nxp.com/api_doc/dev/329/index.html

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

Best Regards
MayLiu

0 Kudos
Reply
3,542 Views
Govind89
Contributor II
helle @mayliu1
Thanks for replay

Based on the example, I tried, but I am unable to receive and transmit the frame.

I modified the code to create a simpler version. using evkbmimxrt1170_enet_txrx_transfer_cm7 example code please guide me what will be need to change. i am attech project file.



#include "fsl_debug_console.h"

#include "fsl_silicon_id.h"

#include "fsl_enet.h"

#include "fsl_phy.h"

#include "board.h"



#include "fsl_phyrtl8201.h"



#include "fsl_enet.h"

#include "board.h"



#define EXAMPLE_ENET ENET

#define EXAMPLE_CLOCK_FREQ CLOCK_GetRootClockFreq(kCLOCK_Root_Bus)

#define ENET_RXBD_NUM 4

#define ENET_TXBD_NUM 4

#define ENET_RXBUFF_SIZE ENET_FRAME_MAX_FRAMELEN

#define ENET_TXBUFF_SIZE ENET_FRAME_MAX_FRAMELEN

#define ENET_DATA_LENGTH 1000



/* Buffer descriptors */

AT_NONCACHEABLE_SECTION_ALIGN(enet_rx_bd_struct_t g_rxBuffDescrip[ENET_RXBD_NUM], ENET_BUFF_ALIGNMENT);

AT_NONCACHEABLE_SECTION_ALIGN(enet_tx_bd_struct_t g_txBuffDescrip[ENET_TXBD_NUM], ENET_BUFF_ALIGNMENT);



/* Data buffers */

SDK_ALIGN(uint8_t g_rxDataBuff[ENET_RXBD_NUM][ENET_RXBUFF_SIZE], ENET_BUFF_ALIGNMENT);

SDK_ALIGN(uint8_t g_txDataBuff[ENET_TXBD_NUM][ENET_TXBUFF_SIZE], ENET_BUFF_ALIGNMENT);



/* MAC address */

uint8_t g_macAddr[6] =

{ 0x02, 0x12, 0x13, 0x14, 0x15, 0x16 };



/* ENET handle */

static enet_handle_t g_handle;



static void BuildTestFrame(uint8_t *frame)

{

/* Destination MAC (broadcast) */

for (int i = 0; i < 6; i++)

{

frame[i] = 0xFF;

}



/* Source MAC */

memcpy(&frame[6], g_macAddr, 6);



/* EtherType/Length */

frame[12] = 0x08; // IPv4

frame[13] = 0x00;



/* Simple payload */

for (int i = 14; i < ENET_DATA_LENGTH; i++)

{

frame[i] = i % 256;

}

}



void InitEthernet(void)

{

enet_config_t config;



/* Prepare buffer configuration */

enet_buffer_config_t buffConfig =

{

ENET_RXBD_NUM,

ENET_TXBD_NUM,

ENET_RXBUFF_SIZE,

ENET_TXBUFF_SIZE, g_rxBuffDescrip, g_txBuffDescrip, &g_rxDataBuff[0][0], &g_txDataBuff[0][0],

true,

true,

NULL };



/* Get default ENET configuration */

ENET_GetDefaultConfig(&config);

config.miiMode = kENET_RmiiMode;

config.miiSpeed = kENET_MiiSpeed100M;

config.miiDuplex = kENET_MiiFullDuplex;



/* Initialize ENET */

ENET_Init(EXAMPLE_ENET, &g_handle, &config, &buffConfig, g_macAddr, EXAMPLE_CLOCK_FREQ);

ENET_ActiveRead(EXAMPLE_ENET);

}



int main(void)

{

uint8_t txFrame[ENET_DATA_LENGTH];

uint8_t rxBuffer[ENET_RXBUFF_SIZE];



/* Initialize hardware */

BOARD_InitHardware();



/* Initialize Ethernet */

InitEthernet();



/* Build test frame */

BuildTestFrame(txFrame);



while (1)

{

uint32_t frameLength = 0;



/* Check for received frames */

if (ENET_GetRxFrameSize(&g_handle, &frameLength, 0) == kStatus_Success)

{

if (frameLength > 0)

{

/* Read the frame */

if (ENET_ReadFrame(EXAMPLE_ENET, &g_handle, rxBuffer, frameLength, 0, NULL) == kStatus_Success)

{

/* Process received frame here */

}

}

}



/* Send test frame */

status_t ENET_SendFrame(ENET_Type *base, enet_handle_t *handle, const uint8_t *data, uint32_t length, uint8_t ringId,

bool tsFlag, void *context);



ENET_SendFrame(EXAMPLE_ENET, &g_handle, txFrame, ENET_DATA_LENGTH, 0, false, NULL);



/* Small delay */

for (volatile int i = 0; i < 1000000; i++);

}

}











in that i am getting also error undefined reference to `PHY_LinkStatusChange'
0 Kudos
Reply
3,515 Views
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

Thanks for your updated information.

I don't recommend modifying the NXP SDK demo code ,because it may introduce additional issues.

Since the NXP SDK demo is already well-optimized , and it was rigorously tested to ensure proper functionality, I suggest you refer to the example code as it is(when the demo runs ok, then you can modify the code you want to test).

Additionally, I suggest you check  the README file for this demo to confirm your development environment is correctly configured.

mayliu1_0-1745985202094.png

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

Best Regards
MayLiu

0 Kudos
Reply
3,502 Views
Govind89
Contributor II
Thank you for your response. Additionally, I would like to inquire about communication between two RT boards using Ethernet. Both boards have 1 Gbps and 100 Mbps ports available. Could you please advise which example I should follow for this setup?
0 Kudos
Reply
3,472 Views
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

I suggest you can check the example in SDK import Wizard.

mayliu1_0-1746098335143.png

Best Regards

MayLiu

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2088184%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EEthernet%20Communication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2088184%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3EI%20am%20new%20to%20i.MX%20RT1170%20development%20and%20using%20the%20EVKBMIMXRT1170%20board.%20I'm%20working%20with%20the%20built-in%20example%20code%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eevkbmimxrt1170_enet_txrx_transfer_cm7%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20Ethernet%20functionality%2C%20but%20I'm%20finding%20it%20difficult%20to%20understand%20how%20it%20works.%3C%2FP%3E%3CP%20class%3D%22%22%3EI%20would%20like%20to%20request%20a%20simpler%2C%20bare-metal%20code%20example%20that%20focuses%20just%20on%20basic%20Ethernet%20operations%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3EEthernet%20configuration%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EEthernet%20initialization%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EEthernet%20frame%20transmission%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3EEthernet%20frame%20reception%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%20class%3D%22%22%3EI%20need%20this%20in%20API-style%20simple%20code%20without%20RTOS%2C%20using%20MCUXpresso%20IDE.%20Please%20provide%20guidance%20and%20the%20simplest%20base%20code%20for%20Ethernet%20functionality%20on%20my%20EVKBMIMXRT1170%20development%20board.%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2Fi.MX-RT1170%2Fpd-p%2Fi.MX-RT1170%22%20class%3D%22lia-product-mention%22%20data-product%3D%22519-1%22%20target%3D%22_blank%22%3Ei.MX-RT1170%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FMCUXpresso-IDE%2Fpd-p%2FMCUXpresso-IDE%22%20class%3D%22lia-product-mention%22%20data-product%3D%223137-1%22%20target%3D%22_blank%22%3EMCUXpresso-IDE%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2090579%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Ethernet%20Communication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2090579%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234971%22%20target%3D%22_blank%22%3E%40Govind89%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EI%20suggest%20you%20can%20check%20the%20example%20in%20SDK%20import%20Wizard.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mayliu1_0-1746098335143.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mayliu1_0-1746098335143.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F335944i2EDE9580E2430E40%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mayliu1_0-1746098335143.png%22%20alt%3D%22mayliu1_0-1746098335143.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBest%20Regards%3C%2FP%3E%0A%3CP%3EMayLiu%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2089827%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Ethernet%20Communication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2089827%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThank%20you%20for%20your%20response.%20Additionally%2C%20I%20would%20like%20to%20inquire%20about%20communication%20between%20two%20RT%20boards%20using%20Ethernet.%20Both%20boards%20have%201%20Gbps%20and%20100%20Mbps%20ports%20available.%20Could%20you%20please%20advise%20which%20example%20I%20should%20follow%20for%20this%20setup%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2089794%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Ethernet%20Communication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2089794%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234971%22%20target%3D%22_blank%22%3E%40Govind89%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EThanks%20for%20your%20updated%20information.%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI%20don't%20recommend%20modifying%20the%20NXP%20SDK%20demo%20code%20%2Cbecause%20it%20may%20introduce%20additional%20issues.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESince%20the%20NXP%20SDK%20demo%20is%20already%20well-optimized%20%2C%20and%20it%20was%20rigorously%20tested%20to%20ensure%20proper%20functionality%2C%20I%20suggest%20you%20refer%20to%20the%20example%20code%20as%20it%20is(when%20the%20demo%20runs%20ok%2C%20then%20you%20can%20modify%20the%20code%20you%20want%20to%20test).%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAdditionally%2C%20I%20suggest%20you%20check%26nbsp%3B%20the%20README%20file%20for%20this%20demo%20to%20confirm%20your%20development%20environment%20is%20correctly%20configured.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mayliu1_0-1745985202094.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mayliu1_0-1745985202094.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F335705i2E7CB5080A5477E0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mayliu1_0-1745985202094.png%22%20alt%3D%22mayliu1_0-1745985202094.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWish%20it%20helps%20you.%3CBR%20%2F%3EIf%20you%20still%20have%20question%20about%20it%2C%20please%20kindly%20let%20me%20know.%3C%2FP%3E%0A%3CP%3EWish%20you%20a%20nice%20day!%3C%2FP%3E%0A%3CP%3EBest%20Regards%3CBR%20%2F%3EMayLiu%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2088907%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Ethernet%20Communication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2088907%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ehelle%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239163%22%20target%3D%22_blank%22%3E%40mayliu1%3C%2FA%3E%3CBR%20%2F%3EThanks%20for%20replay%3CBR%20%2F%3E%3CBR%20%2F%3EBased%20on%20the%20example%2C%20I%20tried%2C%20but%20I%20am%20unable%20to%20receive%20and%20transmit%20the%20frame.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20modified%20the%20code%20to%20create%20a%20simpler%20version.%20using%20evkbmimxrt1170_enet_txrx_transfer_cm7%20example%20code%20please%20guide%20me%20what%20will%20be%20need%20to%20change.%20i%20am%20attech%20project%20file.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22fsl_debug_console.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22fsl_silicon_id.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22fsl_enet.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22fsl_phy.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22board.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22fsl_phyrtl8201.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22fsl_enet.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23include%20%22board.h%22%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20EXAMPLE_ENET%20ENET%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20EXAMPLE_CLOCK_FREQ%20CLOCK_GetRootClockFreq(kCLOCK_Root_Bus)%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20ENET_RXBD_NUM%204%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20ENET_TXBD_NUM%204%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20ENET_RXBUFF_SIZE%20ENET_FRAME_MAX_FRAMELEN%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20ENET_TXBUFF_SIZE%20ENET_FRAME_MAX_FRAMELEN%3CBR%20%2F%3E%3CBR%20%2F%3E%23define%20ENET_DATA_LENGTH%201000%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Buffer%20descriptors%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3EAT_NONCACHEABLE_SECTION_ALIGN(enet_rx_bd_struct_t%20g_rxBuffDescrip%5BENET_RXBD_NUM%5D%2C%20ENET_BUFF_ALIGNMENT)%3B%3CBR%20%2F%3E%3CBR%20%2F%3EAT_NONCACHEABLE_SECTION_ALIGN(enet_tx_bd_struct_t%20g_txBuffDescrip%5BENET_TXBD_NUM%5D%2C%20ENET_BUFF_ALIGNMENT)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Data%20buffers%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3ESDK_ALIGN(uint8_t%20g_rxDataBuff%5BENET_RXBD_NUM%5D%5BENET_RXBUFF_SIZE%5D%2C%20ENET_BUFF_ALIGNMENT)%3B%3CBR%20%2F%3E%3CBR%20%2F%3ESDK_ALIGN(uint8_t%20g_txDataBuff%5BENET_TXBD_NUM%5D%5BENET_TXBUFF_SIZE%5D%2C%20ENET_BUFF_ALIGNMENT)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20MAC%20address%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Euint8_t%20g_macAddr%5B6%5D%20%3D%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%200x02%2C%200x12%2C%200x13%2C%200x14%2C%200x15%2C%200x16%20%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20ENET%20handle%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Estatic%20enet_handle_t%20g_handle%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Estatic%20void%20BuildTestFrame(uint8_t%20*frame)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Destination%20MAC%20(broadcast)%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Efor%20(int%20i%20%3D%200%3B%20i%20%26lt%3B%206%3B%20i%2B%2B)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3Eframe%5Bi%5D%20%3D%200xFF%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Source%20MAC%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Ememcpy(%26amp%3Bframe%5B6%5D%2C%20g_macAddr%2C%206)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20EtherType%2FLength%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Eframe%5B12%5D%20%3D%200x08%3B%20%2F%2F%20IPv4%3CBR%20%2F%3E%3CBR%20%2F%3Eframe%5B13%5D%20%3D%200x00%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Simple%20payload%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Efor%20(int%20i%20%3D%2014%3B%20i%20%26lt%3B%20ENET_DATA_LENGTH%3B%20i%2B%2B)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3Eframe%5Bi%5D%20%3D%20i%20%25%20256%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Evoid%20InitEthernet(void)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3Eenet_config_t%20config%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Prepare%20buffer%20configuration%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Eenet_buffer_config_t%20buffConfig%20%3D%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3EENET_RXBD_NUM%2C%3CBR%20%2F%3E%3CBR%20%2F%3EENET_TXBD_NUM%2C%3CBR%20%2F%3E%3CBR%20%2F%3EENET_RXBUFF_SIZE%2C%3CBR%20%2F%3E%3CBR%20%2F%3EENET_TXBUFF_SIZE%2C%20g_rxBuffDescrip%2C%20g_txBuffDescrip%2C%20%26amp%3Bg_rxDataBuff%5B0%5D%5B0%5D%2C%20%26amp%3Bg_txDataBuff%5B0%5D%5B0%5D%2C%3CBR%20%2F%3E%3CBR%20%2F%3Etrue%2C%3CBR%20%2F%3E%3CBR%20%2F%3Etrue%2C%3CBR%20%2F%3E%3CBR%20%2F%3ENULL%20%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Get%20default%20ENET%20configuration%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3EENET_GetDefaultConfig(%26amp%3Bconfig)%3B%3CBR%20%2F%3E%3CBR%20%2F%3Econfig.miiMode%20%3D%20kENET_RmiiMode%3B%3CBR%20%2F%3E%3CBR%20%2F%3Econfig.miiSpeed%20%3D%20kENET_MiiSpeed100M%3B%3CBR%20%2F%3E%3CBR%20%2F%3Econfig.miiDuplex%20%3D%20kENET_MiiFullDuplex%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Initialize%20ENET%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3EENET_Init(EXAMPLE_ENET%2C%20%26amp%3Bg_handle%2C%20%26amp%3Bconfig%2C%20%26amp%3BbuffConfig%2C%20g_macAddr%2C%20EXAMPLE_CLOCK_FREQ)%3B%3CBR%20%2F%3E%3CBR%20%2F%3EENET_ActiveRead(EXAMPLE_ENET)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Eint%20main(void)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3Euint8_t%20txFrame%5BENET_DATA_LENGTH%5D%3B%3CBR%20%2F%3E%3CBR%20%2F%3Euint8_t%20rxBuffer%5BENET_RXBUFF_SIZE%5D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Initialize%20hardware%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3EBOARD_InitHardware()%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Initialize%20Ethernet%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3EInitEthernet()%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Build%20test%20frame%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3EBuildTestFrame(txFrame)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Ewhile%20(1)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3Euint32_t%20frameLength%20%3D%200%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Check%20for%20received%20frames%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Eif%20(ENET_GetRxFrameSize(%26amp%3Bg_handle%2C%20%26amp%3BframeLength%2C%200)%20%3D%3D%20kStatus_Success)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3Eif%20(frameLength%20%26gt%3B%200)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Read%20the%20frame%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Eif%20(ENET_ReadFrame(EXAMPLE_ENET%2C%20%26amp%3Bg_handle%2C%20rxBuffer%2C%20frameLength%2C%200%2C%20NULL)%20%3D%3D%20kStatus_Success)%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Process%20received%20frame%20here%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Send%20test%20frame%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Estatus_t%20ENET_SendFrame(ENET_Type%20*base%2C%20enet_handle_t%20*handle%2C%20const%20uint8_t%20*data%2C%20uint32_t%20length%2C%20uint8_t%20ringId%2C%3CBR%20%2F%3E%3CBR%20%2F%3Ebool%20tsFlag%2C%20void%20*context)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EENET_SendFrame(EXAMPLE_ENET%2C%20%26amp%3Bg_handle%2C%20txFrame%2C%20ENET_DATA_LENGTH%2C%200%2C%20false%2C%20NULL)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Small%20delay%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3Efor%20(volatile%20int%20i%20%3D%200%3B%20i%20%26lt%3B%201000000%3B%20i%2B%2B)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Ein%20that%20i%20am%20getting%20also%20error%20undefined%20reference%20to%20%60PHY_LinkStatusChange'%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2088894%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Ethernet%20Communication%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2088894%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234971%22%20target%3D%22_blank%22%3E%40Govind89%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EThank%20you%20so%20much%20for%20your%20interest%20in%20our%20products%20and%20for%20using%20our%20community.%3C%2FP%3E%0A%3CP%3EI%20think%20the%20project%20you%20imported%20is%20already%20without%20FREERTOS%2C%20if%20you%20want%20more%26nbsp%3B%3CSPAN%3EEthernet%26nbsp%3Bdemo%2C%20you%20can%20check%20by%20import%26nbsp%3B%20SDK%20example.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mayliu1_0-1745898661549.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mayliu1_0-1745898661549.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F335405iEC4F586E1607CB8E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mayliu1_0-1745898661549.png%22%20alt%3D%22mayliu1_0-1745898661549.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20know%20more%20about%20the%20SDK%20API.%20you%20can%20refer%20to%20the%20document%20%22MCUXpresso%20SDK%20API%20Reference%20Manual%22%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmcuxpresso.nxp.com%2Fapi_doc%2Fdev%2F329%2Findex.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmcuxpresso.nxp.com%2Fapi_doc%2Fdev%2F329%2Findex.html%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EWish%20it%20helps%20you.%3CBR%20%2F%3EIf%20you%20still%20have%20question%20about%20it%2C%20please%20kindly%20let%20me%20know.%3C%2FP%3E%0A%3CP%3EWish%20you%20a%20nice%20day!%3C%2FP%3E%0A%3CP%3EBest%20Regards%3CBR%20%2F%3EMayLiu%3C%2FP%3E%3C%2FLINGO-BODY%3E