cancel
Showing results for 
Search instead for 
Did you mean: 

USB DMA mode on STMU5xx stops transmitting before completion

Erik16
Associate

Hello,

I am trying to enable the USB IP DMA mode on an STM32U5A5. Without DMA, I have it working as a USB device and it transmits and receives data without apparent issues. To start using DMA, my understanding is that all I need to do, in CubeMX, is change the "Enable IP DMA" setting for the USB OTG HS peripheral to ENABLED. From there I expect the USB peripheral to take care of itself.

Unfortunately, in DMA mode, the device transmits exactly three 512-byte packets and then hangs.In my short test, I request four packets. The fourth one never moves. The PC host receiver never gets the fourth packet. The first three arrive intact. I tried tests where the buffer containing the transmit data is set to  either 512 bytes long, 1024 bytes long or 2048 bytes long. Each test moves 3*512 bytes and stops.

[After posting the above, I did some additional tests by breaking the data into small chunks, as small as 4 bytes at time. The magic limit of the number of bytes is about 1700. Every permutation stopped somewhere near 1700 bytes sent. Data always arrives at the receiver in perfect condition. (The last test made 425 sends at 4 bytes at a time.) What is special about that number?]

What am I missing in my configuration?

Thanks, Erik

1 REPLY 1
FBL
ST Employee

Hi @Erik16 

Would you attach test case to reproduce on my end your configuration. Are you using nucleo U5A5

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.