Skip to content

drivers/esp-hosted: Bug fixes and minor performance tuning. #12490

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

Merged
merged 5 commits into from
Oct 3, 2023

Conversation

iabdalkader
Copy link
Contributor

@iabdalkader iabdalkader commented Sep 20, 2023

iperf test before (UDP mode didn't work for some reason)

CLIENT MODE: TCP sending
Connecting to ('192.168.50.219', 5201)
Interval           Transfer     Bitrate
  0.00-1.00   sec  16.4 KBytes   134 Kbits/sec
  1.00-2.00   sec  18.0 KBytes   147 Kbits/sec
  2.00-3.00   sec  17.2 KBytes   141 Kbits/sec
  3.00-4.00   sec  16.4 KBytes   134 Kbits/sec
  4.00-5.00   sec  14.1 KBytes   115 Kbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  0.00-10.11  sec   168 KBytes   136 Kbits/sec  sender
  0.00-6.15   sec   168 KBytes   224 Kbits/sec  receiver

iperf test after:

CLIENT MODE: TCP sending
Connecting to ('192.168.50.219', 5201)
Interval           Transfer     Bitrate
  0.00-1.01   sec   187 KBytes  1.52 Mbits/sec
  1.01-2.01   sec   217 KBytes  1.77 Mbits/sec
  2.01-3.01   sec   216 KBytes  1.77 Mbits/sec
  3.01-4.01   sec   208 KBytes  1.70 Mbits/sec
  4.01-5.01   sec   238 KBytes  1.95 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  0.00-10.00  sec  2.10 MBytes  1.76 Mbits/sec  sender
  0.00-5.08   sec  2.10 MBytes  3.47 Mbits/sec  receiver
CLIENT MODE: UDP sending
Connecting to ('192.168.50.219', 5201)
Interval           Transfer     Bitrate         Total Datagrams
  0.00-1.00   sec   541 KBytes  4.43 Mbits/sec  380
  1.00-2.00   sec   548 KBytes  4.48 Mbits/sec  385
  2.00-3.00   sec   548 KBytes  4.48 Mbits/sec  385
  3.00-4.01   sec   547 KBytes  4.47 Mbits/sec  384
  4.01-5.01   sec   548 KBytes  4.48 Mbits/sec  385
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  0.00-10.00  sec  5.33 MBytes  4.47 Mbits/sec  3833  sender
  0.00-5.31   sec  5.32 MBytes  8.41 Mbits/sec  3829  receiver

soft_timer_static_init(&network_timer, SOFT_TIMER_MODE_PERIODIC, 128, network_timer_callback);
soft_timer_reinsert(&network_timer, 128);
soft_timer_static_init(&network_timer, SOFT_TIMER_MODE_PERIODIC, 50, network_timer_callback);
soft_timer_reinsert(&network_timer, 50);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think dropping this poll interval to 50ms will improve TCP/UDP throughput, this polling is used for things like DHCP timeout.

Can you try iperf3 with the existing value of 128 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also polls the WiFi driver (like cyw43_poll), I did notice a significant increase when lower it, but not much below 50ms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is much more important than LWIP config, when reverting back to 128ms I lose 40% of the TCP throughput.

Copy link
Member

Choose a reason for hiding this comment

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

OK. I guess the esp-hosted driver needs more frequent polling (ideally it would interrupt the main processor when it needed polling).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ideally it would interrupt the main processor when it needed polling

It does, but it still needs to poll at that rate, I'm also looking at the firmware to see if there's room for improvements there.

This patch reinstalls the pin IRQ handler on WiFi init, as some
ports disable/remove pin IRQs on soft-reboot, or deinit the pins.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
The maximum SPI frame payload is 1600 - header_size.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Changes are:
- Enable IRQ on WiFi data ready pin.
- Fix WiFi SPI clock (an exact 30MHz is not possible).
- Update WiFi pins.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
@dpgeorge dpgeorge merged commit 9d5d2e8 into micropython:master Oct 3, 2023
@iabdalkader iabdalkader deleted the esp_hosted_fixes branch November 2, 2023 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants