cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC enable dma, the enumeration will fail

sniu
Associate

I'm using STM32Cube_FW_H7_V1.3.0 library and using the STM32Cube_FW_H7_V1.3.0\Projects\STM32H743I_EVAL\Applications\USB_Device\CDC_Standalone example. I select the STM32H743I-EVAL_USBD-HS target. If I set the dma_enable to 0, everything will be ok. But if I set dma_enable to 1, the enumeration will fail. Do you have any idea?

5 REPLIES 5
Arnon
Associate III

Hi

Same issue here.

Were you able to overcome this?

using STM32F723-DISCO. No DMA- the USB HS CDC virtual com works great. When enabling DMA - the device descriptor request failed.

I am using STM32CubeMX Version: 5.4.0, Build: 20191009-1541

sniu
Associate

Hi Arnon,

Absolutly not. I used STM32Cube_FW_H7_V1.3.0 library. At that time, no DMA works well, and enable DMA is not work, I'm try to contract with ST support, but don't overcome this issue.

Arnon
Associate III

Thanks

BTW, Using the timer, I have measured the time it takes to send 2048Bytes to a PC.

It is around 100uSec. I wish the CPU could do other things during this time…

Frome here:

"CDC known limitations

When using this driver with the OTG HS core, enabling DMA mode (define USB_OTG_HS_INTERNAL_DMA_ENABLED in usb_conf.h file) results in data being sent only by multiple of 4 bytes. This is due to the fact that USB DMA does not allow sending data from non word-aligned addresses. For this specific application, it is advised not to enable this option unless required."

Arnon
Associate III

Thanks oleksandr.karbivsky , for pointing this out.

You are totally right but to my understanding, this only means that the amount of bytes to be transmitted should be multiple of 4. Currently I am sending 2048 Bytes so it should be fine.

My goal is to implement the USB CDC interface in the most efficient way. I would expect to have a function that starts the transfer and a call back function once the transfer is done.

So the process should look like:

1.      Send data over USB

2.      Do other stuff while waiting for the data to be sent

3.      Interrupt when all data has been sent.

The user manual instructs to use “USBD_CDC_SetTxBuffer�? for sending data but it is not clear how to use it. Instead, I am using the “CDC_Transmit_HS�? (that calls for this function). This is working fine but forces me to wait for all the data to be sent.

If you have a better way to send data using virtual com port, I would really like to know :smiling_face_with_smiling_eyes:

TIA,

Arnon