Chapter 2 Port Integration Module (S12ZVHYPIMV1)
S12ZVHY/S12ZVHL Family Reference Manual Rev. 1.05
Freescale Semiconductor
113
2.5
Initialization and Application Information
2.5.1
Port Data and Data Direction Register writes
It is not recommended to write PORTx/PTx and DDRx in a word access. When changing the register pins
from inputs to outputs, the data may have extra transitions during the write access. Initialize the port data
register before enabling the outputs.
2.5.2
SCI0,1 Baud Rate Detection
The baud rate for SCI0 and SCI1 is achieved by using a timer channel to measure the data rate on the RXD
pin.
1. Establish the link:
— For SCI0: Set [T1IC0RR1:T1IC0RR0]=0b10 to disconnect IOC0 from TIM1 input capture
channel 0 and reroute the timer input from the RXD0 of SCI0.
— For SCI1: Set [T1IC0RR1:T1IC0RR0]=0b11 to disconnect IOC0 from TIM1 input capture
channel 0 and reroute the timer input from the RXD1 of SCI1.
2. Determine pulse width of incoming data: Configure TIM1 IC0 to measure time between incoming
signal edges.
2.5.3
RTC on chip calibration
The on chip RTC calibration used the TIM1 IC0 and IC1 channel.
1. Establish the link:
— Set the RTC configuration to generate the expect CALCLK frequency
— Set [T1IC0RR1:T1IC0RR0]=0b10 to disconnect IOC0 from TIM1 input capture channel 0 and
reroute the RTC CALCLK to IC0.
— Input a standard clock on RTC_CAL pin
2. Determine pulse width of incoming data: Configure TIM1 IC0 and IC1 to measure time between
incoming signal edges. Need to pay attention to timer overflow also.
3. Compare the data between IC0 and IC1 to get the RTC clock frequency value. Suppose the
RTC_CAL measure value is B, and CALCLK measure value is A. Then the CALCLK frequency
will be between f
RTC_CAL
* (B-2) / (A+2) and f
RTC_CAL
* (B+2) / (A-2). Depend on the
calibration, user need to select the RTC_CAL, CALCLK and TIM1 frequency.
2.5.4
RTC off chip calibration
The off chip RTC calibration, user need to set the CALCLKEN bit in the PIMMIC register to enable the
CALCLK out on RTC_CAL pin. Base on the external requirement, user can set the RTCMOD and CALS
bit in RTCCTL3 registers to get the expected CALCLK output on RTC_CAL pin.