DMA destination address for USB VCOM, xmc4500 with Dave 4.4.2

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User17085
Level 1
Level 1
Good Day!

Dave 4.4.2 & XMC4500 relax lite

I have an app where I continiously sample 6 inputs on the ADC and transfer their values to memory via DMA, which is all set up nicely and working like a charm, all using DAVE APPS.

With the ADC values I then do a whole bunch of calculations and then use USBD_VCOM_Sendstring() to write the result values to a virtual serial port on the PC.

The above all works fine, I just don't need and want to go through the whole slow process of formatting the resulting integer data into a string with snprintf.

Thus my question:

What is the correct hardware destination address for the USB VCOM that I have to use in setting up the DMA APP? so I can transfer calculated integer values from RAM to the virtual USB serial port

Kind regards

Gert

4134.attach
0 Likes
2 Replies
User18552
Level 1
Level 1
Gert,

I understand your question but using DMA to write to the USB endpoint buffer is not going to output data over the USB serial port.
A USB transfer requires a series of writes to a number of USB control registers and memory locations. The proper way to do what you want
to do is to use USBD_VCOM_SendBytes(). See function below:

USBD_VCOM_STATUS_t USBD_VCOM_SendBytes(uint8_t *bArray, int bCount)
{
int i = 0;
USBD_VCOM_STATUS_t status = USBD_VCOM_STATUS_SUCCESS;

while ((bCount--) && (status == USBD_VCOM_STATUS_SUCCESS))
{
status = USBD_VCOM_SendByte(bArray[i++]);
}

return status;
}


Just for reference, the memory location used to output data from the device to the host PC is defined by the variable "XMC_USBD_EP_IN_BUFFER[]". This array must be located in SDRAM.
This array defines the memory buffers for all the USB endpoints that write in the IN direction (to the PC). But again, putting that address in the DMA address location called "Destination" that you
have the red box over is NOT going to write characters out to the serial port.

Rgds,

Gary
0 Likes
User17085
Level 1
Level 1
Thanks Gary!

Thats more or less the conclusion I also arrived at, was just hoping that I could offload the stuff dealing with the USB to the DMA so I could have more cycles available for the processor.

Will propably just change my hardware design to include something like an FTDI232 chip connected to a UART port on the XMC4500 and just dump the data via DMA to the UART register
and have the FTDI worry about the complexities of speaking USB

Kind regards

Gert
0 Likes