2.2 Configuration Header: PrjCfg.h

The PrjCfg.h header file is used for the USI Host configuration, and the user must include this file with the same name. In the USI Host repository there is a file named PrjCfg.h with the example below:

    #define NUM_PORTS                     2
    #define PORT_0                        CONF_PORT(UART_TYPE,3, 115200, 4096, 4096)
    #define PORT_1                        CONF_PORT(UART_TYPE,4, 115200, 4096, 4096)
    #define NUM_PROTOCOLS                 3
    #define USE_MNGP_PRIME_PORT           0    
    #define USE_PROTOCOL_PRIME_API        0
    #define USE_PROTOCOL_SNIF_PRIME_PORT  0
    /*#define USE_PROTOCOL_PHY_SERIAL_PRIME*/
    /*#define USE_PROTOCOL_ADP_G3_PORT*/      
    /*#define USE_PROTOCOL_COORD_G3_PORT*/        
    /*#define USE_PROTOCOL_MAC_G3_PORT*/
    /*#define USE_PROTOCOL_MM_AL_API*/
NUM_PORTS defines the number of ports to be used and users can use up to 4 ports. Ports can be configured in the header file with the macro CONF_PORT defined in the PrjCfg.h file, where:
  • Type: Port type (UART_TYPE, USART_TYPE or COM_TYPE)
  • Channel: COM port number
  • Baudrate: Port speed
  • txSize: Buffer size for transmission
  • rxSize: Buffer size for reception
The available protocols implemented in USI Host are MNGP_PRIME, PRIME_API, PRIME_SNIFFER and PHI_SERIAL for PRIME; ADP, Coordinator and Sniffer for G3; and AL_API for Meters And More. To use a protocol, the definition of USE_PROTOCOL_xxx must be set with the number of port used for that protocol. Each protocol can be enabled using the appropriate macro. The value of the definition sets the port used (0 to 3) for that protocol.

The port configuration can also be changed once the program is running, using the function addUsi_ConfigurePort (uint8_t logPort, uint8_t commPort, uint32_t speed).