summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2024-03-25 18:44:51 +0700
committerGitHub <[email protected]>2024-03-25 18:44:51 +0700
commit0610070d07babf3623016603325afa938d4fc9f7 (patch)
tree6da0dcc306aee5586b2863a3eabc2ffadbc9c534 /src
parentf9c85ae47b0aacd6716b671a5b6ea289b43275c0 (diff)
Update dcd_stm32_fsdev_pvt_st.h
Diffstat (limited to 'src')
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h
index e0df21860..5a129ecf8 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h
@@ -296,17 +296,14 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t pcd_get_ep_rx_cnt(USB_TypeDef * USB
{
#ifdef FSDEV_BUS_32BIT
(void) USBx;
- volatile uint32_t count = 10;
- /*
- WA: few cycles for RX PMA descriptor to update
- This workaround is ported from stm32h5xx_hal_pcd.h : PCD_GET_EP_RX_CNT H5
- This code fixes an issue when the code is compiled in GCC with a fast optimization(O2/O3) and device with an high frequency.
- The function doesn't return the correct value.
- Issue observed on Windows 10 and stm32h573i_dk and tud_task() scheduled by IT, the device is not migrated the USB device is not visible .
+ /* WA: few cycles for RX PMA descriptor to update, otherwise doesn't return the correct value.
+ Note: required for G0, U5, H5 etc.
+ This workaround is ported from stm32h5xx_hal_pcd.h and fixes the issue when calling this function fast enough.
+ Reproduced with GCC ast optimization(O2/O3) and stm32h573i_dk with an high frequency.
+ Observed on Windows 10 where tud_task() is scheduled by interrupt handler.
*/
- while (count > 0U)
- {
- asm("NOP");
+ volatile uint32_t count = 10; // defined as PCD_RX_PMA_CNT in stm32 hal_driver
+ while (count > 0U) {
count--;
}
return (pma32[2*bEpIdx + 1] & 0x03FF0000) >> 16;