The USART Server is an application providing a set of features used by the CMSIS-Driver Validation suite to test the physical operation of the USART driver.
It is located in the <pack root directory>
\Tools\USART_Server directory.
The USART Server offers the following features:
- read of the version information
- read of the capabilities information
- set and read of the data buffers content
- read of the last send/receive/transfer count
- send of data
- reception of data
- transfer in synchronous mode
- generation of break signal
- read of break signal status
- control of modem lines
- read of modem lines state
Operation
The USART Server is continuously waiting on a command from the USART Client (Driver Validation), after the command is received it is executed, and the process repeats.
Most commands do not have any additional related data phase, but some do have additional input or output data exchange phase following the command.
Configuration
Communication interface settings used during command exchange are set in the USART_Server_Config.h configuration file.
USART_Server_Config.h configuration file in Configuration Wizard view mode
Configuration settings
Driver_USART# selects the driver instance used by the USART Server.
Communication settings specify the communication parameters for command exchange with the USART Client:
- Mode setting specifies the mode used for command exchange. Different modes require different physical connection and also USART Server must use same setting.
For details on modes please check USART Server connection.
Fixed communication settings used for command exchange with the USART Client are:
- Baudrate: 115200
- Data Bits: 8
- Parity: None
- Stop Bits: 1
- Flow Control: None
Commands
Commands are encoded in human readable format (ASCII strings) so they can be viewed by the USART bus analyzer and analyzed more easily.
Supported commands:
- GET VER: used to retrieve the version of the USART Server application
- GET CAP: used to retrieve the capabilities of the USART Server (the Server auto-detects capabilities upon reception of this command)
- SET BUF: used for initialization of the content of receive or transmit buffer of the USART Server
- GET BUF: used for retrieving the content of receive or transmit buffer of the USART Server
- SET COM: used for specifying configuration of the send/receive/transfer activated by the XFER command
- XFER: used to trigger a send/receive/transfer (parameters specified with the last SET COM command)
- GET CNT: used to retrieve the number of sent/received/transferred items in previous send/receive/transfer
- SET BRK: used to instruct USART Server to generate break signal
- GET BRK: used to retrieve break signal status on the USART Server
- SET MDM: used for activation of modem lines
- GET MDM: used to retrieve modem lines status on the USART Server
- Note
- For details about commands please refer to Abstract.txt file in the
<pack root directory>
\Tools\USART_Server\Board\MCBSTM32F400 directory.
Picture below shows a capture of USART Driver Validation validating functionality of the Send function in the Asynchronous mode
Porting USART Server to other targets
To create USART Server application for a different target device, follow the steps below:
- Create a new project in µVision for your target device
- In the RTE window enable and configure the following software components:
- CMSIS: CORE
- CMSIS: RTOS2 (API): Keil RTX5 any variant
- CMSIS Driver: USART (API)
- CMSIS Driver: VIO (API) select Virtual implementation if implementation for your target system is not available
- Generic device specific components (startup, clock system, I/O, ...) as required (please consult device's documentation for more information)
- Resolve any unresolved dependencies between components
- Copy the USART_Server.c file from the
<pack root directory>
\Tools\USART_Server\Source directory to the project root and add it to µVision project
- Copy the USART_Server.h file from the
<pack root directory>
\Tools\USART_Server\Include directory to the project root
- Copy the files specified below from the directory
<pack root directory>
\Tools\USART_Server\Config to the project root:
- USART_Server_Config.h: also adapt this file as required by your device
- USART_Server_HW.c: add this file to the µVision project also adapt it for your device's specific handling of the GPIO lines for testing of the DCD and RI lines
- Add root of the project to include path (Options for Target -> C/C++ -> Include Paths: .\)
- Add the main.c file from a template (Right-click Source Group 1... and select Add New Item to Group, select User Code Template and choose the CMSIS-RTOS2 'main' function file from CMSIS: RTOS2:Keil RTX5) and update with code snippet below (replace
app_main
function): #include "USART_Server.h"
__NO_RETURN static void app_main (void *argument) {
(void)argument;
USART_Server_Start();
for (;;) {}
}
- Build and download the ported USART Server application to the target device
Troubleshooting
Problems and solutions:
- USART Server is not responding to commands
- reset the USART Server
- check that correct driver instance is selected in the USART_Server_Config.h file
- check that communication settings (mode) between USART Server and USART Driver Validation are the same,
if they are not, correct them, rebuild the application and download to the hardware
- USART Server is not responding to commands it reports "Server Start failed!" message if debug variant is used
- check heap settings (it has to be larger than 2 * USART_SERVER_BUF_SIZE specified in the USART_Server_Config.h file)
- check that RTOS allows allocation of at least 512 bytes for the USART Server main thread (Global Dynamic Memory size [bytes] setting in RTX_Config.h file if RTX5 is used)
- check that USART driver used for USART Server supports selected mode and all fixed settings:
- Baudrate: 115200
- Data Bits: 8
- Parity: None
- Stop Bits: 1
- Flow Control: None
USART Server on the Keil MCBSTM32F400
µVision project and source files for the MCBSTM32F400 board are available in the <pack root directory>
\Tools\USART_Server\Board\MCBSTM32F400 directory.
On the Keil MCBSTM32F400 the USART1 interface is used, with the following pinout:
USART function | Pin |
Tx | PB6 |
Rx | PB7 |
CLK (synchro) | PA8 |
CTS | PA11 |
RTS | PA12 |
DCD test pin | PA9 |
RI test pin | PA10 |
- Note
- IMPORTANT: Ground must be connected between USART Server and Device (Driver) Under Test so that USART signals have same ground potential.
For more information please consult Abstract.txt file in the project root.
- Note
- For synchronous mode testing this device's hardware supports only synchronous Master mode, so it can only be used for testing synchronous Slave mode of the Driver Under Test.
USART Server on the STMicroelectronics STM32F429I-DISC1 (32F429IDISCOVERY) board
µVision project and source files for the STM32F429I-DISC1 board are available in the <pack root directory>
\Tools\USART_Server\Board\STM32F429I-DISC1 directory.
On the STMicroelectronics STM32F429I-DISC1 board the USART1 interface is used, with the following pinout:
USART function | Pin |
Tx | PA9 |
Rx | PA10 |
CLK (synchro) | PA8 |
CTS | PA11 |
RTS | PA12 |
DCD test pin | PA13 |
RI test pin | PA14 |
- Note
- IMPORTANT: Ground must be connected between USART Server and Device (Driver) Under Test so that USART signals have same ground potential.
For more information please consult Abstract.txt file in the project root.
- Note
- For synchronous mode testing this device's hardware supports only synchronous Master mode, so it can only be used for testing synchronous Slave mode of the Driver Under Test.