This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

reset

I am using uVision4 and have an LPC2103.
After each reset the module desn't start directly (after 2 or 3 attempt) can you help me.

Parents
  • I do not think it's a reset problem.
    For example:
    electroblogs.weebly.com/.../8478695_orig.png

    I am beginner in programming in Keil and I want to know if there is a problem with code (main.c or startup) or at target.

    int main()
    {
    PLL_Init();
    PINSEL0=0x00000005;
    PINSEL1=0x00000000;
    IO0DIR = 0xFFFFBFFD;
    UART0_init();
    IO0SET |= (1<<13);
    IO0SET |= (1<<17);
    IO0SET |= (1<<21);
    
    while(1)
    {
    /*
    code
    */
    }
    

    void PLL_Init(void)
    {
    #ifdef __DEBUG_RAM
        MEMMAP = 0x2;
    #endif
    
    #ifdef __DEBUG_FLASH
        MEMMAP = 0x1;
    #endif
    
    #ifdef __IN_CHIP
        MEMMAP = 0x1;
    #endif
    
    
        PLLCON = 1;
    #if (Fpclk / (Fcclk / 4)) == 1
        VPBDIV = 0;
    #endif
    #if (Fpclk / (Fcclk / 4)) == 2
        VPBDIV = 2;
    #endif
    #if (Fpclk / (Fcclk / 4)) == 4
        VPBDIV = 1;
    #endif
    
    #if (Fcco / Fcclk) == 2
        PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
    #endif
    #if (Fcco / Fcclk) == 4
        PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
    #endif
    #if (Fcco / Fcclk) == 8
        PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
    #endif
    #if (Fcco / Fcclk) == 16
        PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
    #endif
    
    
        PLLFEED = 0xaa;
        PLLFEED = 0x55;
        while((PLLSTAT & (1 << 10)) == 0);
        PLLCON = 3;
        PLLFEED = 0xaa;
        PLLFEED = 0x55;
    
    
            VICIntEnClr = 0xffffffff;
            VICVectAddr = 0;
            VICIntSelect = 0;
            }
    
    

Reply
  • I do not think it's a reset problem.
    For example:
    electroblogs.weebly.com/.../8478695_orig.png

    I am beginner in programming in Keil and I want to know if there is a problem with code (main.c or startup) or at target.

    int main()
    {
    PLL_Init();
    PINSEL0=0x00000005;
    PINSEL1=0x00000000;
    IO0DIR = 0xFFFFBFFD;
    UART0_init();
    IO0SET |= (1<<13);
    IO0SET |= (1<<17);
    IO0SET |= (1<<21);
    
    while(1)
    {
    /*
    code
    */
    }
    

    void PLL_Init(void)
    {
    #ifdef __DEBUG_RAM
        MEMMAP = 0x2;
    #endif
    
    #ifdef __DEBUG_FLASH
        MEMMAP = 0x1;
    #endif
    
    #ifdef __IN_CHIP
        MEMMAP = 0x1;
    #endif
    
    
        PLLCON = 1;
    #if (Fpclk / (Fcclk / 4)) == 1
        VPBDIV = 0;
    #endif
    #if (Fpclk / (Fcclk / 4)) == 2
        VPBDIV = 2;
    #endif
    #if (Fpclk / (Fcclk / 4)) == 4
        VPBDIV = 1;
    #endif
    
    #if (Fcco / Fcclk) == 2
        PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
    #endif
    #if (Fcco / Fcclk) == 4
        PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
    #endif
    #if (Fcco / Fcclk) == 8
        PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
    #endif
    #if (Fcco / Fcclk) == 16
        PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
    #endif
    
    
        PLLFEED = 0xaa;
        PLLFEED = 0x55;
        while((PLLSTAT & (1 << 10)) == 0);
        PLLCON = 3;
        PLLFEED = 0xaa;
        PLLFEED = 0x55;
    
    
            VICIntEnClr = 0xffffffff;
            VICVectAddr = 0;
            VICIntSelect = 0;
            }
    
    

Children
No data