1.2.6.3 Configuring The Library

USI Service is configured via MCC. The following snapshots show the MCC configuration window for USI Service and brief description.

Figure . USI Service common configuration options for all instances
SRV_USI_mcc_usi
  • Received Message Pool Size
    • Specifies the maximum number of received USI messages (of any length) that can be stored, without calling SRV_USI_Tasks, for all instances using UART (not used for instances using USB CDC)
  • UART API
    • UART Connections
      • Indicates the number of USI instances using UART
  • CDC API
    • CDC Connections
      • Indicates the number of USI instances using USB CDC

Each USI instance can be connected to:

  • Peripheral Library with UART capability (UART/USART/FLEXCOM/SERCOM)
  • USB CDC Function Driver (USB_DEVICE_CDC capability)

The user must connect only one dependency to each USI instance. Altough it is allowed in MCC to connect an instance to both UART and USB_DEVICE_CDC, it is not supported by the library and the code will not be generated properly.

Figure . USI Service configuration options for UART instance
SRV_USI_mcc_usi_uart
  • Device Used
    • Indicates the hardware PLIB instance used by the corresponding instance of USI Service.
    • The underlying PLIB is automatically configured in Non-blocking mode, as shown in the figure below
  • Read Buffer Size
    • Size in bytes of the buffer used by the corresponding USI instance for message reception
    • Note that the buffer can store more than one received message (Received Message Pool Size) if a new message is received before calling SRV_USI_Tasks
  • Write Buffer Size
    • Size in bytes of the buffer used by the corresponding USI instance for message transmission
    • Note that USI adds overhead (start/end marks, USI header, escaped characters) to the message sent to SRV_USI_Send_Message
Figure . UART Peripheral configuration
SRV_USI_mcc_uart
Figure . USI Service configuration options for USB CDC instance
SRV_USI_mcc_usi_cdc
  • Device Used
    • Indicates the USB CDC Instance used by the corresponding instance of USI Service.
    • The user should configure cdc_com_port_single_demo in the USB Device Layer module, as shown in the figure below
  • Read Buffer Size
    • Size in bytes of the buffer used by the corresponding USI instance for message reception
  • Write Buffer Size
    • Size in bytes of the buffer used by the corresponding USI instance for message transmission
    • Note that USI adds overhead (start/end marks, USI header, escaped characters) to the message sent to SRV_USI_Send_Message
Figure . USB Device Layer configuration
SRV_USI_mcc_cdc
  • RTOS Settings
    • Stack Size (in bytes):
      • Specifies the number of bytes to be allocated on the stack for the service task.
    • Task Priority:
      • Specifies priority for the service task thread. The value can vary based on RTOS used.