These tests verify API and operation of the USART data exchange functions.
The data exchange tests verify the following driver functions (USART Driver function documentation):
- Send
int32_t Send (const void *data, uint32_t num);
- Receive
int32_t Receive ( void *data, uint32_t num);
- Transfer
int32_t Transfer (const void *data_out, void *data_in, uint32_t num);
- GetTxCount
uint32_t GetTxCount (void);
- GetRxCount
uint32_t GetRxCount (void);
- Control
int32_t Control (uint32_t control, uint32_t arg);
- GetStatus
ARM_USART_STATUS GetStatus (void);
- SignalEvent
void (*ARM_USART_SignalEvent_t) (uint32_t event);
All of these tests execute a data exchange and check the result of this data exchange.
Data exchange test procedure when Test Mode USART Server is selected:
- send command "SET BUF TX,.." to the USART Server: Set Tx buffer
- send command "SET BUF RX,.." to the USART Server: Set Rx buffer
- send command "SET COM .." to the USART Server: Set communication settings for the next XFER command
- send command "XFER .." to the USART Server: Specify transfer
- driver Control: Configure the USART interface
- driver Control: Set the default Tx value (in synchronous mode only)
- driver Send/Receive/Transfer: Start the requested operation
- driver GetStatus/SignalEvent: Wait for the current operation to finish or time-out
(operation is finished when appropriate tx_busy or rx_busy flag is 0 and send/receive/transfer completed event was signaled)
- assert that operation has finished in expected time
- assert that appropriate ARM_USART_EVENT_SEND_COMPLETE, ARM_USART_EVENT_RECEIVE_COMPLETE or ARM_USART_EVENT_TRANSFER_COMPLETE event was signaled
- driver GetStatus: Assert that appropriate tx_busy or rx_busy flag is 0
- driver GetTxCount: If it was a send or transfer operation assert that number of transmitted items is same as requested
- driver GetRxCount: If it was a receive or transfer operation assert that number of received items is same as requested
- if operation has timed out call driver Control function to Abort operation and wait timeout time
to make sure that the USART Server is ready for the next command
- assert that received content is as expected
- send command "GET BUF RX,.." to the USART Server: Get Rx buffer
- assert that sent content (read from the USART Server's receive buffer) is as expected
Data exchange Abort test procedure when Test Mode USART Server is selected:
- send command "SET BUF TX,.." to the USART Server: Set Tx buffer
- send command "SET BUF RX,.." to the USART Server: Set Rx buffer
- send command "SET COM .." to the USART Server: Set communication settings for the next XFER command
- send command "XFER .." to the USART Server: Specify transfer
- driver Control: Configure the USART interface
- driver Control: Set the default Tx value (in synchronous mode only)
- driver Send/Receive/Transfer: Start the requested operation
- wait up to 1 ms
- driver Control: Abort the current operation
- driver GetStatus: Assert that appropriate tx_busy or rx_busy flag is 0
- driver GetTxCount: If it was a send or transfer operation assert that number of transmitted items is less than requested
- driver GetRxCount: If it was a receive or transfer operation assert that number of received items is less than requested
Data exchange test procedure when Test Mode Loopback is selected:
- driver Control: Configure the USART interface
- driver Control: Set the default Tx value (in synchronous mode only)
- driver Send/Receive/Transfer: Start the requested operation
- driver GetStatus/SignalEvent: Wait for the current operation to finish or time-out
(operation is finished when appropriate tx_busy or rx_busy flag is 0 and send/receive/transfer completed event was signaled)
- assert that operation has finished in expected time
- assert that appropriate ARM_USART_EVENT_SEND_COMPLETE and ARM_USART_EVENT_RECEIVE_COMPLETE or ARM_USART_EVENT_TRANSFER_COMPLETE event was signaled
- driver GetStatus: Assert that appropriate tx_busy or rx_busy flag is 0
- driver GetTxCount: If it was a send and receive or transfer operation assert that number of transmitted items is same as requested
- driver GetRxCount: If it was a send and receive or transfer operation assert that number of received items is same as requested
- if operation has timed out call driver Control function to Abort operation
- assert that sent and received content is same
- Note
- Limitations of Data Exchange tests if Test Mode Loopback is selected:
- in synchronous mode only Master mode transfer can be tested
- only 8 data bit tests are supported
- parity tests are not supported
- stop bits tests are not supported
- flow control tests are not supported
- clock polarity and clock phase tests are not supported
void USART_Mode_Asynchronous |
( |
void |
| ) |
|
The function USART_Mode_Asynchronous verifies data exchange:
- in Asynchronous mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- at default baudrate
- for default number of data items
void USART_Mode_Synchronous_Master |
( |
void |
| ) |
|
The function USART_Mode_Synchronous_Master verifies data exchange:
- in Synchronous Master mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback Receive function is not tested
void USART_Mode_Synchronous_Slave |
( |
void |
| ) |
|
The function USART_Mode_Synchronous_Slave verifies data exchange:
- in Synchronous Slave mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Mode_Single_Wire |
( |
void |
| ) |
|
The function USART_Mode_Single_Wire verifies data exchange:
- in Single-Wire mode
- with default data bits
- with default parity
- with default stop bits
- with no flow control
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Mode_IrDA |
( |
void |
| ) |
|
The function USART_Mode_IrDA verifies data exchange:
- in Infra-red Data mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Data_Bits_5 |
( |
void |
| ) |
|
The function USART_Data_Bits_5 verifies data exchange:
- in default mode
- with 5 data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Data_Bits_6 |
( |
void |
| ) |
|
The function USART_Data_Bits_6 verifies data exchange:
- in default mode
- with 6 data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Data_Bits_7 |
( |
void |
| ) |
|
The function USART_Data_Bits_7 verifies data exchange:
- in default mode
- with 7 data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Data_Bits_8 |
( |
void |
| ) |
|
The function USART_Data_Bits_8 verifies data exchange:
- in default mode
- with 8 data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
void USART_Data_Bits_9 |
( |
void |
| ) |
|
The function USART_Data_Bits_9 verifies data exchange:
- in default mode
- with 9 data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
- Note
- In Test Mode Loopback this test is not executed
void USART_Parity_None |
( |
void |
| ) |
|
The function USART_Parity_None verifies data exchange:
- in default mode
- with default data bits
- with no parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
void USART_Parity_Even |
( |
void |
| ) |
|
The function USART_Parity_Even verifies data exchange:
- in default mode
- with default data bits
- with even parity
- with default stop bits
- with default flow control
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave
void USART_Parity_Odd |
( |
void |
| ) |
|
The function USART_Parity_Odd verifies data exchange:
- in default mode
- with default data bits
- with odd parity
- with default stop bits
- with default flow control
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave
void USART_Stop_Bits_1 |
( |
void |
| ) |
|
The function USART_Stop_Bits_1 verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with 1 stop bit
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
void USART_Stop_Bits_2 |
( |
void |
| ) |
|
The function USART_Stop_Bits_2 verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with 2 stop bits
- with default flow control
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave
void USART_Stop_Bits_1_5 |
( |
void |
| ) |
|
The function USART_Stop_Bits_1_5 verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with 1.5 stop bits
- with default flow control
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave
void USART_Stop_Bits_0_5 |
( |
void |
| ) |
|
The function USART_Stop_Bits_0_5 verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with 0.5 stop bits
- with default flow control
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave
void USART_Flow_Control_None |
( |
void |
| ) |
|
The function USART_Flow_Control_None verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with no flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for default number of data items
void USART_Flow_Control_RTS |
( |
void |
| ) |
|
The function USART_Flow_Control_RTS verifies functionality of the RTS line flow control by trying to receive half of default number of data items, after that, RTS line should be deactivated by the USART Client hardware and USART Server should stop sending further data.
The RTS line flow control functionality is tested with following settings:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with flow control using RTS signal
- at default baudrate
Test procedure consists of the following steps:
- start reception of half of default number of items
- after half of default number of items was received the RTS line should go to inactive state
- USART Server after seeing that its CTS line (USART Clients RTS line) went to inactive state should stop sending further data
- after timeout read from USART Server the number of items it has sent and assert that it is less than default number of items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave or Single-wire
void USART_Flow_Control_CTS |
( |
void |
| ) |
|
The function USART_Flow_Control_CTS verifies functionality of the CTS line flow control by trying to send default number of data items, while at half of transmitted number of items the USART Server deactivates its RTS line (it is connected to CTS line on the USART Client).
The CTS line flow control functionality is tested with following settings:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with flow control using CTS signal
- at default baudrate
Test procedure consists of the following steps:
- start send of default number of items
- after USART Server receives half of default number of items it will drive its RTS line (USART Clients CTS line) inactive
- before timeout check that tx_busy is active and that number of transmitted items is less than default number of items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave or Single-wire
void USART_Flow_Control_RTS_CTS |
( |
void |
| ) |
|
The function USART_Flow_Control_RTS_CTS verifies functionality of RTS And CTS lines. It calls function USART_Flow_Control_RTS that checks RTS line functionality, and USART_Flow_Control_CTS that checks CTS line functionality.
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave or Single-wire
void USART_Clock_Pol0_Pha0 |
( |
void |
| ) |
|
The function USART_Clock_Pol0_Pha0 verifies data exchange:
- in default mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with clock polarity 0
- with clock phase 0
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Asynchronous/Single-wire/IrDA
void USART_Clock_Pol0_Pha1 |
( |
void |
| ) |
|
The function USART_Clock_Pol0_Pha1 verifies data exchange:
- in default mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with clock polarity 0
- with clock phase 1
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Asynchronous/Single-wire/IrDA
void USART_Clock_Pol1_Pha0 |
( |
void |
| ) |
|
The function USART_Clock_Pol1_Pha0 verifies data exchange:
- in default mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with clock polarity 1
- with clock phase 0
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Asynchronous/Single-wire/IrDA
void USART_Clock_Pol1_Pha1 |
( |
void |
| ) |
|
The function USART_Clock_Pol1_Pha1 verifies data exchange:
- in default mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with clock polarity 1
- with clock phase 1
- at default baudrate
- for default number of data items
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Asynchronous/Single-wire/IrDA
void USART_Baudrate_Min |
( |
void |
| ) |
|
The function USART_Baudrate_Min verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at minimum baudrate (define
USART_CFG_MIN_BAUDRATE
in DV_USART_Config.h)
- for default number of data items
This test function checks the following requirement:
- measured bus speed for Send operation in Test Mode USART Server or Send/Receive operation in Test Mode Loopback is not 25% lower, or higher than requested
void USART_Baudrate_Max |
( |
void |
| ) |
|
The function USART_Baudrate_Max verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at maximum baudrate (define
USART_CFG_MAX_BAUDRATE
in DV_USART_Config.h)
- for default number of data items
This test function checks the following requirement:
- measured bus speed for Send operation in Test Mode USART Server or Send/Receive operation in Test Mode Loopback is not 25% lower, or higher than requested
void USART_Number_Of_Items |
( |
void |
| ) |
|
The function USART_Number_Of_Items verifies data exchange:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- for different number of items (defines
USART_CFG_NUM1 .. USART_CFG_NUM5
in DV_USART_Config.h)
void USART_GetTxCount |
( |
void |
| ) |
|
The function USART_GetTxCount verifies GetTxCount function (count changing) during data exchange (Send):
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
void USART_GetRxCount |
( |
void |
| ) |
|
The function USART_GetRxCount verifies GetRxCount function (count changing) during data exchange (Receive):
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
void USART_GetTxRxCount |
( |
void |
| ) |
|
The function USART_GetTxRxCount verifies GetTxCount and GetRxCount functions (count changing) during data exchange (Transfer):
- in default mode
- with default data bits
- with no parity
- with 1 stop bits
- with no flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- Note
- If Tests Default Mode Asynchronous/Single-wire/IrDA is selected this test is not executed
void USART_AbortSend |
( |
void |
| ) |
|
The function USART_AbortSend verifies Abort function abort of data exchange (Send):
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- at default baudrate
void USART_AbortReceive |
( |
void |
| ) |
|
The function USART_AbortReceive verifies Abort function abort of data exchange (Receive):
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with default flow control
- with default clock polarity
- with default clock phase
- at default baudrate
void USART_AbortTransfer |
( |
void |
| ) |
|
The function USART_AbortTransfer verifies Abort function abort of data exchange (Transfer):
- in default mode
- with default data bits
- with no parity
- with 1 stop bit
- with no flow control
- with default clock polarity
- with default clock phase
- at default baudrate
- Note
- If Tests Default Mode Asynchronous/Single-wire/IrDA is selected this test is not executed
void USART_TxBreak |
( |
void |
| ) |
|
The function USART_TxBreak verifies Break signaling:
- in default mode
- with default data bits
- with default parity
- with default stop bits
- with no flow control
- at default baudrate
- Note
- This test is not executed if any of the following settings are selected:
- Test Mode Loopback
- Tests Default Mode Synchronous Master/Slave