You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/rst/lib_uart.rst
+46-38Lines changed: 46 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,44 @@ Inroduction
8
8
9
9
A software defined, industry-standard, UART (Universal Asynchronous
10
10
Receiver/Transmitter) library
11
-
that allows you to control a UART serial connection via the
12
-
xCORE GPIO ports. This library is controlled
11
+
that allows the user to control a UART serial connection via the
12
+
xcore GPIO ports. This library is controlled
13
13
via XC using the XMOS multicore extensions.
14
14
15
+
|newpage|
16
+
17
+
``lib_uart`` components
18
+
=======================
19
+
20
+
There are four ways to use the UART library detailed in the table below.
21
+
22
+
.. list-table::
23
+
:widths: 20 80
24
+
:header-rows: 1
25
+
26
+
* - UART type
27
+
- Description
28
+
* - Standard
29
+
- Standard UARTs provide a flexible, fully configurable UART for
30
+
speeds up to 115200 baud. The UART connects to ports via the GPIO
31
+
library so can be used with single bits of
32
+
multi-bit ports. Transmit can be buffered or unbuffered. The UART
33
+
components run on a logical core but are combinable so can be
34
+
run with other tasks on the same core (though the timing may be affected).
35
+
* - Fast/streaming
36
+
- The fast/streaming UART components provide a fixed configuration
37
+
fast UART that streams data in and out via a streaming channel.
38
+
* - Half-duplex
39
+
- The half-duplex component performs receive and transmit on the
40
+
same data line. The application controls the direction of the
41
+
UART at runtime. It is particularly useful for RS485 connections.
42
+
* - Multi-UART
43
+
- The multi-UART components efficiently run several UARTS on the
44
+
same core using a multibit port.
45
+
46
+
Using ``lib_uart``
47
+
==================
48
+
15
49
``lib_uart`` is intended to be used with the `XCommon CMake <https://www.xmos.com/file/xcommon-cmake-documentation/?version=latest>`_
16
50
, the `XMOS` application build and dependency management system.
17
51
@@ -49,7 +83,7 @@ rate which is the number of bits per second.
49
83
Connecting to the `xcore` device
50
84
================================
51
85
52
-
If you are using the general UART Rx/Tx components then the UART line
86
+
If using the standard UART Rx/Tx components then the UART line
53
87
can be connected to a bit of any port. The other bits of the port can
54
88
be shared using the GPIO library. Please refer to the GPIO library
55
89
user guide for restrictions on sharing bits of a port (for example,
@@ -93,9 +127,9 @@ the pins of the port not connected (:ref:`connect_multi`).
93
127
94
128
For multi-UART receive, an incoming clock is required to acheive
95
129
standard baud rates. The clock should be a multiple of the maximum
96
-
BAUD rate required e.g. a 1843200Khz oscillator is a multiple of
130
+
BAUD rate required e.g. a 1843200 Hz oscillator is a multiple of
97
131
115200 baud (and lower rates also). The maximum allowable incoming
98
-
signal is 1843200Khz.
132
+
signal is 1843200 Hz.
99
133
100
134
For multi-UART transmit, an incoming clock can also be used. The same
101
135
clock signal can be shared between receive and transmit (i.e. only a
@@ -107,35 +141,7 @@ single 1-bit port need be used).
107
141
Usage
108
142
*****
109
143
110
-
The are four ways to use the UART library detailed in the table below.
111
-
112
-
.. list-table::
113
-
:widths: 20 80
114
-
:header-rows: 1
115
-
116
-
* - UART type
117
-
- Description
118
-
* - Standard
119
-
- Standard UARTs provide a flexible, fully configurable UART for
120
-
speeds up to 115200 baud. The UART connects to ports via the GPIO
121
-
library so can be used with single bits of
122
-
multi-bit ports. Transmit can be buffered or unbuffered. The UART
123
-
components runs on a logical core but are combinable so can be
124
-
run with other tasks on the same core (though the timing may be affected).
125
-
* - Fast/streaming
126
-
- The fast/streaming UART components provide a fixed configuration
127
-
fast UART that streams data in and out via a streaming channel.
128
-
* - Half-duplex
129
-
- The half-duplex component performs receive and transmit on the
130
-
same data line. The application controls the direction of the
131
-
UART at runtime. It is particularly useful for RS485 connections (link?)
132
-
* - Multi-UART
133
-
- The multi-UART components efficiently run several UARTS on the
134
-
same core using a multibit port.
135
-
136
-
All the UARTs use the XMOS multicore extensions to C (xC) to perform
137
-
their operations, see the `XMOS Programming
138
-
Guide` for more details.
144
+
The following sections describe the four ways to use the UART library.
139
145
140
146
Standard UART usage
141
147
===================
@@ -186,8 +192,8 @@ component and connects to them:
186
192
}
187
193
188
194
The ``output_gpio`` task and ``input_gpio_with_events`` tasks are part
189
-
of the GPIO library for flexible use of multi-bit ports. See the GPIO
190
-
library user guide for details.
195
+
of the GPIO library for flexible use of multi-bit ports.
196
+
See the `GPIO library user guide<https://www.xmos.com/file/lib_gpio>`_ for details.
191
197
192
198
The application can use the client end of the interface connection to
193
199
perform UART operations e.g.:
@@ -261,6 +267,8 @@ transmitted and that there is more space in the buffer by calling the
261
267
The unbuffered UART does not take its own logical core but calls to
262
268
``write`` will block until the character has been sent.
263
269
270
+
|newpage|
271
+
264
272
Fast/Streaming UART usage
265
273
=========================
266
274
@@ -487,7 +495,7 @@ The multi-UART RX component must be clocked of a rate which is a
487
495
multiple of the BAUD rates required.
488
496
489
497
If a port is not explicitly configured, then it will be clocked of the
490
-
reference 100Mhz clock of the xCORE. The TX component can also work
498
+
reference 100Mhz clock of the xcore. The TX component can also work
491
499
with this clock rate.
492
500
493
501
|newpage|
@@ -531,7 +539,7 @@ Multi-UART example
531
539
==================
532
540
533
541
The multi-UART example demonstrates the use of the multi-UART API to loopback data between multi-UART Tx and Rx components .
534
-
This example requires 2 8-bit ports and a shared clock.
542
+
This example requires two 8-bit ports and a shared clock.
535
543
The ports chosen are *XS1_PORT_8B* on tile 0 (*X0D14* - *X0D21* in the top left header) and *XS1_PORT_8A* on tile 1 (*X1D02* - *X1D08* in the bottom left header and *CODEC RST_N* which is *X1D09*).
536
544
The application will generate a PLL clock on *MCLK* (*X1D11*) which needs to be shared with tile 0 *XS1_PORT_1A* (*X0D00*) port.
537
545
Make sure to connect 8-bit ports and the share the clock for the example to work.
0 commit comments