Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
search inside all forums
TWR-K40D100M Continually Resets During Initialization
Brian C. Apr 21, 2014 at 10:29 AM (10:29 hours)
Staff: Takao Y.

  • I have a TWR-K40D100M and a simple program.  I am using P&E GDB Server for Kinetis as my interface between Eclipse and the board for debugging.  The startup code never completes Initialize Data before resetting back to the start of __thumb_startup.  The data to initialize is only 172 bytes.  I have selected the K40DX256M100 for the GDB Server processor.  My ld file memory map looks like this:

    /* Specify the memory areas */
    MEMORY
    {
    m_flash    (rx) : ORIGIN = 0x00000000, LENGTH = 256K
    m_cfmprotrom (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
    m_text    (rx) : ORIGIN = 0x00000800, LENGTH = 256K - 0x800
    m_data    (rwx) : ORIGIN = 0x1FFF8000, LENGTH = 64K   }

    My startup code looks like this:

    __attribute__((naked))
    void __thumb_startup()
    {

    uint32_t *p_src;
    uint32_t *p_dest;
    uint32_t *sbss;

    // Set the stack pointer
    asm("ldr sp,=_estack\n\t");

    // Set pointer values
    p_src = &_sidata;
    p_dest = &_sdata;
    sbss = &_sbss;

    // Initialize data
    while (p_dest != &_edata)
    {
    *(p_dest++) = *(p_src++);
    }

    // Initialize BSS
    while (sbss != &_ebss)
    {
    *(sbss++) = '\0';
    }

    // Initialize hardware
    __init_hardware();

    // Jump to main
    main();

    // Infinite loop (should never get here)
    while (1) {}
    }

    I can provide the GDB Server log for more information.




    Comments

  • Greetings,

    Sounds like the watchdog keeps resetting your chip. Check within your "__init_hardware()" process and see if it unlocks the watchdog. If it does, then it is not being unlocked early enough in your initialization. You should move up your init hardware to the very top.

    If you do not have the watchdog unlock process, read within your chip's reference manual of how you need to use the two unlock word sequences before you can turn the watchdog off.


    Takao Yamada

  • Thank you.  That was the problem.

  • Greetings,

    Do you have any other questions or concerns?


    Takao Yamada

  • All set.  Thanks

Add comment


   Want to comment? Please login or create a new PEMicro account.







© 2018 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement