Search by Tags

How to use UART in VCSharp

 

Article updated at 28 Oct 2017
Compare with Revision

UART (Universal Asynchronous Receiver/Transmitter) is an individual (or part of an) integrated circuit used for serial communications over a computer or peripheral device serial port. It is commonly used in conjunction with communication standards such as RS-232, RS-422 or RS-485.

Use cases:

  • Thermal printer
  • GSM modem
  • Biometric finger sensor
  • and many more..

Refer these articles for more information about Serial ports available on Colibri modules:

Environment setup

On Evaluation Board v3.1A: Connect one end of the null modem cable to the serial port of the PC and the other end to upper RS232 port on connector X25.

On Iris board V1.1A: Connect one end of the null modem cable to the serial port of the PC and the other end of null modem cable to connector X14.

Use a terminal application, such as Tera Term to open a terminal connection on the PC with these settings: 9600 Baud/ 8 Data Bits/ No parity/ 1 Stop Bit.

Demo application

This application demonstrates how to read and write data using CoM port.

  1. Download Demo Source Code from here.
  2. Download and Install .NET Compact Framework directly to the FlashDisk of the device from here.
  3. Navigate to Solution Explorer in visual studio->Right Click on Solution > Properties > Devices.
  4. Uncheck "Deploy the Latest version of the .NET Compact Framework (including Service Packs)".
  5. After deploying the program to Colibri module. Go to My Device > Program Files > vcsharp_uart_demo. Double click on the vcsharp_uart_demo.exe to run the application.

Open a Tera Term window (on PC) and start a new Serial connection with the following settings:

  • Baud = 9600
  • Data Bits = 8
  • No parity
  • Stop Bit = 1

Send message from PC (work station) and you will see the number of bytes in buffer, press Read button to read message received from PC (work station).