A Serial Communications Interface or Universal Asynchronous Receiver-Transmitter (UART) is a serial communications peripheral that implements the asynchronous serial communications protocol.
The serial communications interface can be used to communicate with several devices such as displays, sensors, data acquisition systems, etc.
The ConnectCore 6 SBC provides access to three UART interfaces on UART expansion connector. This connector provides access to the following interfaces:
Over the years, dozens of serial protocols have been crafted to meet particular needs of embedded systems. USB (universal serial bus), and Ethernet, are a couple of the more well-known computing serial interfaces. Other very common serial interfaces include SPI, I 2 C, and the serial standard we're here to talk about today. Each of these serial. I was using the Dev C compiler to write the code. Now I am trying to verify the output.What I did was to write the letter 'a' to the serial port. The serial port is connected to a digital oscilloscope and I intend to see the voltage patterns that correspond to the letter 'a' as below.
- UART1: 4 wire, RS232 level UART
- UART3: 4 wire, RS232 level UART
- UART5: 4 wire, TTL UART shared with XBee interface
These three UART interfaces have software flow control lines (RTS and CTS). UART1 and UART3 have RS232 levels and they are configured in DTE mode (CTS input and RTS output). The UART5 interface has TTL levels and it is configured in DCE mode (CTS output and RTS input).
See the ConnectCore 6 Hardware Reference Manual for information about the available Serial Ports.
Digi adds to Android an API to manage these Serial Ports interfaces. You can configure the connection, send, and receive data among other things. In the Javadoc documentation you can find a complete list of the available methods in this API.
Unless noted, all serial API methods require the com.digi.android.permission.SERIAL permission.
C Code Serial Port Communication
Note If your application does not have the com.digi.android.permission.SERIAL permission it will not have access to any serial port service feature.
First, a new SerialPortManager object must be instantiated by passing the Android Application Context.
Serial Communication Tutorial
The Serial Port API allows you to:
Example: Serial Port |
---|
The Serial Port Sample Application demonstrates the usage of the Serial Port API. In this example you can list all the available Serial ports, configure them, send, and receive data. You can import the example using Digi's Android Studio plugin. For more information, see Import a Digi sample application. To look at the application source code, go to the GitHub repository. |