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

Help me about a delay in MCU startup

Hi
I have made a header board for STM32L152VD after every restart it takes few seconds for the board to start running. I use HSI clock. what do you think the problem is?

Parents
  • -> after power on, the LED starts flashing rapidly for few seconds (between 2 to 10 seconds) then LED becomes steadily on.

    I encountered similar problem before.

    The LCD of our device shares the same pins with a FT240X USB Chip, our device has a Lithium battery and a USB charging circuit. I encountered similar problem as you, so I discuss this problem with my hardware colleague, he did a full hardware analysis, and told me that this hardware needs a few seconds to become stable after power on. Since hardware can't be modified, he asked me to do a Sleep_Mode_IO_Config() immediately after power on, then wait for a while, then start to do the Runtime_IO_Config() and the real work. After this software modification, the problem doesn't disappear, but under our control.

    Sleep_Mode_IO_Config(): He checked and decided each GPIO pins should be configured as In or Out, if it is an output pin, it should be high or low.

    int main(void)
    {
        int i;
        static uint8_t Wait_PC_Connect = 1;
    
        LPC_SYSCON->PDRUNCFG |= (1u<<3);    /* Set BOD Power-Down bit */
        GPIO_OutInit();
        Enable_Timer32B0();
    
        Sleep_Mode_IO_Config();
        delay_in_ms(50);
        GPIOSetValue( LPC_GPIO0, 7, 1 );    // En_OP_Power - ON
        Blink_Delay(8);
        Runtime_IO_Config();
    
        ADC_Init();
        SSP_Init();
        I2C_Init( LPC_I2C, 400000 );
        UART_Init(115200);
    
        delay_in_ms(10);
        LCD_Init();
        delay_in_ms(10);
        GPIOSetValue( LPC_GPIO2, 10, 1 );    // LCD_BKL - ON
    

Reply
  • -> after power on, the LED starts flashing rapidly for few seconds (between 2 to 10 seconds) then LED becomes steadily on.

    I encountered similar problem before.

    The LCD of our device shares the same pins with a FT240X USB Chip, our device has a Lithium battery and a USB charging circuit. I encountered similar problem as you, so I discuss this problem with my hardware colleague, he did a full hardware analysis, and told me that this hardware needs a few seconds to become stable after power on. Since hardware can't be modified, he asked me to do a Sleep_Mode_IO_Config() immediately after power on, then wait for a while, then start to do the Runtime_IO_Config() and the real work. After this software modification, the problem doesn't disappear, but under our control.

    Sleep_Mode_IO_Config(): He checked and decided each GPIO pins should be configured as In or Out, if it is an output pin, it should be high or low.

    int main(void)
    {
        int i;
        static uint8_t Wait_PC_Connect = 1;
    
        LPC_SYSCON->PDRUNCFG |= (1u<<3);    /* Set BOD Power-Down bit */
        GPIO_OutInit();
        Enable_Timer32B0();
    
        Sleep_Mode_IO_Config();
        delay_in_ms(50);
        GPIOSetValue( LPC_GPIO0, 7, 1 );    // En_OP_Power - ON
        Blink_Delay(8);
        Runtime_IO_Config();
    
        ADC_Init();
        SSP_Init();
        I2C_Init( LPC_I2C, 400000 );
        UART_Init(115200);
    
        delay_in_ms(10);
        LCD_Init();
        delay_in_ms(10);
        GPIOSetValue( LPC_GPIO2, 10, 1 );    // LCD_BKL - ON
    

Children