谢谢,解决了我把相关内容贴在下面:
EXTINT.1 Corruption of VPBDIV via EXTPOLAR or EXTMODE
Introduction: The VPBDIV register controls the rate of the VPB clock in relation to the processor clock.
EXTPOLAR and EXTMODE determine the operating parameters of the external interrupts.
Problem: A write to either the external interrupt polarity register (EXTPOLAR) or the external interrupt mode
register (EXTMODE) will corrupt the VPBDIV register. A read of either EXTPOLAR or EXTMODE
will be corrupted BY the VPBDIV register. If VPBDIV is “1” or “2” prior to any write to EXTPOLAR
or EXTMODE, the CPU will hang up on the write to EXTPOLAR or EXTMODE.
Work-around: If VPBDIV is non-zero, write all zeroes to VPBDIV before reading or writing EXTMODE or
EXTPOLAR, then write the proper value back to VPBDIV. In most applications this is a known and
fixed value, but if there is a possibility of dynamic changes in VPBDIV, software will need to read
VPBDIV, write zero to VPBDIV, read or write EXTMODE and/or EXTPOLAR, and then rewrite the
value previously read from VPBDIV.
EXTINT.2 Incorrect setting of EXTMODE and/or EXTPOLAR register while trying to set them to desired
value
Introduction: EXTPOLAR and EXTMODE determine the operating parameters of the external interrupts.
Problem: As an illustration, trying to set EXTMODE to 0x1 or 0xd would result in EXTMODE to be set to 0x0
instead.
Work-around: This problem is related to EXTINT.1 and hence the same workaround applies with an additional
step.
The steps involved in the configuration of the EXTMODE and/or EXTPOLAR would be as follow:-
1. Write 0x0 to VPBDIV
2. Write the desired value to EXTMODE or EXTPOLAR register
3. Write the same value to VPBDIV (additional step)
4. Restore the VPBDIV to the previously saved value or simply write to the register again with the
desired value.
Code sample for setting EXTMODE and EXTPOLAR to 0x1:
VPBDIV = 0x0; /* EXTMODE */
EXTMODE = 0x1;
VPBDIV = 0x1;
VPBDIV = 0x0; /* EXTPOLAR */
EXTPOLAR = 0x1;
VPBDIV = 0x1;
VPBDIV = 0x0; /* Setting VPBDIV */
Note: While testing this in a debugger environment, please don’t single-step through these steps. A
breakpoint could be placed after Step 4 andyou would see the EXTMODE and EXTPOLAR
registers reflecting the correct values.
|