Hi all,
I am working on a USB CDC Virtual COM implementation on my NXP LPC Custom board on the basis of USBD ROM API . I have got all the basic things working and my implementation is to support the USB over ASCII mode as well as serve as a pyhsical layer for a popular Industrial Communication protocol.
The ASCII part that is when there is byte by byte transfers, things are fine with Tx/Rx on the USB Virtual Com port.
1.But when it comes to the providing physical layer support for the Industrial Communication protocol by USB VCOM , I am facing some problems and require some suggestions.
I need to transmit a block of data over USB CDC and in my code, a Tx completed callback notifies the higher layers of the Industrial Communication protocol that Tx got completed
when I test this by executing some Requests using a test tool, the responses for shorter commands are Ok . For a larger data it works but there are delays for example, if 177 event records need to be transmitted at once, it dones not happen quickly, it transmits 27 event records , then there are some delays/pauses/retries after some time another 30 records are transmitted and so on ..
Like this the Tx works and eventually all the records gets tranmitted without any loss of data. But the issue is why is it pausing for a while after transmitting about 30 records everytime before to transmit another 30 records and this cycle continues ( WBVAL () wMaxPacketSize in my descriptors is 64 in this case )
I tried to change the WBVAL () wMaxPacketSize field in the descriptor array from 64 to 8 and things start working !!!. all the Tx occurs at one instance itself and this is what I was expecting.But Is this correct way to avoid the delay problem or I am doing some thing wrong ? can the packet size be 8 instead of 64 and there is no problem?
2. I have another problem, I have provided Bulk IN /OUT Handlers where in I am also handling EVT_IN,EVT_OUT and EVT_NAK cases.
I have seen that always the breakpoints is hit in the EVT_NAK case first and then in the EVT_OUT . this is problematic in my case because it causes a delay in response to any commands that a test tool sends to my USB device. Because it always goes back and forth between the NAK and OUT cases in my code and then eventually outputs the response correctly.
this is causing some initial delays before to receive any data through the EVT_OUT handler.
in the NAK case of my handler , I am doing what is being followed in other examples of USB VCOM that is queuing up the read requests according to the ROM API of NXP LPC.
Can anyone suggest me on this,
Thanks in advance,
pra