-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unified STM32 Network Interface #804
base: main
Are you sure you want to change the base?
Conversation
@htibosch @AniruddhaKanhere Looks like this one NetworkInterface should work for all of Fxx & Hxx. The biggest difference between the HAL drivers are the usage of a few register macros that are named differently, but we can easily abstract that out. I've tested on a F767ZI and can test a H755ZI-Q, but don't have a way to test H5 at the moment. |
@holden-zenith wrote:
If I'm not mistaken, I have an H747, F407, and F746 for testing. So e.g. when testing F407, I use the latest HAL drivers for that part? |
@htibosch yes, last time I checked the latest F4 & F7 Eth drivers were 100% the same, so it should work the same. Before you test, I just noticed the call to HAL_ETH_ReleaseTxPacket needs to be moved to EMAC_IF_TX_EVENT because it calls the non interrupt safe version of vReleaseNetworkBufferAndDescriptor. I was using vNetworkBufferReleaseFromISR in the HAL_ETH_TxFreeCallback, but I guess it needs to be handled in the task to be compatible with both buffer allocation methods. |
As you may have read, I also prefer to handle network buffers from a normal task, rather than from an interrupt. I just came across this test:
which could be used to choose the correct network buffer function.
Doesn't F7 have multiple TX buffers each with their own hardware priority? I never used that feature, but I did have to disable it explicitly. Would you mind to send me an email so I can ask you little things now and then? hein [at] htibosch [dot] net Thanks, |
|
||
void HAL_ETH_RxAllocateCallback( uint8_t **buff ) | ||
{ | ||
NetworkBufferDescriptor_t * pxBufferDescriptor = pxGetNetworkBufferWithDescriptor( ETH_RX_BUF_SIZE, pdMS_TO_TICKS( 0 ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that HAL_ETH_RxAllocateCallback()
will only be called from a task-context?
And also, do you always use BufferAllocation_2.c
? I think we'll have to use that to make sure that uncached memory will be used by DMA.
HI @holden-zenith thanks for creating the change. |
@shubnil Historically the STM32 HAL Eth drivers have been awful, which is part of the reason why edited HAL drivers were provided with the NetworkInterface.c. The newer HAL drivers are 'better' and all STM32's from F4, F7, H5, H7 essentially use the same driver now. So with this, edited HAL drivers are no longer necessary, it will be much easier to update to accommodate for future HAL updates, only one NetworkInterface is needed, and I am getting about 20mbps higher on iperf. I left the legacy drivers for now since anything prior to F4 won't be getting the HAL update, so technically I suppose only the Fxx driver would be necessary to leave. |
@holden-zenith , do you have a new version of NetworkInterface.c to test? |
@htibosch I'll probably push it in the next few days. I've been able to max out the bandwidth at 95mbps but it's not consistent and depends on compilation optimization. So I need to spend some time looking through the disassembly before I push it. |
@holden-zenith What's the status of this? I have a Nucleo-H563ZI board and would like to use FreeRTOS+TCP but the current port implementation does not support H5 series. |
@bjsowa Actually it would be great if you could test it. I have used it successfully on an F7 but there is potential concern with how it compares to the older driver in terms of performance, at least when tested with an F4. I do not have an H5 at the moment to try it. |
@holden-zenith I made the driver work for my nucleo board (at least DHCP and ping replies seem to work). I also ported it to work for version 4.0.0 of FreeRTOS-Plus-TCP (as I want IPv6 support) by mimicking the changes made in #602 for the current driver. |
On bjsowa#1 I integrated the new driver with the CMake build system. You can use this for reference. |
@bjsowa oh nice that's great. I am working on testing an H7 too so all of F4, F7, H5, & H7 will have been tested. Seems to be at least usable on all of them for the time being. In theory it should perform at least as well as the last driver but iperf apparently has had mixed results so far. |
The earlier drivers for STM32Fxx and STM32Hxx used a copy of ST's HAL driver. The driver was optimised for efficiency/speed, and support for zero-copy was added. @holden-zenith created a unified driver that is based on today's HAL drivers. The driver files must be obtained from ST. I tried the new driver on STM32F4 and STM32F7, and found that iperf3 shows lower speeds, both TX and RX. I wonder what the influence is of the extra mutex? I've got no testing equipment where I am now. In August I can do a real-time analyses of both drivers. |
@bjsowa Thanks for trying out the release candidate versions of 4.0.0. Did you face any difficulties or issues with IPv6? Also curious to know if you use the multiple endpoint feature? |
@htibosch Here are the ping results of the latest version. It seems to have much better latency, at least for me. |
@holden-zenith wrote:
That looks very promising. Dit you already commit and push the changes? |
"source/portable/NetworkInterface/STM32" folder is excluded from spelling and formatting check. |
Co-authored-by: Błażej Sowa <[email protected]>
@HTRamsey Could you look at HTRamsey#13 ? |
Increment MAC entry index
@ActoryOu Is there any plan to check this out? If not, it at least serves as a good example I guess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @HTRamsey,
Sorry for late response.
We had a internal discussion on this PR, then continue to review this.
Here are my comments. Please help take a look.
Thank you.
@HTRamsey What's the reasoning for removing HAL drivers? This makes the |
I guess that depends on if we can add the hal drivers to be ignored by formatting and spell checks |
@ActoryOu @tony-josi-aws What should I do from here? I'd like to get this PR closed if not accepted |
Hi @HTRamsey, Thank you. |
Hi @HTRamsey, Few observations that were found:
|
@ActoryOu @tony-josi-aws |
Got it. Then please re-add them and I'll approve this PR. Thank you! |
The performance of iperf depends heavily on the configuration of the PC and MCU. As mentioned above, I was able to achieve a speed of ~93.3 Mbps. |
I have tested the PR on STM32 F4, H5, H7, and the new network interface seems to be working fine. Here are few things that I noted:
|
@tony-josi-aws Oh yeah I see that. It's been a long while but there was a discussion about adding some kind of generic check 'eConsiderPacketForProcessing' (similar to the one for the ethernet frame) that all network interfaces can use. |
New Unified STM32 driver for F4, F7, H5, H7.
Description
Implementation of new STM32 drivers. Does not support f2.
Test Steps
Checklist:
Related Issue
#766
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.