1 This is an USART Server application for the STMicroelectronics STM32F429I-DISC1 (32F429IDISCOVERY) board.
2 The application executes commands sent from the USART Client over the
3 USART interface and is used to physically test compliance of the USART driver
4 with the CMSIS USART driver specification from version 2.0.0 upwards.
7 The USART Server waits to receive a command over the USART interface.
8 After command is received it is executed, and USART Server again waits to receive
10 Command execution finishes by finishing the requested operation or by timeout.
11 All commands except XFER use (mostly fixed) communication configuration and timeout as
12 specified in the USART_Server_Config.h configuration file.
13 Only XFER command is executed using settings configured by SET COM command,
14 after execution of the XFER command the USART interface is configured back to
15 default settings from configuration file, so next command can be received.
16 The XFER command is executed until it finishes or until timeout specified in
18 If timeout is not specified in the command the last specified timeout from
19 previous XFER command is used.
20 If timeout was never specified in the XFER command then default timeout setting
23 Default USART interface configuration:
30 Settings configurable in the USART_Server_Config.h file:
31 - Mode: Asynchronous, Single-wire or IrDA
33 Hardware configuration of the USART Server (peripheral USART1 is used):
42 GND any ground connection on the board
44 Note: In Single-wire mode Tx pin is used for both transmit and receive working
47 Note: USART pins are MCU pins before RS232 level shifter.
49 USART Server commands (32 bytes long (zero padding), [] means parameter is optional):
50 - GET VER <- followed by 16 bytes Tx data
51 - GET CAP <- followed by 32 bytes Tx data
52 - SET BUF RX/TX,len[,pattern] -> followed by optional 'len' bytes Rx data
53 - GET BUF RX/TX,len <- followed by 'len' bytes Tx data
54 - SET COM mode,data_bits,parity,stop_bits,flow_ctrl,cpol,cpha,baudrate
55 - XFER dir,num[,delay][,timeout][,num_rts] <-> followed by 'num' items data Tx, Rx or Tx and Rx transfer
56 - GET CNT <- followed by 16 bytes Tx data
57 - SET BRK delay,duration
58 - GET BRK <- followed by 1 byte Rx data phase
59 - SET MDM mdm_ctrl,delay,duration
60 - GET MDM <- followed by 1 byte Tx data
62 USART Server command parameters:
63 RX/TX: RX = USART Server's receive buffer, TX = USART Server's transmit buffer
64 len: length of content in following Tx or Rx data phase
65 pattern: value (in hex notation) to pre-fill the buffer with
66 mode: 1 = Asynchronous
67 2 = Synchronous Master
72 data_bits: data bits (5 .. 9)
76 stop_bits: 0 = 1 Stop Bit
84 cpol: This setting is only relevant for Synchronous mode
85 0 = Data are captured on rising edge
86 1 = Data are captured on falling edge
87 cpha: This setting is only relevant for Synchronous mode
88 0 = Sample on first (leading) edge
89 1 = Sample on second (trailing) edge
90 baudrate: baudrate in bauds
91 dir: direction of transfer
94 2 = Transfer (simultaneous Tx and Rx (in synchronous mode only))
95 num: number of items (according CMSIS USART driver specification)
96 delay: initial delay, in milliseconds, before starting requested operation or line control
97 timeout: timeout in milliseconds, after delay, if delay is specified
98 num_rts: number of items after which RTS line should be de-activated
99 (used to test client's CTS line functionality)
100 mdm_ctrl: modem lines requested state (in hex notation):
101 - bit 0.: RTS pin state
102 - bit 1.: DTS pin state
103 - bit 2.: state of GPIO line connected to USART Client's DCD pin
104 - bit 3.: state of GPIO line connected to USART Client's RI pin
105 duration: duration, in milliseconds, of controlling modem lines
107 USART Server responses to commands:
108 - GET VER: 16 bytes containing string representation in form:
110 - GET CAP: 32 bytes containing values representing masks (bit value 1 means supported) or values as follows:
111 "mode_mask,data_bits_mask,parity_mask,stop_bits_mask,flow_control_mask,min_baudrate,max_baudrate"
112 - mode_mask (2 digits in hex): specifies mask of supported modes
113 - bit 0.: Asynchronous
114 - bit 1.: Synchronous Master
115 - bit 2.: Synchronous Slave
116 - bit 3.: Single Wire
119 - data_bits_mask (2 digits in hex): specifies mask of supported data bits
120 - bit 0.: Data Bits 5
121 - bit 1.: Data Bits 6
122 - bit 2.: Data Bits 7
123 - bit 3.: Data Bits 8
124 - bit 4.: Data Bits 9
125 - parity_mask: (1 digits in hex): specifies mask of supported parity options
127 - bit 1.: Even Parity
129 - stop_bits_mask (1 digits in hex): specifies mask of supported stop bits
131 - bit 1.: 2 Stop Bits
132 - bit 2.: 1.5 Stop Bits
133 - bit 3.: 0.5 Stop Bits
134 - flow_control_mask (1 digits in hex): specifies mask of supported flow control options
135 - bit 0.: No Flow Control
139 - modem_line_mask: (1 digits in hex): specifies mask of supported modem lines (input/output)
140 - bit 0.: RTS line available
141 - bit 1.: CTS line available
142 - bit 2.: DTR line available
143 - bit 3.: DSR line available
144 - bit 4.: GPIO for DCD line available
145 - bit 5.: GPIO for RI line available
146 - min_baudrate (dec): minimum supported baudrate (in bauds)
147 - max_baudrate (dec): maximum supported baudrate (in bauds)
148 - GET BUF: 'len' bytes from respective buffer, in binary format
149 - GET CNT: 16 bytes containing value in decimal notation
150 - GET BRK: 1 byte (in hex) containing break signal status
151 - GET MDM: 1 byte (in hex) containing values representing modem lines state:
152 - bit 0.: CTS line current state
153 - bit 1.: DSR line current state
155 The USART Server for the STMicroelectronics STM32F429I-DISC1 (32F429IDISCOVERY) board is available for different targets:
156 - Release: target with high optimization and no User Interface
157 - Debug: target with low optimization and User Interface (GLCD, LED)
161 -> GET VER <- 16 bytes (for example "1.0.0")
163 -> GET CAP <- 32 bytes (for example "3B,18,7,F,F,03,9600,5000000")
164 Set Tx buffer to 'S':
166 Set Rx buffer to '?':
168 Get 16 bytes of Rx buffer content:
169 -> GET BUF RX,16 <- 16 bytes (for example "????????????????")
170 Set communication mode to asynchronous, 8 data bits, no parity, 1 stop bit,
171 no flow control, 115200 bauds:
172 -> SET COM 0,8,0,0,0,0,0,115200
174 -> XFER 0,16,0,100 <- 16 bytes
176 -> XFER 1,16,0,100 -> 16 bytes
177 Transfer 16 bytes in both directions (in synchronous mode only):
178 -> XFER 2,16,0,100 <-> 16 bytes
180 -> GET CNT <- 16 bytes (for example "16")
182 -> GET BRK <- 1 byte (for example "1")
183 Set activate RTS modem line after 10 ms for 50 ms and then deactivate it:
185 Get modem line state:
186 -> GET MDM <- 1 byte (for example "3")