2025-05-19 12:49 AM
Everything else is working fine.
Setup packet with SET_ADDRESS received and processed.
Next GET_DESCRIPTOR for DEVICE which is sent back ok
I've verified the data written to the Tx FIFO is correct.
Correct number of bytes it transmitted but the bytes are not correct.
I'm using a STM32H743-EVAL board, hardware is working fine
Any suggestions?
p.s. the Device Descriptor received displayed by USB View
2025-05-19 4:11 AM
Hi @lw23
Would you double-check the device descriptor data you are writing to the Tx FIFO. Ensure that all fields are correctly populated according to the USB specification. The bLength field should be 18 for a standard device descriptor.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-05-19 5:15 AM
Is data cache enabled? Disable it during the debugging stage. If that fixes it, you'll need to instrument your code with appropriate cache handling.
> I've verified the data written to the Tx FIFO is correct.
How, exactly?
2025-05-20 12:30 AM
I'm not using DMA, PIO only
void USB_WritePacket(USB_OTG_GlobalTypeDef *USBx,uint8_t *src,
uint8_t ch_ep_num,uint16_t len)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint8_t *psrc=src;
uint32_t count32b;
uint32_t i;
uint32_t data;
count32b = ((uint32_t)len + 3U) / 4U;
for (i = 0U; i < count32b; i++)
{
data = __UNALIGNED_UINT32_READ(pSrc);
printf("%08X\n",data);
USBx_DFIFO((uint32_t)ch_ep_num) = data;
pSrc++;
pSrc++;
pSrc++;
pSrc++;
}
return;
}
Produces this output
OTG_FS: DIEPTSIZ = 0x00080012
OTG_FS: DTXFSTS = 0x00000020
OTG_FS: 02000112
OTG_FS: 40000002
OTG_FS: 00190957
OTG_FS: 02010100
OTG_FS: 00000103
OTG_FS: DIEPTSIZ = 0x00080000
OTG_FS: DTXFSTS = 0x0000001B
XFRSIZ is correctly decremented to zero
FIFO space reduced by 5 words
Thanks for the speed replies, I really appreciate it