cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USBX Loopback Issue (Number of bytes dependent)

Brett21
Associate

To test a USB implementation, I have implemented a USB loopback on a Nucleo-144 Development Board (MB1404C).  Testing is showing a strange result that I have been unable to isolate:

The code is very basic:  it creates a thread for USB data handling.  In that thread, ux_device_class_cdc_acm_read is used to block until data is received from USB.   When it is received, it is send back out USB using ux_device_class_cdc_acm_write.

 

This works great if I send up to 6 bytes of data.   As soon as I send 7 or more bytes, the transmitted data is junk (though it is repeatable). 

Things I have tried and seemingly ruled out:

  1. If I don't try to loop the received data out and instead just send data out, I can send 7+ bytes so it doesn't seem to be on the PC side of send/receive data or directly in the transmit code.
  2. I have stepped all the way through the receive and transmit code (down through the USB drivers) and the data is received correctly (even 7+ bytes) and it looks good the entire time on the transmit side.
  3. I doubled the size of all stacks in case it was some type of stack overflow.
  4. I also inserted unused variables/ rearranged the order of variable declarations to try to rule out some type of overflow issue.

 

Any ideas?

 

 

 

0 REPLIES 0