circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

May 2006, Issue 190

Mobile Phone Book
M16C/62P-Based Data Backup System
Renesas M16C 2005 Honorable Mention


HARDWARE & SOFTWARE

The Mobile Phone Book uses all of the M16C/62P demonstration board’s resources. I built an expansion board for the RS-232 channel communication and the SIM smart card interface (see Photo 2, p. 14). The RS-232 interface is built around the MAX232 level shifter. I wired it in accordance with the manufacturer’s specifications.

(Click here to enlarge)

Photo 2—The expansion board features a SIM connector, serial capability, and a header connector. The hardware for dealing with the SIM smart card is simple because all the complexity has been moved to the software side.

The SIM smart card interface is a special socket for interfacing the SIM to the M16C/62P’s UART2 (see Figure 2, p. 15). You can implement the interface with just two microcontroller pins. One pin handles the RST signal. The other pin drives the I/O signal. In this minimal configuration, the VCC, GND, and CLK signals are always active.

(Click here to enlarge)

Figure 2—I connected the expansion board to the Renesas M16C/62P demonstration board with off-the-shelf components. Thanks to the 10-kW pull-up resistor, I converted a full-duplex protocol to half duplex.

The I/O signal can be driven to configure the UART2 as an asynchronous serial protocol using 1 stop bit, 8 data bits (least significant bit first), even parity, and 2 stop bits, running at 9,600 bps when the external clock applied to the SIM card through its clock signal CLK is 3.57 MHz. For simplicity, the error detection and character repetition procedure isn’t implemented.

UART2 is a full-duplex peripheral with separated reception (TxR2) and transmission (TxD2) lines. On the other, the SIM works as a half-duplex device with just one I/O line for I/O data. Therefore, you need a hardware translation mechanism. Simply join the TxD2 and RxD2 signals through a 10-kW pull-up resistor. This will enable the UART2 and the SIM to talk to each other via a standard asynchronous protocol.

The software is the key to this project. I developed all of the software in a modular way in C language, so maintaining and improving the software is simple. Table 1 includes brief descriptions of each module. Figure 3 shows the module hierarchy.

(Click here to enlarge)

Figure 3—The module hierarchy in the software design is fairly simple. There are different layers of complexity. Each microcontroller peripheral has its own driver in a separate source file.