Hello Jingjing,
May be you created this in processor expert that's why it's working , Here is my code , please can you Debugg it and see r u getting the same result and please don't configure it for it's default value.
Output is on PTC0 and PTC1
int main(void)
{
asm("CPSID i"); // Disable Interrupt
ICS_C1|=ICS_C1_IRCLKEN_MASK; /* Enable the internal reference clock*/
ICS_C3= 0x90; /* Reference clock frequency = 39.0625 KHz*/
while(!(ICS_S & ICS_S_LOCK_MASK)); /* Wait for PLL lock, now running at 40 MHz (1024 * 39.0625Khz) */
ICS_C2|=ICS_C2_BDIV(1) ; /*BDIV=2, Bus clock = 20 MHz*/
ICS_S |= ICS_S_LOCK_MASK ; /* Clear Loss of lock sticky bit */
WDOG_CNT = 0x20C5; // write the 1st unlock word
WDOG_CNT = 0x28D9; // write the 2nd unlock word
WDOG_TOVALL = 10; // 10 x (1 / 1000) = 10 msec but cause of tolerance it's 16msec (Appx. +25 /-35 %)
WDOG_TOVALH = 0; // Always Write the Value for Cortex Controller in LOW & HIGH Byte
WDOG_CS2 = 0x01; // Select clock 1Khz ;
WDOG_CS1 = 0x80; // Enable WDT : Feed the Dog : Activate the Dog
GPIOA_PDDR = 0xF0000;
GPIOA_PDOR = 0x00000;
//Before Configuring PTA0 and PTB3 as Input , must clear them as per Datasheet Table 33-21
GPIOA_PIDR &= ~1 ; // PORT INPUT DATA REGISTER: configure PORTA0 pin as GPIO input, must clear PIDR bit
GPIOA_PIDR &= ~2048 ; // PORT INPUT DATA REGISTER: configure PORTB3 pin as GPIO input, must clear PIDR bit
//Configure PTA0 and PTB3 as Input
GPIOA_PDDR |= 0 << 0 ; // PORT DATA DIRECTION REGISTER: direction is INPUT , PORTA0
GPIOA_PDDR |= 0 << 11; // PORT DATA DIRECTION REGISTER: direction is Input , PORTB3
GPIOA_PDOR = 0x30000;
for(;;){}
}
Thanks & MFG,
Robin