AnsweredAssumed Answered

USB transfer code in DMA Service Routine

Question asked by shrestha.durgesh on Dec 12, 2011
Latest reply on Dec 12, 2011 by baird.hal.001
I have an application where analog voltage is coverted by ADC and is saved in an array of size 128 byte. So the information to this array comes every few milliseconds (less than 1). Now i need to transfer the data to pc via usb.

So at the end of 'DMA complete ISR', how should i write the code or what are the lines to write?

I only know,

if (bDeviceState == (CONFIGURED))
            while ((_GetEPTxStatus(ENDP1))==EP_TX_VALID);
            USB_SIL_Write(EP1_IN, data1, count);
            while ((_GetEPTxStatus(ENDP1))==EP_TX_VALID);
            USB_SIL_Write(EP1_IN, data2, count);

where data1 is the first 64 byte and data2 is the second 64 byte so that the total data to be transmitted at once is 128 byte.
After each availability of the data through ADC and also after they are saved in variables (data1 and data2) i need them immediately to be transferred to PC before processing for other information.

The code that i implement is taking too longer time. So, it would be so nice if someone could suggest me to solve my problem.
Thanks in advance.