Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3
minLevel2
indent20px

...

Several constants are available to customize the demo application on both device and host (Windows) side.  describe Table - Device Side Demo Application’s Configuration Constants describe device side constants that are located in the app_cfg.h or  app_usbd_cfg.h file.   Table - Host Side (Windows) Demo Application’s Configuration Constants describe host side constants that are located in the app_phdc.c file.

Anchor
Table - Device Side Demo Application’s Configuration Constants
Table - Device Side Demo Application’s Configuration Constants

Panel
borderWidth0
titleTable - Device Side Demo Application’s Configuration Constants


ConstantDescriptionFile
APP_CFG_USBD_PHDC_ENSet to DEF_ENABLED to enable the demo application. app_usbd_cfg.h
APP_CFG_USBD_PHDC_ITEM_DATA_LEN_MAXSet this constant to the maximum number of bytes that can be transferred as data. Must be >= 5. app_usbd_cfg.h
APP_CFG_USBD_PHDC_ITEM_NBR_MAXSet this constant to the maximum number of items that the application should support. Must be >= 1. app_usbd_cfg.h
APP_CFG_USBD_PHDC_MAX_NBR_TASKSSet this constant to the number of transmit tasks needed to handle all the QoS levels. Must be >= 1.

Each created task will send data attached to one specific QoS level. If this constant is greater than one, usually USBD_PHDC_OS_CFG_SCHED_EN is set to DEF_ENABLED.

Otherwise, USBD_PHDC_OS_CFG_SCHED_EN can be set to DEF_DISABLED.
app_usbd_cfg.h
APP_CFG_USBD_PHDC_TX_COMM_TASK_PRIOPriority of the write task. app_cfg.h
APP_CFG_USBD_PHDC_RX_COMM_TASK_PRIOPriority of the read task. app_cfg.h
APP_CFG_USBD_PHDC_TASK_STK_SIZEStack size of both read and write tasks. Default value is 512. app_cfg.h


Anchor
Table - Host Side (Windows) Demo Application’s Configuration Constants
Table - Host Side (Windows) Demo Application’s Configuration Constants

Panel
borderWidth0
titleTable - Host Side (Windows) Demo Application’s Configuration Constants


ConstantDescription
APP_ITEM_DATA_LEN_MAXSet this constant to the maximum number of bytes that can be transferred as data. Must be >= 5.
APP_ITEM_DATA_OPAQUE_LEN_MAXSet this constant to the maximum number of bytes that can be transferred as opaque data. Must be <= (MaxPacketSize - 21).
APP_ITEM_NBR_MAXSet this constant to the maximum number of items that the application should support. Must be >= 1.
APP_STAT_COMP_PERIODSet this constant to the period (in ms) on which the statistic of each transfer (mean and standard deviation) should be computed.
APP_ITEM_PERIOD_MINSet this constant to the minimum period (in ms) that a user can specify for an item.
APP_ITEM_PERIOD_MAXSet this constant to the maximum period (in ms) that a user can specify for an item.
APP_ITEM_PERIOD_MULTIPLESet this constant to a multiple (in ms) that periodicity of items specified by the user must comply.



Since Microsoft does not provide any specific driver for PHDC, you will have to indicate to windows which driver to load using an INF file. The INF file will ask Windows to load the WinUSB generic driver (provided by Microsoft). The application uses the USBDev_API, which is a wrapper of the WinUSB driver (refer to the USBDev_API page).

...

In this demo application, you can ask the device to continuously send data of different QoS level and using a given periodicity. Each requested transfer is called an “item”. Using the monitor, you can see each transfer’s average periodicity and standard deviation. The monitor will also show the data and opaque data that you specified. At startup, the application will always send a default item with a periodicity of 100 ms. This item will send the device CPU usage and the value of a counter that is incremented each time the item is sent. The default item uses low latency / good reliability as QoS.   Figure - Demo Application at Startup shows the demo application at startup.

Anchor
Figure - Demo Application at Startup
Figure - Demo Application at Startup

Panel
borderWidth0
titleFigure - Demo Application at Startup

Demo Application at StartupImage Added


At this point, you have the possibility to add a new item by pressing 1. You will be prompted to specify the following values:

  • Periodicity of the transfer: the period at which the transfer will attempt to occur.
  • QoS (Latency / reliability) of the transfer: the type of QoS desired for this transfer.
  • Opaque data (if QoS is not low latency / good reliability): the opaque data that will be included in this transfer.
  • Data: the actual data that will be transferred.

Figure - Demo Application with Five Items Added shows the demo application with a few items added.

Anchor
Figure - Demo Application with Five Items Added
Figure - Demo Application with Five Items Added

Panel
borderWidth0
titleFigure - Demo Application with Five Items Added

Demo Application with Five Items AddedImage Added


Once an item has been added, the application provides statistics about every transfer. From left to right, there is the item’s number, the type of QoS, the ideal period, the mean period value, the standard deviation value and the opaque data/data. The mean and standard deviation values are calculated by the host application, based on a sampling of the actual period value obtained for every single transfer.

...