Embedded Systems Design Europe - November 2007 - (Page 18) microcontollers to access any peripheral, the flexible pin mapping registers must be initialized. Tools such as a Visual Device Initializer (VDI) provide graphical support for setting up many of the peripherals and other features on the vendor’s MCUs. Double clicking the flexible pin-mapping icon in the VDI tool opens a dropdown window that lets designers easily set up the desired peripheral function and pin mapping. After completing the pin assignment on the MCU and initializing the peripherals, the VDI will generate the necessary code. A VDI tool can also generate a pin and interrupt usage report, to supplement the design documentation. All analog functions and large peripherals, such as the parallel port, are also fixed. When making your function and pin assignments, remember to first assign the pins to the fixed analog and digital functions. Once this is done, you can assign the remappable functions and the port pins can be assigned to the remaining I/O. USE FLEXIBLE I/O There are many advantages to using flexible I/O pin mapping, besides those defined earlier. A case in point: the vendor-defined pin-out may not be suitable for every system placement. Consider a wireless transceiver, which may have to be physically located at a different side of the final product (when compared with the SPI connection on the MCU that controls it). To meet this requirement, it’s necessary to have the SPI channel and I/O pins on the same side of the MCU, otherwise the pc board routing will be complicated. Using a multiplexer-based flexible pin-mapping feature, you can appropriately define the peripheral’s pin-out to reduce trace lengths and vias. This may simplify the pc board routing and may eliminate a few board layers, thus reducing the pc board’s cost. The shorter trace, without vias, can also help to reduce EMI/ EMC problems. In applications where the PWM controls the low-impedance load, you may need more current than the I/O pin’s available drive strength. With 18 multiplexer-based flexible pin mapping, it’s possible to increase the drive strength for a particular peripheral signal by outputting the same signal on multiple pins and thus putting multiple I/O pin drivers in parallel. This reduces the need for an external driver circuit, further reducing the size and cost of the system. By routing the same signal to many peripherals, designers can insert software patches for debugging application code and take remedial action on the existing prototype, where necessary. One way to do this is to use multiplexer-based flexible pin mapping to map the interrupt or input-capture function on the communication channel. This lets the designer monitor bus communication for custom events, such as glitches. In this way, multiplexer-based flexible pin mapping becomes a useful debug tool. ON-THE-FLY PIN MAPPING The earlier examples detailed the advantages of “pick-and-place” (or multiplexer-based) flexible pin mapping in software, under preprogrammed MCU conditions. This pin-mapping approach is so flexible that it can be invoked dynamically. Let’s analyze one such example. Unlike a synchronous SPI interface, the UART relies on asynchronous con- nections. These devices need both receive and transmit signals. In low-cost embedded applications, the absence of chip-select signals in UARTs restricts the options designers have in providing communication flexibility. One can find various peripheral devices with a UART interface. If the system has four such peripherals and one MCU, it will need four hardware UART modules on the MCU – even if all UARTs aren’t used simultaneously. This is a common design problem, and there are a few conventional ways to solve it. In the first approach, designers can use a hardware multiplexer chip to time multiplex one hardware UART module to four UART-enabled peripherals. This can be achieved by controlling the external MUX with some MCU I/O lines. In the second approach, designers can implement communication with multiple UART devices by using a large MCU that has four hardware UART modules. This large MCU may be overkill for the application. However, it’s difficult to find a compact, cost-effective MCU with four hardware UART modules. With both examples, we’ll end up with a less than optimal system cost and, most likely, a larger system footprint – either due to external glue logic or a larger MCU package. Once again, multiplexer-based, onthe-fly flexible pin mapping of digital NOVEMBER – DECEMBER 2007 | embedded systems design europe | www.embedded.com/europe 015-016-017-018-019_ESDE.indd 18 6/11/07 13:15:17 http://www.embedded.com/europe
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.