Thursday, October 19th 2017, 4:45pm UTC+2

You are not logged in.

  • Login
  • Register

Reply

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Attention: The last reply to this post was 618 days ago. The thread may already be out of date. Please consider creating a new thread.

Message information
Message
Settings
Automatically converts internet addresses into links by adding [url] and [/url] around them.
Smiley code in your message such as :) is automatically displayed as image.
You can use BBCode to format your message, if this option is enabled.
Security measure

Please enter the letters that are shown in the picture below (without spaces, and upper or lower case can be used).

The last 5 posts

Tuesday, February 9th 2016, 10:48am

by vincent tran

Hello Yan,

Ok, I will stick with the support through ISIT.

Regards

Tuesday, February 9th 2016, 10:45am

by SEGGER - Yan

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?

Tuesday, February 9th 2016, 9:25am

by vincent tran

Hello Yan,

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

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
     // Process all rx buffers in fifo
      while( ucFifoProcessingIdx < APP_USB_FIFO_MAX_SIZE )
      {
          bool bRelease = FALSE;

          // Fifo slot is used
          if ( (ucBufferFifo[ucFifoProcessingIdx].ucState & FIFO_SLOT_USED) )
          {
              // Update fifo timeout counter
              ucBufferFifo[ucFifoProcessingIdx].ucTimeoutCounter++;

              // Fifo slot is complete and ready to be processed
              if ( (ucBufferFifo[ucFifoProcessingIdx].ucState & FIFO_SLOT_COMPLETE) )
              {
                  unsigned short usDataLen = 0;


                 AnalysisRequest( (shutrequest*)&ucBufferFifo[ucFifoProcessingIdx].tInBuffer,
                                       ( void * ) &ucBufferFifo[ucFifoProcessingIdx].pucOutBuffer,   //&ucInBuffer,
                                       &usDataLen,
                                       AppUsbTask_vGetShutReport,
                                       AppUsbTask_vSetShutReport );

                  // Send over USB with max transmit time of 1 ms,
                  // otherwise the frame is lost but does not block communication
                  while( USB_WriteEPTimed( 0, &ucBufferFifo[ucFifoProcessingIdx].pucOutBuffer[0], usDataLen, 1, APP_USB_SEND_TIMEOUT ) == USB_STATUS_TIMEOUT )
                  {
                  }

                  bRelease = TRUE;
              }
              // Fifo slot is used, not yet complete but is stuck (usb rx frame not complete)
              else if ( ucBufferFifo[ucFifoProcessingIdx].ucTimeoutCounter > FIFO_SLOT_TIMEOUT )
              {
                  bRelease = TRUE;
              }

              // Fifo slot was processed or stuck, so it needs to be released
              if ( bRelease )
              {
                  // Release stuck fifo slot
                  ucBufferFifo[ucFifoProcessingIdx].ucState = FIFO_SLOT_NOT_USED;
                  ucBufferFifo[ucFifoProcessingIdx].ucTimeoutCounter = 0;
              }
          }
          ucFifoProcessingIdx++;
      }


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'.


Regards

Monday, February 8th 2016, 6:07pm

by SEGGER - Yan

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?

Monday, February 8th 2016, 1:06pm

by vincent tran

Minimum delay between consecutive transmit

Hello,

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