[Design View / Design Solution]
Add Modular Plug-In Functionality To Any Embedded Design
By taking advantage of the latest 16-bit MCUs that offer flexible I/O pin mapping, designers can conceive efficient embedded designs by taking the modular plug-in approach.
BENEFITS OF FLEXIBLE I/O Flexible I/O remapping offers a number of other benefits beyond the previously mentioned multiplexing options. There are times when the vendor-defined pinout is sub-optimal for particular board layouts.
Take the example of an SD card slot that must be located at one end of the enclosure. This scenario demands the presence of an SPI channel and I/O pins on the same side of the MCU. If not, the trace routing on the PCB will be complicated. With flexible pin mapping, the MCU pinout can be defined to simplify PCB routing—possibly eliminating the need for a multilayer PCB and reducing system cost.
Designers can make creative use of flexible-pin-mapping features. For example, a debug tool can be conceived, based on flexible pin mapping. Routing the same signal to many peripherals makes it possible to insert software patches for debugging application code. By mapping an interrupt or input capture function onto a communication channel, bus communication can be monitored for specific events, such as glitches.
TOOLS ASSIST IN FLEXIBLE I/O MAPPING MCUs with flexible pin mapping have no default pinouts for the peripherals. Therefore, the firmware creator needs to initialize the pinouts to access the peripherals. In the case of multiplexerbased flexible pin mapping, after poweron reset, the pin-mapping function has its outputs disconnected and inputs mapped to a default register. To access any of the peripherals, the flexible-pinmapping registers must be initialized. Tools such as a Visual Device Initializer (VDI) help you initialize the peripherals and other MCU features.
For example, double-clicking the flexible- pin-mapping icon in Microchip’s VDI tool opens a drop-down window, which enables the designer to quickly set up the desired peripheral function and its corresponding pin(s) (Fig. 4). Besides assisting in the initialization of flexible pin mapping, the same VDI can help you initialize all of the MCU’s peripherals. After the pin assignment on the MCU is completed and peripherals initialized, the VDI will generate the necessary initialization code. Furthermore, a VDI can also be used to generate a resource usage report to supplement your design documentation.
When defining the required peripherals and their pin assignments, remember to assign the pins to the fixed analog and digital functions at the outset— many times, not all functions are remappable. Analog functions and some large peripherals, such as the parallel port, usually will contain fixed I/O lines. Therefore, you should utilize the fixed pins as the base of the bus and map the necessary serial functions onto these pins when needed.
CONCLUSION Embedded designs with plug-in functionality require a flexible I/O interface. In the past, these applications required a larger MCU package to be able to access the exact peripheral set on an MCU. Or, they had to resort to extra multiplexing devices. When both of these approaches failed, designers had to recreate the peripheral function in software. These workarounds ultimately increased design costs and development time.
Software-based flexible I/O pin mapping is the answer to this vexing design issue. It gives designers access to the exact peripheral set they need on an microcontroller. With these softwarebased, flexible-pin-mapping features, a designer will be able to utilize a smaller, cheaper microcontroller in a compact package to design efficient, modular plug-in embedded systems at economical costs.