Hi,
Is it safe to call "USBD_HW_API::ReadReqEP" , that is function in LPC4357 USB API, at a different timing than sample code?
For example, we want to use this function in the below sequence.
(1)call "USBD_HW_API::ReqdReqEP" when recieved "NOTIFY_TRANSFER_DATA_SIZE" the vendor request
(2)start to transfer bulk out
The reference materials are as follows.
sample1:TN00041\usbdlib_for_LPC43xx.Release\usbdlib_for_LPC43xx.Release\usbd_lib_lpc43xx\examples_43xx_18xx\usbd_lib_cdc_uart\src\cdc_uart.c
sample2:TN00041\usbdlib_for_LPC43xx.Release\usbdlib_for_LPC43xx.Release\usbd_lib_lpc43xx\examples_43xx_18xx\usbd_lib_libusb\src
In the sample code, call "USBD_HW_API::ReqdReqEP" timing is
sample1:USB_EVT_OUT_NAK (Bulk Out NAK Interrupt)
sample2:USB_EVT_OUT (Bulk Out RecieveEnd Interrupt)
We checked the specification documents, but the information of call function timing is nothing.
・UM10503.pdf/27.5.34 USBD_HW_API/Table 595. USBD_HW_API class structure(P813)
・TN00041/usbdlib_for_LPC43xx.Release/usbdlib_for_LPC43xx.Release/usbd_lib_lpc43xx/LPC_USBD_Lib/docs/html/struct_u_s_b_d___h_w___a_p_i___t.html
Solved! Go to Solution.
Hi
ReadReqEP() sets up the DMA descriptors in preparation for transferring data from memory to the USB controller. Then it primes the endpoint.
ReadEP() only returns the total bytes transferred once the DMA operation is complete. It does nothing with the data buffer pointer passed in.
NAKs are the throttling mechanism on a USB bus. If the CPU is slower at generating data that the USB is at shipping it out then NAKs provide a convenient and legal way to tell the host to wait for more data to arrive.
The best way to call these functions is:
Call ReadReqEP() once to get the stream started
Call ReadEP() following the receipt of an IN completion, then call ReadReqEP() to get the next transfer started.
Call ReadReqEP() any time a NAK is received.
Thanks,
Jun Zhang
Thanks for the support. I understand it.
Hi
ReadReqEP() sets up the DMA descriptors in preparation for transferring data from memory to the USB controller. Then it primes the endpoint.
ReadEP() only returns the total bytes transferred once the DMA operation is complete. It does nothing with the data buffer pointer passed in.
NAKs are the throttling mechanism on a USB bus. If the CPU is slower at generating data that the USB is at shipping it out then NAKs provide a convenient and legal way to tell the host to wait for more data to arrive.
The best way to call these functions is:
Call ReadReqEP() once to get the stream started
Call ReadEP() following the receipt of an IN completion, then call ReadReqEP() to get the next transfer started.
Call ReadReqEP() any time a NAK is received.
Thanks,
Jun Zhang