example using HAL ETH without LWiP for raw ethernet frames?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-09 11:41 AM
[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- Labels:
-
Ethernet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-05-05 1:14 PM
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 #stm32f429 #hal- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-10 6:56 AM
You'll likely need to separate the frame and initialization code from the layer above you don't want
(##) HAL_ETH_TransmitFrame();
(##) HAL_ETH_GetReceivedFrame(); (should be called into an infinite loop)
(##) HAL_ETH_GetReceivedFrame_IT(); (called in IT mode only)
Tear what you need out of ethernetif.c
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-22 2:55 PM
Thanks Clive. Making a temporary lwip project thengutting ethernetif.c was extremely helpful. I have it all working now, getting close to wire speeds both ways.
In case others see this thread in the future, here are a few observations:
* Phy address must be 0 for the
Nucleo F429ZI.
CubeMX 4.0 still sets it to 1 by default even though this was reported over a year ago in thttps://community.st.com/0D50X00009XkgfISAR
.* Never could get HAL_ETH_TxCpltCallback to fire. Fortunately the tx descriptor states allow
reliable in-line retries.
*
The default MAC filters are such that
RxCplt will only fire on receipt of broadcast MAC FF:FF:FF:FF:FF:FF or the one passed toHAL_ETH_Init().
* Speaking of MAC, the array to which
heth.Init.MACAddr is set in
MX_ETH_Init() really should be static so it can be used later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-09 7:50 AM
Hey,
I want to apply Ethernet on my stm32f779I-EVAL board, but i am very new to Ethernet.
I also don't want to use the lwIP driver, because i only want to send some json strings.
Do you have by any change an example program ready?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-09 1:07 PM
Are you really really sure you want to use raw frames? Sending variable length strings sounds more like a TCP stream would be more appropriate. Even UDP would require you to reinvent fragmentation, assembly, acknowledgement and and retransmission. Raw frames are even more basic than UDP because they can not be routed, they are strictly NIC-to-NIC. lwIP works very well and it has a socket-like layer that is pretty easy to use. But anyway, if you really want to see my raw frame code, contact me off-line.
Elwood
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-10 3:28 AM
Hey,
I think i will take a second look at the lwIP libraries.
TCP might, indeed, be a better option for this instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-13 6:46 AM
Hey,
By any change, do you have experience with REST API's with the lwIP library?The data i want to send are small json strings.
The json strings that i want to send back are kinda static, because the requested data per request is known.
I want to be able to process the types url and give the acording responds.
The repsonds is just a json sting with status data.If i can read the url, i can split it up and process the requested data, for example set a bit. (192.168.0.10/bit/1)
its for remote IO and not for running a complete web server.
The json strings that i want to send back are kinda static, because the requested data per request is known.
I looked at the STMCube application examples and they work with .html.
But i dont want the user to type .html at the end of the server nor weird url that is send with CGI (?id=171504&draftID=30078).It seems like i am the only one on the internet that is working on a rest api for the stm32, couldn't fins anything.
What would you recommend?
Maybe the raw data frames would be better, because i only need to send/receive simple stuff.Greetings,
Angus- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-20 6:01 AM
Hi,
in case that someone needs it:
I got HAL_ETH_TxCpltCallback() to fire by adding the following two lines:
__HAL_ETH_DMA_ENABLE_IT((heth), ETH_DMA_IT_NIS | ETH_DMA_IT_R|ETH_DMA_IT_T);
__HAL_ETH_DMATXDESC_ENABLE_IT(heth);
Regards,
Aleksandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-12-06 2:40 AM
Hi,
Downey.Elwood
eludar
‌any chance that one of you upload a minimal working example?
Best wishes, David
