Minimum delay between consecutive transmit

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Minimum delay between consecutive transmit


    I have a dedicated task that processes a fifo which queues incoming USB requests.
    This task loops into that fifo and processes requests then builds the replies and transmit them by calling 'USB_WriteEPTimed' function passing the replies buffers.

    Everytime this dedicated task is waked up by a signal, it processes all the fifo before sleeping and waiting for next signal.

    The call to 'USB_WriteEPTimed' is very close one to the other, so what should be the delay between each call to that function ?

    Currently, no wait is used and some 256 bytes long payloads are not transmitted because '_WaitForEndOfTransfer', from 'USB_WriteEPTimed', exits with 'timeout' status.

    Thank you
  • Could you please post the exact line of code where you call USB_WriteEPTimed ?

    USB_WriteEPTimed is also not a public API as it is not documented. Do you have your own custom protocol or is there any other reason you are using it instead of a class API function?
  • Hello Yan,

    Thank you for the fast reply, below is the code block where this function is used:

    C Source Code

    1. // Process all rx buffers in fifo
    2. while( ucFifoProcessingIdx < APP_USB_FIFO_MAX_SIZE )
    3. {
    4. bool bRelease = FALSE;
    5. // Fifo slot is used
    6. if ( (ucBufferFifo[ucFifoProcessingIdx].ucState & FIFO_SLOT_USED) )
    7. {
    8. // Update fifo timeout counter
    9. ucBufferFifo[ucFifoProcessingIdx].ucTimeoutCounter++;
    10. // Fifo slot is complete and ready to be processed
    11. if ( (ucBufferFifo[ucFifoProcessingIdx].ucState & FIFO_SLOT_COMPLETE) )
    12. {
    13. unsigned short usDataLen = 0;
    14. AnalysisRequest( (shutrequest*)&ucBufferFifo[ucFifoProcessingIdx].tInBuffer,
    15. ( void * ) &ucBufferFifo[ucFifoProcessingIdx].pucOutBuffer, //&ucInBuffer,
    16. &usDataLen,
    17. AppUsbTask_vGetShutReport,
    18. AppUsbTask_vSetShutReport );
    19. // Send over USB with max transmit time of 1 ms,
    20. // otherwise the frame is lost but does not block communication
    21. while( USB_WriteEPTimed( 0, &ucBufferFifo[ucFifoProcessingIdx].pucOutBuffer[0], usDataLen, 1, APP_USB_SEND_TIMEOUT ) == USB_STATUS_TIMEOUT )
    22. {
    23. }
    24. bRelease = TRUE;
    25. }
    26. // Fifo slot is used, not yet complete but is stuck (usb rx frame not complete)
    27. else if ( ucBufferFifo[ucFifoProcessingIdx].ucTimeoutCounter > FIFO_SLOT_TIMEOUT )
    28. {
    29. bRelease = TRUE;
    30. }
    31. // Fifo slot was processed or stuck, so it needs to be released
    32. if ( bRelease )
    33. {
    34. // Release stuck fifo slot
    35. ucBufferFifo[ucFifoProcessingIdx].ucState = FIFO_SLOT_NOT_USED;
    36. ucBufferFifo[ucFifoProcessingIdx].ucTimeoutCounter = 0;
    37. }
    38. }
    39. ucFifoProcessingIdx++;
    40. }
    Display All

    You are correct about using the class API, we should and will use them, but that will not solve our issue as the class API 'USB_HID_WriteTimed' is calling 'USB_WriteEPTimed'.


    The post was edited 2 times, last by vincent tran ().

  • Hi Vincent,

    We already have a support case open via ISIT - "Steven Jarrousse" who just sent us the same code.
    We would appreciate it if we could stick to one support channel.

    We will get back to you via mail. Or do you want us to use the forum for this support case?