Skip to content
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

Increase priority of network threads for STM32 targets #1965

Merged
merged 1 commit into from
Jun 29, 2021

Conversation

martin-kuhn
Copy link
Contributor

Description

  • The priority of the TCP/IP thread has been increased from osPriorityNormal to osPriorityHigh.
  • The priority of the LWIP thread has been increased from osPriorityNormal to osPriorityHigh.

Motivation and Context

The TCP/IP and the LWIP threads have the same priority as the CLR thread. If the CLR is busy, it's possible that the network communication is interrupted. This leads to a lot of tcp retransmissions and timeout problems.

How Has This Been Tested?

We have tested this on a custom STM32F427 based target with network capabilities, running an application with a modbus over TCP implementation. If the CLR is busy (e.g. during SD-card write or similar), we can see that the low_level_input function is no longer called regularly, which makes that the read function runs into a timeout.
LWIP_blocked
After increasing the priorities, this problem does no longer occur.
Scheduling_ok
We also verified with a stress test, that no problems occur if the data is not read out immediately and the receive buffer is going to be full. The window update mechanism works very well.

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (work on Unit Tests, has no impact on code or features)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@dnfadmin
Copy link

dnfadmin commented Jun 29, 2021

CLA assistant check
All CLA requirements met.

Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Thanks for the improvement. 👍🏻

@josesimoes josesimoes added the Platform: STM32 Everything related specifically with ChibiOS platform label Jun 29, 2021
@josesimoes josesimoes changed the title increase priority of network threads to osPriorityHigh Increase priority of network threads for STM32 targets Jun 29, 2021
@josesimoes josesimoes merged commit 999c580 into nanoframework:develop Jun 29, 2021
@martin-kuhn martin-kuhn deleted the network_prio branch June 29, 2021 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: STM32 Everything related specifically with ChibiOS platform Type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants