blob: 6bf4a23e9294f175f3d9c63cd44749e2b0ce3356 [file] [log] [blame]
Kévin Redonccbed0b2019-01-24 18:30:26 +01001The USART Asynchronous Driver
2=============================
3
4The universal synchronous and asynchronous receiver and transmitter
5(USART) is usually used to transfer data from one device to the other.
6
7The USART driver use a ring buffer to store received data. When the USART
8raise the data received interrupt, this data will be stored in the ring buffer
9at the next free location. When the ring buffer is full, the next reception
10will overwrite the oldest data stored in the ring buffer. There is one
11USART_BUFFER_SIZE macro per used hardware instance, e.g. for SERCOM0 the macro
12is called SERCOM0_USART_BUFFER_SIZE.
13
14On the other hand, when sending data over USART, the data is not copied to an
15internal buffer, but the data buffer supplied by the user is used. The callback
16will only be generated at the end of the buffer and not for each byte.
17
18User can set action for flow control pins by function usart_set_flow_control,
19if the flow control is enabled. All the available states are defined in union
20usart_flow_control_state.
21
22Note that user can set state of flow control pins only if automatic support of
23the flow control is not supported by the hardware.
24
25Features
26--------
27
28* Initialization/de-initialization
29* Enabling/disabling
30* Control of the following settings:
31
32 * Baudrate
33 * UART or USRT communication mode
34 * Character size
35 * Data order
36 * Flow control
37* Data transfer: transmission, reception
38* Notifications about transfer done or error case via callbacks
39* Status information with busy state and transfer count
40
41Applications
42------------
43
44They are commonly used in a terminal application or low-speed communication
45between devices.
46
47Dependencies
48------------
49
50USART capable hardware, with interrupt on each character is sent or
51received.
52
53Concurrency
54-----------
55
56Write buffer should not be changed while data is being sent.
57
58
59Limitations
60-----------
61
62* The driver does not support 9-bit character size.
63* The "USART with ISO7816" mode can be only used in ISO7816 capable devices.
64 And the SCK pin can't be set directly. Application can use a GCLK output PIN
65 to generate SCK. For example to communicate with a SMARTCARD with ISO7816
66 (F = 372 ; D = 1), and baudrate=9600, the SCK pin output frequency should be
67 config as 372*9600=3571200Hz. More information can be refer to ISO7816 Specification.
68
69Known issues and workarounds
70----------------------------
71
72N/A