cancel
Showing results for 
Search instead for 
Did you mean: 

example using HAL ETH without LWiP for raw ethernet frames?

Elwood Downey
Associate III
Posted on June 09, 2017 at 20:41

[reposting after 30 days of no responses]

Hello all,

I have been making great progress using CubeMX and HAL for lots of things, now I want to try ethernet. My application is very simple, I only want to send and receive raw ethernet frames -- no UDP or TCP at all. I also prefer not to use LWiP for something so basic. Can anyone point me to an example of raw ethernet frame IO using just HAL? I will be using Nucleo F429ZI.

My requirements:

[ ] send a raw frame (source and destination MAC address, type IP and payload, total less than 1500 bytes)

[ ] receive interrupt upon receipt of a raw ethernet frame

My transactions are slow and simple, I do not even need any buffer queuing.

Thanks for any tips.

#raw-ethernet-frame
29 REPLIES 29
Posted on May 18, 2018 at 08:45

Hi,

     Please help me !!!  I am new to Ethernet.

I have a costume board with STM32F765 controller and the PHY is KSZ8041TL(Microchip) with RMII mode. 

Am generating the low level init code with the help of Cubemx. So for testing the hardware and for making the basic Ethernet communication working - I have two boards with me and i am writing raw data (with out using LwIP) from one board and receiving it other board - that's my plan. 

In the cubemx Ethernet configuration i have selected 'user PHY' and by hardware we made the PHY address as 1. We use 50Mhz external clock as well for RMII mode. RX mode is 'Polling mode'. 

My code stuck in ' MX_ETH_Init () - > HAL_ETH_Init () 'function. 

code section below for your reference. 

/* Wait until the auto-negotiation will be completed */

do

{

HAL_ETH_ReadPHYRegister(heth, PHY_BSR, &phyreg);

/* Check for the Timeout */

if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_AUTONEGO_COMPLETED)

{

/* In case of write timeout */

err = ETH_ERROR;

/* Config MAC and DMA */

ETH_MACDMAConfig(heth, err);

heth->State= HAL_ETH_STATE_READY;

/* Process Unlocked */

__HAL_UNLOCK(heth);

return HAL_TIMEOUT;

}

} while (((phyreg & PHY_AUTONEGO_COMPLETE) != PHY_AUTONEGO_COMPLETE));

If am dong something wrong or i am missing to set something? Please help me .

Thanks and Best Regards,

Vineeth      

Can you give me project just send and receive data withow lwip? thanks

Can you give me project just send and receive data withow lwip? thanks

If you paid me enough I would make one.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

If you got any solution please send it ashwin.raj@manipalgroup.info

Regards

Ashwinraj

khaaal
Associate II

Is there an example of sending raw ethernet frames without lwip ?

khaaal
Associate II

Is there an example of sending raw ethernet frames without Lwip ?

Piranha
Chief II

The solution is in a first answer: "Tear what you need out of ethernetif.c"

> Never could get HAL_ETH_TxCpltCallback to fire.

https://community.st.com/s/question/0D50X0000B2AG7FSQW/ethernet-send-complete-interrupt-not-triggered-in-stm32f7

ranran
Senior II

Hi,

Can someone share the loopback example using HAL APIs (without LWIP) ?

Thank you