⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
Last post
techteh
Offline
Last seen:3 months 2 weeks ago
加入:2018-07-16 12:09
USB_CDC DMA

Hello,
我想要的to transmit a big amount of data to USB. I am using USB_CDC example project for this but with this example the throughput is about 700 KBps. Is there any way to speed up the USB CDC throughput? Does the DMA helpful? If yes, How to initialize and use DMA with USB_CDC?

Thank you in Advance.

Device:
MT_dialog
Offline
Last seen:3 months 5 days ago
工作人员
加入:2015-06-08 11:34
Hi techteh,

Hi techteh,

In order to achieve max possible performance for USB you should use the 1.0.14 SDK and do the following changes:

1) In the file hw_usb.c, in the function hw_usb_init() change as follows:

REG_SET_FIELD(USB, USB_MAMSK_REG, USB_M_NAK, reg, 1);

REG_SET_FIELD(USB, USB_MAMSK_REG, USB_M_FRAME, reg, 1);

To:

REG_CLR_FIELD(USB, USB_MAMSK_REG, USB_M_NAK, reg);

REG_CLR_FIELD(USB, USB_MAMSK_REG, USB_M_FRAME, reg);

2) Enable the DMA by setting in the custom_config_qspi.c the macro:

#define dg_configUSB_DMA_SUPPORT (1)

Thanks MT_dialog

techteh
Offline
Last seen:3 months 2 weeks ago
加入:2018-07-16 12:09
Hi,

Hi,
Thanks for your reply,
I did everything that you said, but nothing changed. The throughput is still about 700 KBps.
Is there anything wrong with my code (for transmit a large of data). Here it is:

USBD_CDC_Write(hInst, Transmit_Buffer, 2000, 0);

Thanks.

PM_Dialog
Offline
Last seen:2 days 3 hours ago
工作人员
加入:2018-02-08 11:03
Hi techteh,

Hi techteh,

Could you please clarify if you are using the default CDC or you did any modifications? If you are using the default CDC, this is only for loopback and not for performance because it is single task implemented and it uses only one task for both USB receive and USB transmit. If you want to increase the performance, it is highly recommended to use two different tasks for USB receive and USB transmit.

Thanks, PM_Dialog

techteh
Offline
Last seen:3 months 2 weeks ago
加入:2018-07-16 12:09
Hi,

Hi,
Thanks for your reply,
I was using the default CDC before your helps. Now I am using two task for this problem, one for RX and one for TX, but still nothing changed.
I have attached my modified USB_CDC.c file.

Thanks.

Attachment:
PM_Dialog
Offline
Last seen:2 days 3 hours ago
工作人员
加入:2018-02-08 11:03
Hi techteh,

minor-latin;mso-bidi-theme-font:minor-latin;background:white;mso-ansi-language:
EN-US">Hi
techteh,

minor-latin;mso-bidi-theme-font:minor-latin;background:white;mso-ansi-language:
EN-US">I am checking your code and I will let you know as soon as possible.

minor-latin;mso-bidi-theme-font:minor-latin;border:none windowtext 1.0pt;
mso-border-alt:none windowtext 0cm;padding:0cm;background:white;mso-ansi-language:
EN-US">Thanks, PM_Dialog
mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
minor-latin;background:white;mso-ansi-language:EN-US">

PM_Dialog
Offline
Last seen:2 days 3 hours ago
工作人员
加入:2018-02-08 11:03
Hi paramvir.in@gmail.com,

Hiparamvir.in@gmail.com,

The throughput will not be changed, since your physical mean of data transfer is the UART protocol. So, the maximum throughput you can achieve using the CDC class is 700Kbps. The double task implementation is the right way for achieving the maximum throughput.

Thanks, PM_Dialog