diff options
| -rw-r--r-- | embassy-stm32/src/usb/usb.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 24983cf3c..d5cfa1bb8 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs | |||
| @@ -7,6 +7,7 @@ use core::task::Poll; | |||
| 7 | 7 | ||
| 8 | use embassy_hal_internal::into_ref; | 8 | use embassy_hal_internal::into_ref; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | use embassy_time::Timer; | ||
| 10 | use embassy_usb_driver as driver; | 11 | use embassy_usb_driver as driver; |
| 11 | use embassy_usb_driver::{ | 12 | use embassy_usb_driver::{ |
| 12 | Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointInfo, EndpointType, Event, Unsupported, | 13 | Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointInfo, EndpointType, Event, Unsupported, |
| @@ -887,6 +888,16 @@ impl<'d, T: Instance> driver::EndpointOut for Endpoint<'d, T, Out> { | |||
| 887 | }) | 888 | }) |
| 888 | .await; | 889 | .await; |
| 889 | 890 | ||
| 891 | // Errata for STM32H5, 2.20.1: | ||
| 892 | // During OUT transfers, the correct transfer interrupt (CTR) is triggered a little before the last USB SRAM accesses | ||
| 893 | // have completed. If the software responds quickly to the interrupt, the full buffer contents may not be correct. | ||
| 894 | // | ||
| 895 | // Workaround: | ||
| 896 | // Software should ensure that a small delay is included before accessing the SRAM contents. This delay should be | ||
| 897 | // 800 ns in Full Speed mode and 6.4 μs in Low Speed mode. | ||
| 898 | #[cfg(stm32h5)] | ||
| 899 | Timer::after_nanos(800).await; | ||
| 900 | |||
| 890 | RX_COMPLETE[index].store(false, Ordering::Relaxed); | 901 | RX_COMPLETE[index].store(false, Ordering::Relaxed); |
| 891 | 902 | ||
| 892 | if stat == Stat::DISABLED { | 903 | if stat == Stat::DISABLED { |
