Freescale Semiconductor Mask Set Errata MSE9S08QG8_3M77B Rev. 2, 5/2007 Mask Set Errata for Mask 3M77B Introduction This mask set errata applies to the mask 3M77B for these products: • MC9S08QG8 • MC9S08QG4 MCU Device Mask Set Identification The mask set is identified by a 5-character code consisting of a version number, a letter, two numerical digits, and a letter, for example 3M77B. All standard devices are marked with a mask set number and a date code. Possible High Current in Stop Mode If KBI/IRQ Enabled SE96B-IRQ_KBI Description In stop mode, with the IRQ or KBI pin functions enabled but the IRQ/KBI interrupt disabled, a toggle on the IRQ/KBI pin will turn on the voltage regulator and oscillator, causing the clocks to run. This results in higher stop IDD. In this condition, the CPU is halted (as if in wait mode) and the chip level interrupt is not generated. This higher current condition can also happen if the flag is set at time of stop entry. © Freescale Semiconductor, Inc., 2006, 2007. All rights reserved. Workaround This problem applies to the non-interrupt functions that are shared with IRQ and KBI functions. Because interrupts from IRQ or KBI are disabled, these pins are not used to wake up the MCU from stop. To prevent signals on IRQ or KBI from causing an unexpected partial wakeup from stop in these applications, disable the IRQ and KBI modules just before entering stop mode. Also verify that any previous interrupt flags associated with IRQ and KBI have been cleared. Unexpected Flash Block Protection Errors SE133-FLASH Description If a portion of the nonvolatile memory (NVM) is block protected, unexpected flash block protect violation (FPVIOL) errors can result. These errors can occur during an attempt to program or erase locations in areas of the NVM that are not block protected. Software methods can be used to avoid this potential problem. The problem is more likely to be seen on devices that have multiple nonvolatile blocks, including devices with two or more separate flash blocks or with flash plus EEPROM. If block protection is not enabled, no errors occur. This error is related to logic that compares current block protection settings to an internally latched address. This internal address is written (latched) at reset, at the end of most flash commands, and whenever there is a write to a location in NVM. If a read access to the partially protected NVM is performed immediately before the write to unprotected memory that starts a new flash command, the erroneous address that was previously in the internal latch can cause a false indication of a protection violation. A short sequence of instructions can be performed before starting normal flash commands to ensure that the address in the internal latch is not a protected address. Workarounds The preferred workaround starts a command to a known unprotected address (which internally latches the known-unprotected address), forces an access error to abort that command, and then clears the resulting error flags before starting any new flash command. This workaround assumes the H:X index register points to the location or sector you want to program or erase, and accumulator A has the data value you plan to write to that location. Start your program or erase routine with the following instructions. STA NOP STA PSHA LDA STA PULA STA ,X ,X #$30 FSTAT ,X ;latch the unprotected address from H:X ;brief delay to allow the command state machine to start ;intentionally cause an access error to abort this command ;temporarily save data value ;1’s in PVIOL and ACCERR bit positions ;clear any error flags ;restore data value ;STEP 1 write data to start new command Mask Set Errata for 9S08QG8, Mask 3M77B 2 Freescale Semiconductor The only new instructions compared to the normal routine for flash commands are the first three instructions, which take three bytes of code space and five bus cycles. These instructions may be located anywhere in memory, including in the protected area of the flash memory. ICS V1 Can Cause a Very Short Clock Pulse SE128A-ICSV1 Description The ICS module V1 — when configured with the FLL enabled and with BDIV set to divide-by one — can sometimes produce a very short clock pulse. This short clock pulse can cause the device to malfunction. The short clock pulse is caused when the digitally controlled oscillator (DCO) crosses a filter value boundary when compensating for output frequency error. The filter value is not in the memory map and cannot be read by user code. • When operating from the internal reference clock, certain trim values can cause the error more often. The trim value for any particular clock frequency is unique to each device. • The temperature coefficient of the DCO is such that the unique reference frequency causing the error, either internally or externally generated, will not be constant over temperature. Workarounds • If using FLL enabled with internal reference (FEI) or FLL enabled with external reference (FEE) modes, operate the device with a bus frequency equal to or below 5 MHz. This is accomplished by setting BDIV divide-by value to two or higher (BDIV[1,0] bit field value of 01, 10 or 11). • Use the ICS in any of the modes with the FLL disabled. This includes: FLL bypassed internal (FBI), FLL bypassed internal low power (FBILP), FLL bypassed external (FBI), FLL bypassed external low power (FBELP) modes. (Not all devices have EXTAL and XTAL pins available to run the device with an external reference.) PWM Boundary Case Issues in HCS08 Timer PWM Module (TPM) SE110-TPM This errata describes boundary case issues that primarily affect the center-aligned PWM mode of operation. While investigating these issues, additional, less significant, issues were discovered. These will be explained, although they should not cause any significant problems in normal applications. In center-aligned PWM mode, the timer counter counts up until it reaches the modulo value in TPMMODH:TPMMODL, reverses direction, and then counts down until it reaches zero, where it reverses and counts up again. A period of the PWM output is centered around the leading edge of the zero count and the period is considered to start when the count changes from TPMMODH:TPMMODL–1 to TPMMODH:TPMMODL (the same point where the counter changes from up-counting to down-counting). The zero value and the maximum modulo value occur for only one timer count cycle each, while all other Mask Set Errata for 9S08QG8, Mask 3M77B Freescale Semiconductor 3 values occur twice (once during the down-counting phase and again during the up-counting phase). Therefore, the total period of the PWM signal is two times the value in TPMMODH:TPMMODL. The value on each TPM timer output pin is controlled by an internal flip-flop that is cleared at reset but is not readable by software. These internal flip-flops change state when timer output compare events or PWM duty cycle compare events occur (when the channel value registers match the timer count registers). This leads to these outputs remaining in a previous state until a compare event occurs after changing the configuration of the timer system. When the timer is initialized the first time after a reset, the state of these output flip-flops is known to be reset (logic low). If the configuration is changed after the channel has been running in another configuration for some period of time, you sometimes do not know the state of these internal flip-flops (and therefore the state of the timer output pins) until a new channel value register compare event occurs. There is nothing improper about these periods before the first event occurs, however some users might be surprised the first time they notice this behavior. When the MCU is reset, the count (TPMCNTH:TPMCNTL) is reset to 0x0000. If the timer is configured for center-aligned pulse-width modulation (PWM) and then the clock is started, this corresponds to the middle of a PWM period. If the internal flip-flop corresponding to the output was at the inactive level when the PWM started, this would appear as if there was an extra half period of delay before the first full PWM cycle started. If the internal flip-flop corresponding to the output happened to be at the active level when this PWM was started, a pulse equivalent to half of a normal duty cycle pulse could be produced at the PWM output pin. There are eight cases discussed in this errata: • Cases 1 and 2 — These are two error cases near the 100% duty cycle boundary. The first is when the channel value registers are set equal to the modulo value. The second is when the channel value registers are set to one less than the modulo value. • Cases 3, 4, and 5 — These cases are related to changing the channel value to or from 0x0000. The errors depend upon whether this is done during the first or second half of the center-aligned PWM period. In all of these cases, the workaround strategy is to produce 0% duty cycle with a negative channel value instead of using the 0x0000 value. This can be done by checking any value that is about to be written to the channel value registers, and then decrement the 16-bit value or the high-order byte of the value before writing it to the channel value registers. This produces the desired 0% duty cycle and avoids the problems related to a zero in the channel value registers. • Case 6 — Although this behavior wasn’t discussed in the data sheet, the operation is different than some users might expect. In edge-aligned PWM mode, when the channel value is changed from zero to a non-zero value, the new PWM settings can take an extra half PWM period to take effect. It is unlikely that this would cause any problems in any practical application system. • Case 7 — This case is more of a clarification of an unusual situation rather than a design problem. This case happens when the prescale factor is changed during operation and only affects centeraligned PWM. It would be very unusual to change the prescale setting after it is set during reset initialization. The prescale flip-flops are not reset when the prescale setting is changed, so the first prescaled clock period after a change may be shorter or longer than expected. • Case 8 — This case would only arise when a series of unlikely events happened to occur. It affects only center-aligned PWM mode if the timer counter is stopped, reset, and restarted when the count value happened to be equal to the TPMxMODH:TPMxMODL value. Because the timer counter would not normally be stopped during operation in center-aligned PWM mode, this case should never arise in a practical application. Mask Set Errata for 9S08QG8, Mask 3M77B 4 Freescale Semiconductor Case 1: Center-Aligned PWM Channel Value (TPMxCnVH:TPMxCnVL) = Modulo Value (TPMxMODH:TPMxMODL) Description This should produce 100% duty cycle where the TPM output pin remains at the active level continuously. Instead, the output remains at the inactive level, which corresponds to 0% duty cycle. Workarounds Check any value that is about to be written to the channel value registers. If the value is the same as the modulo value, increment the value before writing it to the channel value register. This workaround will work for any modulo value that is greater than zero and less than 0x7FFF. Setting the channel value to any 2’s complement negative value (0x8000 through 0xFFFF) results in 0% duty cycle as expected and described in the original TPM documentation. Another workaround would be to choose not to use 100% duty cycle in the application. Not all applications require the range to include the 100% duty cycle case. Case 2: Center-Aligned PWM Channel Value (TPMxCnVH:TPMxCnVL) = Modulo Value Minus 1 (TPMxMODH:TPMxMODL – 1) Description This should produce almost 100% duty cycle where the TPM output pin remains at the active level for [(TPMxCnVH:TPMxCnVL × 100)/(TPMxMODH:TPMxMODL)]% of the period. Instead, the output remains at the inactive level which corresponds to 0% duty cycle. Workarounds Reduce the prescale factor by a factor of two and then multiply the modulo and channel value settings by a factor of two. In this way, the frequency and resolution of the PWM output remain the same but channel values are always even numbers and are never equal to the modulo setting minus one. Consider the case of a 20-MHz bus frequency, 25-kHz PWM frequency, and 0.25% resolution on the duty cycle. Before making the adjustments suggested in this workaround, you could have the following setup: Set the modulo to 400 and the prescale factor in PS2:PS1:PS0 to divide by 2 (0:0:1). Each step of the channel value from 0–1–2…398–399–400 would increase the duty cycle by 0.25%. Increasing the modulo value to 800 and reducing the prescale factor to divide-by one, would still produce the same period or PWM frequency. If the original channel values were multiplied by two (shift left one bit position) before writing them to the channel value register, the resolution would still be 0.25% per step of the channel value, but the channel values would step by 2 each time as in 0-2-4-6…796-798-800. With this workaround, the channel value would never be equal to the modulo value minus one, and the error condition would not arise. Mask Set Errata for 9S08QG8, Mask 3M77B Freescale Semiconductor 5 With common HCS08 bus frequencies, practical PWM frequencies, and reasonable resolution requirements, there is enough speed and flexibility in the TPM system so this workaround should work well with all except the most unusual application systems. Another workaround would be to limit the range of allowed values in the channel value register so it does not include the TPMxMODH:TPMxMODL or (TPMxMODH:TPMxMODL – 1) values. Not all applications require the range to include these values. Case 3: Center-Aligned PWM TPMxCnVH:TPMxCnVL Changed from 0x0000 to a Non-Zero Value Description This case occurs only while the counter is counting down (first half of the center-aligned PWM period). The PWM output changes to the active level at the middle of the current PWM period as the count reaches 0x0000 instead of waiting for the start of a new PWM period to begin using the new duty cycle setting. Workaround Use a negative channel value instead of 0x0000 to produce 0% duty cycle. This can be done by checking any value that is about to be written to the channel value registers, and then decrementing the 16-bit value or the high-order byte of this value before writing it to the channel value registers. This produces the desired 0% duty cycle and it avoids the problems related to a zero in the channel value registers. Case 4: Center-Aligned PWM TPMxCnVH:TPMxCnVL Changed from a Non-Zero Value to 0x0000 Description This case occurs only while the counter is counting up (second half of the center-aligned PWM period) but before the count reaches the channel value setting in TPMxCnVH:TPMxCnVL. The PWM output remains at the active level until the end of the current PWM period instead of finishing the current PWM period using the old channel value setting. Workaround Use a negative channel value instead of 0x0000 to produce 0% duty cycle. This can be done by checking any value that is about to be written to the channel value registers, and then decrement the 16-bit value or the high-order byte of this value before writing it to the channel value registers. This produces the desired 0% duty cycle and it avoids the problems related to a zero in the channel value registers. Mask Set Errata for 9S08QG8, Mask 3M77B 6 Freescale Semiconductor Case 5: Center-Aligned PWM TPMxCnVH:TPMxCnVL Changed from 0x0000 to a Non-Zero Value Description This case occurs only while the counter is counting down (first half of the center-aligned PWM period) and then TPMxCnVH:TPMxCnVL is changed back to 0x0000 during the first half of the next PWM period (while the counter is counting down). This is a very unlikely case in any practical application. The PWM output changes to the active level at the middle of the first PWM period as the count reaches 0x0000 instead of waiting for the start of a new PWM period to begin using the new duty cycle setting, and then the output remains active until the end of the second PWM period. In this very unusual case, the PWM output remains active for one and one-half PWM periods rather than remaining inactive for the first PWM period and then active for 2 × TPMxCnVH:TPMxCnVL during the next PWM period. Workaround Use a negative channel value instead of 0x0000 to produce 0% duty cycle. This can be done by checking any value that is about to be written to the channel value registers, and then decrementing the 16-bit value or the high-order byte of this value before writing it to the channel value registers. This produces the desired 0% duty cycle and it avoids the problems related to a zero in the channel value registers. Case 6: Edge-Aligned PWM TPMxCnVH:TPMxCnVL Changed from 0x0000 to a Non-Zero Value Description This is a minor issue related to edge-aligned PWM when duty cycle is changed from 0x0000 to a nonzero value. This issue is a specification clarification rather than a design error. In this case, the channel value update occurs at the same time as the new PWM period begins, but due to circuit delays, the update occurs slightly too late for the new duty cycle to take effect for that PWM period and an extra period of 0% duty cycle is produced. This causes the new PWM duty cycle to take effect one PWM period later than expected. This should not cause any application problems so the data book functional description will be changed to clarify this situation. Case 7: Changing the Counter Prescaler while the TPM Counter Is Disabled Description This case would not arise in most applications because it would be unusual to change the prescaler at any time other than initial timer setup after reset. 1. TPM counter was previously running 2. Counting is stopped by writing 0:0 to CLKS[1:0] 3. Change prescale value PS[2:1:0] to a different value while keeping clocks off (CLKS[1:0] = 0:0) 4. Clear the counter by writing any value to TPMxCNTH:TPMxCNTL Mask Set Errata for 9S08QG8, Mask 3M77B Freescale Semiconductor 7 5. Turn clocks back on by writing to CLKS[1:0] Unexpected Operation: The prescaler divider flip-flops begin counting from the prior value rather than starting from zero. This can result in the counter detecting the first clock edge after restarting, either earlier or later than expected. Case 8: Center-Aligned PWM, Counter is Stopped, Reset, and Restarted when Counting Up and Count Equals the Modulo Value Description This case is extremely unlikely to occur in any practical application because it would be very unusual to stop or reset the TPM counter while using center-aligned PWM mode. 1. TPM counter is counting up in center-aligned PWM mode (second half of a PWM period) 2. Counter is stopped (write CLKS[1:0] = 0:0) when count equals modulo value (the direction would normally change from up counting to down counting at the next clock edge) 3. Counter is reset to 0x0000 by writing any value to TPMxCNTH:TPMxCNTL 4. Counter is turned on again by writing to CLKS[1:0] Unexpected Operation: Because the internal up/down indicator was not cleared when the counter was reset, the counter begins counting down from 0x0000 to 0xFFFF–0xFFFE… This causes the timing of the first PWM period after the counter reset to be longer than expected. Mask Set Errata for 9S08QG8, Mask 3M77B 8 Freescale Semiconductor