diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-06-03 14:14:45 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-03 14:14:45 +0000 |
| commit | 141c170db426404444a454c063c2eec07c74a1c3 (patch) | |
| tree | f6cdcab6d3cdaa904dfb61ad72bed64d351f2217 /embassy-stm32 | |
| parent | 1cfe04712587048650c753cda25bce2d16831b11 (diff) | |
| parent | 9b3b6c54210afb1c99c1b57cce700eccc49896a4 (diff) | |
Merge pull request #4277 from diondokter/fix-usb-race
STM32 USB: Read data before register update
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/usb/usb.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 0b878915a..3e8e74a1f 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs | |||
| @@ -911,6 +911,8 @@ impl<'d, T: Instance> driver::EndpointOut for Endpoint<'d, T, Out> { | |||
| 911 | }; | 911 | }; |
| 912 | self.read_data_double_buffered(buf, packet_buffer)? | 912 | self.read_data_double_buffered(buf, packet_buffer)? |
| 913 | } else { | 913 | } else { |
| 914 | let len = self.read_data(buf)?; | ||
| 915 | |||
| 914 | regs.epr(index).write(|w| { | 916 | regs.epr(index).write(|w| { |
| 915 | w.set_ep_type(convert_type(self.info.ep_type)); | 917 | w.set_ep_type(convert_type(self.info.ep_type)); |
| 916 | w.set_ea(self.info.addr.index() as _); | 918 | w.set_ea(self.info.addr.index() as _); |
| @@ -920,7 +922,7 @@ impl<'d, T: Instance> driver::EndpointOut for Endpoint<'d, T, Out> { | |||
| 920 | w.set_ctr_tx(true); // don't clear | 922 | w.set_ctr_tx(true); // don't clear |
| 921 | }); | 923 | }); |
| 922 | 924 | ||
| 923 | self.read_data(buf)? | 925 | len |
| 924 | }; | 926 | }; |
| 925 | trace!("READ OK, rx_len = {}", rx_len); | 927 | trace!("READ OK, rx_len = {}", rx_len); |
| 926 | 928 | ||
