This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049C: bootloader hangs on warm start

Part Number: TMS320F280049C

Dear community,

I am currently developing a bootloader for the TMS320F280049C. The bootloader needs to initialise the RAM it uses.
For this purpose I have written the following code

void disable_watchdog()
{
    EALLOW();
    WDKEY = 0x55;
    WDKEY = 0xAA;
    WDCR = 0x68;
    EDIS();
}

static void my_memset(uint16_t *start, uint16_t fill, uint16_t count)
{
    uint16_t *part_ptr = start;
    uint16_t *end = start + count;
    while( part_ptr < end)
    {
//        *part_ptr = fill;
        part_ptr++;
    }
}

#define EBSS_RANGE_BASE   (0x0000A000)
// RAMLS4 + RAMLS5
#define EBSS_RANGE_LENGTH (2*0x000800)

int _system_pre_init()
{
    // disable watchdog
    disable_watchdog();
    // initialize .ebss
    my_memset((uint16_t *) EBSS_RANGE_BASE, 0, (uint16_t) EBSS_RANGE_LENGTH);
    return 1;
}

After a cold start everything works as expected, but after a warm start the bootloader seems to hang. If I attach a debugger it states:

_system_post_cinit() 0x3FC7A5  (an error occurred: failed to parse the previous frame FP)

This problem is clearly related to the runtime length of the memset routine. When I reduce the data length the problem disappears.

I have already looked at the chapter "Device Boot Flow Diagrams" in the "Technical Reference Manual", but I do not understand what is going wrong.

Any advice is very welcome

  • it seems to be completing the execution. Add a while(1) after memset and check if PC reaches there.

    what do you mean by warm start, can you define how it is different from cold start in your case

  • cold start means POR, while warm start is a watchdog reset. The code I use for watchdog reset

    void
    main_reset ( void )
    {
      EALLOW();
      WDKEY = 0x55;
      WDKEY = 0xAA;
      SCSR = 0;    //enable WDRST
      WDCR = 0x28; //enable WD
      EDIS();
      while(1){}
    }

    An unconditional while(1) in memset would also break the POR case. Is it possible to distinguish between POR and wachdog reset to avoid this?

    The reason why I think the bootloader "hangs" is that it seems that none of the other init functions (from boot28.asm) have been called. When I look at the memory area with the debugger, it is completely filled with 0.

  • you mentioned when you reduce the length the problem reduces.

    what is the original length and how much you reduced to ?

  • The original length was 0x800 words. A test with 4 words worked, but I have not tried to determine the limit at which the error occurs.

  • OK, it seems we have found a issue. First of all, the bootloader is not hanging, it is just very, very slow :-) and in the debugger we could see that the 'Missing Clock Status Bit' (MCLKSTS) was indeed set.

    Our assumption is that MCDSCNT is not reset by the watchdog reset and that an overflow occurs due to the extended RAM initialisation.

    Our current solution/workaround is to move the clock system initialisation to the _system_pre_init() function and before the RAM initialisation.