Difference between revisions of "PC-Microcontroller Communications"
m |
(Add bluetooth to list) |
||
Line 165: | Line 165: | ||
* High part count and complex hardware | * High part count and complex hardware | ||
* Device detection is not plug and play. It can be complex to find the IP address of an embedded device. | * Device detection is not plug and play. It can be complex to find the IP address of an embedded device. | ||
+ | |||
+ | == Bluetooth-SPP Communications from a PC to Microcontrollers == | ||
+ | |||
+ | Many laptops and even desktops now have bluetooth support or a bluetooth dangle can be purchased for a small amount of money. This makes bluetooth a good choice for controlling microcontrollers wirelessly. Several dropin modules are available that implement the Bluetooth SPP protocal which allows direct emulation of a serial cable. The models usually have an AT command set for configuring the module and establishing connections. Most Bluetooth stacks on the PC have support for SPP and will expose the device as a COM port. Detection of the COM port is difficult since Bluetooth doesn't have a standard stack for Windows. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |-valign="top" | ||
+ | |Catagory | ||
+ | |Site | ||
+ | |Comments | ||
+ | <!--------------------------------> | ||
+ | |||
+ | |-valign="top" | ||
+ | |Hardware | ||
+ | |[http://www.sparkfun.com/commerce/product_info.php?products_id=8461 Bluetooth DIP Module - SparkFun] | ||
+ | |Bluetooth dropin serial replacement module from SparkFun | ||
+ | <!--------------------------------> | ||
+ | |||
+ | |} | ||
+ | |||
+ | Advantages: | ||
+ | * Fast | ||
+ | * Wireless | ||
+ | * Quick conversion of existing serial port based devices to wireless | ||
+ | * No device drivers to install | ||
+ | |||
+ | Disadvantages: | ||
+ | * Pairing devices can be complex | ||
+ | * Difficult to make the system plug and play | ||
+ | * AT command set can get in the way of data if binary data is sent. |
Revision as of 13:17, 3 April 2008
Contents
Introduction
Many times an embedded system or microcontroller needs to be connected to a PC. This topic discusses the various methods for doing this
Serial Communications from a PC to Microcontrollers
This is often done using Hyperterminal ( a program bundled with MS Windows ) to communicate with the microcontroller using RS232 or virtual RS232 over USB. This program is pretty painful to use, we should list some alternatives to it here. This is just a start:
Program | Source/Comments
|
RS232/USB Probe | RS232/USB Probe Now in testing, a specialized program for microcontroller communication on the PC side. |
R. E. Smith I/O Commander | From the site:
The I/O Commander is designed to communicate, test and control our line of digital and analog I/O products. However, due to its flexible nature, it can also be used as a general purpose terminal emulator (color coded TXD/RXD, split screen modes, and 32/1024 "hot-keys") and, as a drum sequencer. The terminal emulator now supports COM1 through COMX, and data rates from 300bps to 921.6Kbps. Now with flow control and parity. Same low cost: Free |
PIC Chip Communication with a PC | Date on this is 2001, does it still run? |
Tera Term Home Page | From the site:
last updated: Aug. 9, 1999 Tera Term (Pro) is a free software terminal emulator (communication program) for MS-Windows. It supports VT100 emulation, telnet connection, serial port connection, and so on. |
Using ADRCOM Terminal Emulation Software | From the site:
ADRCOM is a FREE terminal emulation program available from Ontrak Control Systems that allows simple ASCII commands to be sent and received via a serial port. It can be used to verify hardware connection of an ADR device and familiarize programmers with the ASCII commands used with the interfaces. In this example an ADR112 is connected to com1. Looks nice, how about a review? |
[1] | A list of terminal emulators, may be a good one in the bunch or several. |
( for the search engines: dump HyperTerminal find a better communications program )
For some notes on how to plan the microcontroller end of the communications see: RS232 and for a particular implementatation take a look at BitWacker PIC USB Development Board and the specialized PC program for it and similar devices: BitWacker Java Communications
For general information on terminal emulators see: Terminal emulator From Wikipedia, the free encyclopedia
Advantages
- Relatively simple firmware and PC software
- Ability to use terminal emulators to test hardware
- Long cable lengths
Disadvantages:
- Slow
- Requires bulky connectors and level translators
- Many new computers especially laptops don't have serial ports
USB Communications from a PC to Microcontrollers
Many modern computers especially laptops do not have serial ports and the serial connector port is big and bulky. RS232 communication requires the use of level shifters which add parts. Serial communication can also be slow.
An alternative is more and more microcontrollers now have native support for USB which has smaller connectors, is faster, and works with the plug and play architecture of modern OSs. The disadvantage is that the firmware is much more complex and the PC side requires an device driver and corresponding INF file. Lucky, many generic drivers are available and many microcontroller manufacters that support USB provide sample firmware.
Catagory | Site | Comments |
Getting started book | USB Complete | Introduction to USB. Covers both the hardware as well as some of the software issues like drivers and classes. |
Formal Specification | USB 2.0 Specification | Free reference documents that cover the hardware and core software of USB |
Formal Specification | USB Classes | Free reference documentation for standard USB device classes. |
Device Driver | WinUSB | Free generic device driver provided by microsoft for Windows XP and Vista |
Sample Framework/Device Driver | MCHPFSUSB v1.3 USB Framework | Sample USB framework for PIC18F USB Microcontrollers. Framework handles device enumeration and control endpoint requests. A free generic device driver is provided. |
Advantages:
- Fast
- Plug and Play
- No level translators and small connectors
- Works with computers that don't have serial ports
- Ability to implement standard devices such a keyboards, mice, memory card readers, and sound cards without writting a device driver.
Disadvantages:
- Complex Firmware and PC software
- Requires OS specific device drivers and installers
- PC application software is more OS specific
- Short cable lengths
- May require the use of an expensive hardware bus analyzer
Ethernet-TCP/IP Communications from a PC to Microcontrollers
Ethernet and the Internet is everwhere so many embedded devices now have ethernet connections. Network connections can be very long and it's possible to use cheap commodity hardware such as WiFi bridges. Several microcontroller manufacters are now providing sample TCP/IP stacks some of them with embedded web servers so that the hardware can be controlled from a PC via a web browser such as IE or Firefox. PC programming has a mostly OS independent API called sockets that is available on both Windows and Unix.
Catagory | Site | Comments |
Sample Firmware/Stack | Microchip TCP/IP Stack v4.18 for PIC18, PIC24, dsPIC and PIC32 MCUs | Sample TCP/IP firmware for many Microchip microcontrollers |
Advantages:
- Fast
- Long cable lengths and commodity equiptment
- PC API is mostly OS independent
- No device drivers required
- Many OSs include free packet sniffers for easy analysis of network traffic
Disadvantages:
- More complex firmware then either serial ports or USB
- High part count and complex hardware
- Device detection is not plug and play. It can be complex to find the IP address of an embedded device.
Bluetooth-SPP Communications from a PC to Microcontrollers
Many laptops and even desktops now have bluetooth support or a bluetooth dangle can be purchased for a small amount of money. This makes bluetooth a good choice for controlling microcontrollers wirelessly. Several dropin modules are available that implement the Bluetooth SPP protocal which allows direct emulation of a serial cable. The models usually have an AT command set for configuring the module and establishing connections. Most Bluetooth stacks on the PC have support for SPP and will expose the device as a COM port. Detection of the COM port is difficult since Bluetooth doesn't have a standard stack for Windows.
Catagory | Site | Comments |
Hardware | Bluetooth DIP Module - SparkFun | Bluetooth dropin serial replacement module from SparkFun |
Advantages:
- Fast
- Wireless
- Quick conversion of existing serial port based devices to wireless
- No device drivers to install
Disadvantages:
- Pairing devices can be complex
- Difficult to make the system plug and play
- AT command set can get in the way of data if binary data is sent.