2020-03-12 12:22 AM
Hello
sorry for my English, im using google translate.
I use a debug board STM32H750B-DK.
The project generated by the STMCube (v5.5.0) for using the CDC USB device works fine. Data is transferred from PC to device and from device to PC.
That is adress of EP:
#define CDC_IN_EP 0x81U /* EP1 for data IN */
#define CDC_OUT_EP 0x01U /* EP1 for data OUT */
#define CDC_CMD_EP 0x82U /* EP2 for CDC commands */
When I change addresses to
#define CDC_IN_EP 0x82U /* EP1 for data IN */
#define CDC_OUT_EP 0x02U /* EP1 for data OUT */
#define CDC_CMD_EP 0x81U /* EP2 for CDC commands */
Information transfer from the device to the PC stops
Together with the debugger, I found a problem. When initializing the endpoint with the address 0х82, the DTXFSTS register becomes 0 and does not change.
When sending data (1024 byte), an interrupt arrives and the PCD_WriteEmptyTxFifo function is called. Outside there is a check:
while (((USBx_INEP(epnum)->DTXFSTS & USB_OTG_DTXFSTS_INEPTFSAV) >= len32b) &&
(ep->xfer_count < ep->xfer_len) && (ep->xfer_len != 0U))
{
/* Write the FIFO */
len = ep->xfer_len - ep->xfer_count;
if (len > ep->maxpacket)
{
len = ep->maxpacket;
}
len32b = (len + 3U) / 4U;
(void)USB_WritePacket(USBx, ep->xfer_buff, (uint8_t)epnum, (uint16_t)len,
(uint8_t)hpcd->Init.dma_enable);
ep->xfer_buff += len;
ep->xfer_count += len;
}
The condition (USBx_INEP(epnum)->DTXFSTS & USB_OTG_DTXFSTS_INEPTFSAV) >= len32b) is not fulfilled and data is not transmitted.
The same project with same adress of EP for the board stm32f4-disco works. The register does not become equal to 0 during initialization.
I need this permutation of endpoints to port the this project (https://www.youtube.com/watch?v=hsqWIqY8b6A&feature=emb_logo)
to the MCU stm32h7. It uses the CDC USB device and the addresses of the endpoints:
#define RNDIS_NOTIFICATION_IN_EP 0x81
#define RNDIS_DATA_IN_EP 0x82
#define RNDIS_DATA_OUT_EP 0x03
If i changed this adress Windows driver for rndis device is not work.
Thanks.
Solved! Go to Solution.
2020-03-12 01:12 AM
2020-03-12 01:12 AM
How exactly are the FIFOs set in GRXFSIZ/DIEPTXF0/DIEPTXFx?
JW
2020-03-12 06:22 AM
How exactly are the FIFOs set in GRXFSIZ/DIEPTXF0/DIEPTXFx?
This is not question, this is answer.
I fogot add HAL_PCDEx_SetTxFiFo function for new endpoint.
For All:
If you need add new endpoint read this
sorry for my English, im using google translate.