Finding Use for Background Debug
By Bill Reddy Director of Hardware Engineering JS Tronix Inc, Phoenix
Embedded systems that use highly integrated 16- and 32-bit microcontrollers such as Motorola's 683XX 32-bit CPU family and 68HC16 16-bit MCU series are often faced with a delima. On the one hand, they must design a product at the lowest possible hardware cost; on the other, they must also keep software development costs to a minimum.
But the highly integrated nature of such devices, housing peripheral functions that were previously done on separate ICs, reduces the overall component cost of a design. The fact that such functions are now not as easily available to the designer for debugging purposes increases software costs. As a result, many vendors have chosen to incorporate debug features on-chip, giving the designer access to the inner workings of a design. But that additional capability also increases chip cost, leading many designers to pause before committing themselves to a capability that may be used only once or twice during the early stages of a product's development.
For example, both the 683XX family and the 68HC16 include a unique debug and development port called the Background Debug Mode (BDM). The BDM is a specialized high-speed synchronous serial interface that allows designers to use low-cost, yet powerful, development tools without removing the processor from the system or requiring any target resources for the debug software.
Though designers of embedded systems find the BDM interface to be a valuable tool for system development and debugging, they are looking for other ways to justify the additional cost of such on-chip capabilities by using the interface in a wide range of post-production and unique applications, including real-time testing of computing engines, real-time data collection and as a way of programming on-chip flash memory.
Full Debug
The BDM is a specialized high-speed synchronous serial interface that allows designers to use low-cost yet powerful development tools without removing the processor from the system or requiring any target resources for the debug software. Because the BDM contains a full set of debug functions residing in on-chip mirocode, no monitor code is needed; unlike pod emulation, system debugging can be performed even when address and data lines malfunction. During background debug mode, normal instruction execution is suspended and the internal microcode performs the debugging functions under external control.
The BDM interface is supported by many third-party emulators, eliminating the need for expensive pods and allowing in-circuit emulation with the target MCU itself. However, advanced debugging techniques such as trace cannot be realized with the BDM interface. As a result, high-end emulators such as the EMUL68 by the Nohau Corp. support both pod and BDM interfaces. Fortunately, Motorola defined and standardized a 10-pin dual-row header for the BDM interface so all that is needed to access it is a small header on the controller board. This standardization forced development tools to be compatible and at the same time significantly lowered basic emulation costs.
The 10-pin connector opens the system to powerful debug and analysis capabilities as well as other unique applications. The BDM port is a surprisingly versatile and powerful interface for system designers and is a focal point for many unique applications and products.
At JS Tronix, 683XX-based products exploit the BDM interface throughout all phases of development and production. Combined with flash memory, the BDM provides a flexible format in the early stages of development - from low level drivers to final software releases and even into production. During production, board - and system-level tests take less time and are more configurable since it is not necessary for the diagnostic code to be part of the target system's code. The BDM also provides a gateway to a variety of post-production and in-field applications.
Real-time work
One rather demanding use for the BDM has been in real-time testing applications in which the tests being conducted are continually and immediately being modified by the test results and sensor inputs. Engine testing with interactive software tuning is one such application that makes use of the BDM's high data rate. During active testing, memory updates as quick as 9 us allows switching among parameter tables, data tables or software algorithms while operating in real-time.
Real-time data collection is another area in which the BDM offers distinct advantages. The BDM can transfer data at a 4-Mbaud rate, which exceeds traditional methods like RS-232 audit requires no additional target hardware or software.
As more and more embedded system designs incorporate flash memory, a method for programing target flash has become paramount. Systems that are 683XX-based can use the BDM for just that. JS Tronix developed the BDM-based flash loader - originally designed to accommodate in-house needs - to allow a target's flash to be read, merged, programmed and verified.
Check out our Flash Programmer!