diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-22 21:10:58 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-06-22 21:12:10 +0200 |
| commit | 6e65282f185d94a8c449374e6d4ed4eefa5793a4 (patch) | |
| tree | 4d3e5289ab0bedfb4a7816e1f2d5cc648154f893 | |
| parent | 0d02298ea628b9d2154fd05db7975f62b8d12edb (diff) | |
esp-hosted: smaller delay after transfer, makes slightly better perf.
| -rw-r--r-- | embassy-net-esp-hosted/src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index 2a4601ce4..44dfbe89c 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs | |||
| @@ -227,7 +227,12 @@ where | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | self.spi.transfer(&mut rx_buf, &tx_buf).await.unwrap(); | 229 | self.spi.transfer(&mut rx_buf, &tx_buf).await.unwrap(); |
| 230 | let delay_until = Instant::now() + Duration::from_millis(1); | 230 | |
| 231 | // The esp-hosted firmware deasserts the HANSHAKE pin a few us AFTER ending the SPI transfer | ||
| 232 | // If we check it again too fast, we'll see it's high from the previous transfer, and if we send it | ||
| 233 | // data it will get lost. | ||
| 234 | // Make sure we check it after 100us at minimum. | ||
| 235 | let delay_until = Instant::now() + Duration::from_micros(100); | ||
| 231 | self.handle_rx(&mut rx_buf); | 236 | self.handle_rx(&mut rx_buf); |
| 232 | Timer::at(delay_until).await; | 237 | Timer::at(delay_until).await; |
| 233 | } | 238 | } |
