USB_host MSC with stm32f746
Hi, after of much struggle in the programming, seeing the tutorial of controllers_tech, can create files and directories in usb memory. I had problems with these case, when insert the usb memory the flow of program enter in Application_Start but never went to Application_Ready.
case HOST_USER_CONNECTION:
Appli_state = APPLICATION_START;
break;
case HOST_USER_CLASS_ACTIVE:
Appli_state = APPLICATION_READY;
Mount_USB();
...
break;
Then seeing some thereads about these problem, found that the file usbh_ctlreq.c have these lines:
if (USBH_MAX_EP_PACKET_SIZE < (uint16_t)USBH_MAX_DATA_BUFFER)
{
/* Make sure that maximum packet size (bits 0..10) does not exceed the max endpoint packet size */
ep_descriptor->wMaxPacketSize &= ~0x7FFU;
ep_descriptor->wMaxPacketSize |= MIN((uint16_t)(LE16(buf + 4) & 0x7FFU), (uint16_t)USBH_MAX_EP_PACKET_SIZE);
}
else
{
/* Make sure that maximum packet size (bits 0..10) does not exceed the total buffer length */
ep_descriptor->wMaxPacketSize &= ~0x7FFU;
ep_descriptor->wMaxPacketSize |= USBH_MAX_EP_PACKET_SIZE;
}
the flow of program always falls in condition else, then i increased the size of USBH_MAX_DATA_BUFFER, in .ioc file Usb_host middleware, of 512 a 2048 bytes, then the flow of program entered in the first condition.
and flow program can now enter a Application_Ready. Some users say what error bug in these lines, i want know if these is true and what meaning have these two constans
USBH_MAX_EP_PACKET_SIZE < (uint16_t)USBH_MAX_DATA_BUFFER
