cancel
Showing results for 
Search instead for 
Did you mean: 

Putting two 32-bit words in TxFIFO. How to guarantee USB controller doesn't send only half my data?

Parawizard
Visitor

If my data is more than one 32-bit word and I have to write it one 32-bit word at a time to the FIFO, is it possible that the USB controller could send just the first 32-bit word? Is there a way to stop that from happening?

Thanks

```
USBx_DFIFO(1) = send.u32[0];
// Is it possible for the USB controller to send just the first 32bit word if timing is right?
USBx_DFIFO(1) = send.u32[1];

```

2 REPLIES 2
Parawizard
Visitor

Context:

HID device
Interrupt Transfer
6 byte report

gbm
Lead III

The USB device controller will always send the programmed number of bytes. There are two very different kinds of USB periperal in various STM32. With the simpler one, you prepare data first, then trigger the transmission. With OTG, you first setup the transfer then load data to FIFO, but the transfer doesn't start until the full packet data is loaded. So no, USB device will not start sending anything until you write the declared amount of data.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice