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?

 

 

 

2 REPLIES 2
Lina_DABASINSKAITE
Community manager
Community manager

Hello @Brett21 

This post has been escalated to the ST Online Support Team for one-to-one assistance.  We'll contact you directly.

Best regards,

Lina


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
FBL
ST Employee

Hi @Brett21 

Did you refer to this example?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.