2018-08-22 01:47 AM
I am building a USB driver based on the USB CDC library code generated by CubeMX. The MCU is configured to support 64 byte USB messages through CubeMX
Sending messages from a host computer and parsing them on the MCU works fine when the USB payload is 8 chars (i.e. 8 bytes) or smaller. I can see in Wireshark that such messages are padded out to be 64 bytes on the wire.
When 9 chars are being sent the MCU stops execution (without going to the hardware fault handler) and without hitting a breakpoint I inserted at the start of the CDC_Receive_FS function.
I can see the USB message (padded out to 64 bytes, just like when having 8 chars as payload) going out from the PC using Wireshark and the hardware acknowledges the message, but the MCU halts without reaching any breakpoints.
My main questions:
My implementation of CDC_Receive_FS:
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
//My custom parser
USBDRIVER_receive(&(project.usbDriver), Buf, Len);
//CubeMX Generated functions
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
/* USER CODE END 6 */
}
Thanks in advance!
2018-09-12 02:23 AM
Bump! :)