The USB technology is poised to change appliances the way it haschanged PC peripherals.
In 2001, Intel and Microsoft recommended USBas the replacement for many of the original IBM PC's interfaces,including mouse, keyboard, floppy-disk interfaces, and serial RS-232 and parallel-printer ports. Therewere very good reasons for taking that major step—many issues had beenidentified with those older interfaces.
Who doesn't remember how laborious and error- prone manualconfiguration of the serial RS-232 port could be? Not to mention theincompatible implementations of the RS-232 connectors, the highvoltages required by the transceivers and the point-to-point nature ofthe connection, where sharing the port among multiple devices (e.g.printers, modems and scanners) meant a lot of cable and connectorswapping.
These limitations could be seen by the embedded-control developer asa means to achieve a greater level of freedom.
The UART is a very simple devicethat developers have learned to master for simple serial connections.UARTs have been inexpensively integrated in most MCU architectures, butthe lack of a definition for the higher levels of the RS-232 protocolresulted in an endless stream of proprietary solutions.
In comparison, USB serialinterface engine (SIE) implementations require more gatesthan the UARTs they replaced. The USB protocol defines in detailseveral ISO andOSI stack layers and thusrequires more complex code. To make things worse, depending on the typeof interface being implemented, special (OS) drivers might be required.This means that a more intimate knowledge of the intricacies of the OSis required before the developer can exploit the full potential of thebus.
While the PC industry has eagerly embraced the USB, it is notsurprising that the embedded- control community at large has resistedthe transition as long as possible. Concerns about increased cost andcomplexity have slowed the initial adoption of the USB in the applianceworld.
One of the primary goals for the definition of the USB was to allowthe OS to better manage communication resources by improving or addingthe following mechanisms:
* automaticdetection and configuration of the application as soon as theconnection is established;
* synchronous datatransfer to improve performance by allowing the OS to manage andschedule the transactions, optimizing the throughput and reachingreliably higher speeds;
* standardization ofthe interfaces by grouping the applications in classes, allowing codesharing and reuse.
The advantages of being USB
Looking more closely from the application point of view, we can add thefollowing key features:
1) Lower-voltage operation. The USB bus does not require voltages above the standard 5V supply, andthe data lines operate on a 3.3V logic. This makes it possible tointegrate the transceiver and remove the ±12V power supplycircuitry associated, thus reducing the overall cost and componentcount of the application.
2) Absolutestandardization of connectors and cables. There are only fourwell defined pairs of plugs and sockets, with clear rules for theiruse, assuring absolute interoperability.
3) Power supply isprovided on the same cable/connector. This reduces cablingcomplexity and potentially further reduces system cost.
4) Bus architecture. It allows the connection of up to 128 devices simultaneously. Thesefeatures have important implications in the world of appliances. Theyaffect cost, space and time, and can motivate designers to look deeperinto this novel form of connectivity. A generic appliance design Let'slook at the case of a generic appliance application.
In this example, the appliance is already equipped with an MCU. Wewish to enhance it by adding a communication port to enable theinstaller (or other service personnel) to connect to a PC or a PDA toachieve the following: access data logs and report the recent usagehistory of the device for warranty and diagnostic purposes; andconfigure (trim) operating parameters to optimize operations or adaptto local environment.
5) We can nowcompare a USB implementation with the cost and performance of a moretraditional serial-port implementation:
6) USB automaticdetection and configuration is an integral part of Windows Plug andPlay technology, and eliminates the laborious and error-prone manualsetup of the connection.
7) The highthroughput of the Full-Speed USB interface (12Mbps) allows orders of-magnitude higher data transfers than the fastest serial port, reducingthe time required for service.
8) The lowervoltages used and the integration of the transceiver make the circuitsimpler than the comparable serial-port implementations, and reduce theoverall component count and application cost.
9) A single,standard connector is identified by the USB specifications for thisapplication, and it is a very small and robust component that can beobtained at extremely low cost.
10) The sameconnector can provide power (5V) to the application board (should theapplication be off during service), simplifying the design and reducingcost.
11) Standardinterface libraries (known as classes) can be leveraged to allow codereuse, and can eliminate the cost and need for custom driverdevelopment.
|Figure1. Due to large amounts of flash program memory on chip, MCUs withnative USB interfaces can manage the entire application in asingle-chip USB.|
We can fully appreciate the benefits of a migration to USB when welook at the most recent introductions in the MCU marketplace,specifically the newest flash MCUs with native USB interfaces (Figure 1, above ).
If we limit the scope of our research to simply patch an existingapplication (i.e. replacing an RS-232 transceiver with a USB interfacedevice), we can easily end up with a higher cost solution.
Standalone USB interface devices – even the most inexpensive – canbarely compete in cost with the transceiver they replace. The UART,which is often integrated in the MCU, remains in use and ends upbecoming the bottleneck of the entire resulting system, preventing itfrom achieving the higher performance promised by the USB.
New MCUs with native USB interfaces offer a better solution. Thedirect integration of the USB interface and transceiver with the MCUcore allows the application to take full advantage of the bus potential(up to 1MBps in the case of Full-Speed USB 2.0 implementations). Due tolarge amounts of flash program memory on chip, these MCUs can managethe entire application while providing a single-chip USB solution.
This results in an effective component count reduction and overallreal system cost savings. Flash memory MCUs allow the designer an extralevel of freedom. It promises the possibility of inexpensive fieldupgrades for maintenance, bug fixes, feature enhancements, and evenmanufacturing optimizations with just-in-time programming andconfiguration of the application at the end of the assembly line.
Not all flash processors are equal. Self-write capability, enduranceand retention are key features that can make the whole difference.
Endurance is the number of cycles of erase and write that the memorywill be able to perform. Retention is the number of years that thememory is guaranteed to maintain its contents. These two features areboth fundamental to characterizing the robustness of the flashtechnology and the reliability of the resulting application.
On the other hand, the self-write capability refers to the abilityof the MCU to modify the contents of its own program memory (or aportion of it) while executing code (from another portion).
In the case of USB-capable MCUs, this capability is quitesynergistic and opens the door to many different possibilities.
For example, the same USB port can be used to provide a way toupgrade the appliance firmware without requiring the use of external,specialized programming devices.
A small piece of code – generally referred to as the bootloader -takes care of this functionality and can be developed as a totallygeneric block, independent of the rest of the application.
Manufacturers of flash USB MCUs typically offer bootloader code as astandard solution, a black box that often comes complete with a small(OS-dependent) application that provides a complete GUI.
Activating the bootloader (by connecting the USB port to a PC)allows an operator to update the application code or update data usedby the appliance firmware. Examples include updating text messages,menus or tables containing parameters that define the applicationitself.
Data can also be read from the application (from the internal dataEEPROM or the flash program memory). This provides a method foruploading logged information, a practical access point for the mostbasic diagnostic tools.
Because of the bootloader “black box” approach, all of this isachieved without requiring much knowledge of the USB bus or rewritingany portion of the appliance code. The expert designer may want toexplore the USB bus capabilities in depth, with more time spent upfront, which provides the ability to reap even greater benefits.
In fact, the USB bus offers many classes of solutions that can beused alternatively or in combination to achieve much more.
Lucio Di Jasio is ProductMarketing Manager in the Advanced Microcontroller Architecture Divisionat Microchip Technology Inc.