2025-07-20 8:47 AM
hello.
I am using STM32F407VGT6 chip and trying to send data to PC with USB CDC function.
But in the below function, the TrySendUsbPacket() function is not executing due to queue full phenomenon.
void EnqueueUsbPacket(const uint8_t* data)
{
uint16_t next_tail = (usb_queue_tail + 1) % USB_QUEUE_SIZE;
if (next_tail == usb_queue_head) {
// Queue full: handle accordingly (error, framedrop, etc.)
return;
}
memcpy((void*)usb_queue[usb_queue_tail].data, data, USB_FRAME_SIZE);
usb_queue_tail = next_tail;
TrySendUsbPacket(); // Add to queue and try to send immediately
}
I've put my full function as an attachment, can anyone tell me why the USB transfer doesn't happen until the queue is full?
2025-07-20 10:06 AM
USB transfer cannot happen before the host sends IN requests (and enumerates the device successfully).