Closed bvernoux closed 1 year ago
https://github.com/hydrausb3/wch-ch56x-bsp/blob/974e5482a76304cae5ebcadbbfd2d1a4eb5ccc56/usb/usb_devbulk/CH56x_usb30_devbulk.c#L1003 more details https://discord.com/channels/983699153806848050/1004054542700269568
Extract of code
uint32_t uep0_dma = USBSS->UEP0_DMA; uint8_t data_req = endp0RTbuff[uep0_dma]; if ((endp0RTbuff[uep0_dma] & 0x60) == 0) { req_len = USB30_StandardReq(); } else { req_len = USB30_NonStandardReq(); }
It shall be replaced by
uint8_t data_req = *((uint8_t*)endp0RTbuff); if ((data_req & 0x60) == 0) { req_len = USB30_StandardReq(); } else { req_len = USB30_NonStandardReq(); }
For information we have no choice and we shall use endp0RTbuff instead of USBSS->UEP0_DMA to retrieve the ep0 buffer addr as USBSS->UEP0_DMA can be written but when read it returns 0
Fixed in commit https://github.com/hydrausb3/wch-ch56x-bsp/commit/732309a84a4f119952a18d17a2d83ae4d98aacc0
https://github.com/hydrausb3/wch-ch56x-bsp/blob/974e5482a76304cae5ebcadbbfd2d1a4eb5ccc56/usb/usb_devbulk/CH56x_usb30_devbulk.c#L1003 more details https://discord.com/channels/983699153806848050/1004054542700269568
Extract of code
It shall be replaced by
For information we have no choice and we shall use endp0RTbuff instead of USBSS->UEP0_DMA to retrieve the ep0 buffer addr as USBSS->UEP0_DMA can be written but when read it returns 0