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.

TM4C1294NCPDT: Endless loop in boot.asm

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: TM4C1294KCPDT,

Hi,

I'm working on a project and It's getting stuck in boot.asm 

I'm not able to track why this is happening and where it is coming from. Is there a way to get that info or anyone have any idea about this?

Its a non-RTOS project.

This is where it's getting stuck

NVIC_FAULT_STATUS value is 0x00000000

Can anyone help me resolve this?

Thanks.

-Deepak

  • Hi Deepak,

      Not sure what the problem is yet. I have a few questions and some suggestions.

      1. What program do you have in the flash? Do you remember if the problem occurred after you loaded a new program?

      2. Did the program ever run to the main()? 

      3. If you have another board, can you try the same program on it? Can you repeat the same problem on the different board?

      4. Can you repeat the same problem if you load another program. Please try a simple program like the "Hello" or "Blinky" example. 

     

  • Hi Charles,

    I figured out from where I'm getting into that state.I'm using a function called FlashPBSave.


    I didn't make any changes to this function. This was working fine for TM4C1294KCPDT.

    Can this be related to ,y controller change to TM4C1294NCPDT?

    this is the function

    void
    FlashPBSave(uint8_t *pui8Buffer)
    {
    uint8_t *pui8New;
    uint32_t ui32Idx, ui32Sum;

    //
    // Check the arguments.
    //
    ASSERT(pui8Buffer != (void *)0);

    //
    // See if there is a valid parameter block in flash.
    //
    if(g_pui8FlashPBCurrent)
    {
    //
    // Set the sequence number to one greater than the most recent
    // parameter block.
    //
    pui8Buffer[0] = g_pui8FlashPBCurrent[0] + 1;

    //
    // Try to write the new parameter block immediately after the most
    // recent parameter block.
    //
    pui8New = g_pui8FlashPBCurrent + g_ui32FlashPBSize;
    if(pui8New == g_pui8FlashPBEnd)
    {
    pui8New = g_pui8FlashPBStart;
    }
    }
    else
    {
    //
    // There is not a valid parameter block in flash, so set the sequence
    // number of this parameter block to zero.
    //
    pui8Buffer[0] = 0;

    //
    // Try to write the new parameter block at the beginning of the flash
    // space for parameter blocks.
    //
    pui8New = g_pui8FlashPBStart;
    }

    //
    // Compute the checksum of the parameter block to be written.
    //
    for(ui32Idx = 0, ui32Sum = 0; ui32Idx < g_ui32FlashPBSize; ui32Idx++)
    {
    ui32Sum -= pui8Buffer[ui32Idx];
    }

    //
    // Store the checksum into the parameter block.
    //
    pui8Buffer[1] += ui32Sum;

    //
    // Look for a location to store this parameter block. This infinite loop
    // will be explicitly broken out of when a valid location is found.
    //
    while(1)
    {
    //
    // See if this location is at the start of an erase block.
    //
    if(((uint32_t)pui8New & (FLASH_SECTOR_SIZE - 1)) == 0)
    {
    //
    // Erase this block of the flash. This does not assume that the
    // erase succeeded in case this block of the flash has become bad
    // through too much use. Given the extremely low frequency that
    // the parameter blocks are written, this will likely never fail.
    // But, that assumption is not made in order to be safe.
    //
    MAP_FlashErase((uint32_t)pui8New);
    }

    //
    // Loop through this portion of flash to see if is all ones (in other
    // words, it is an erased portion of flash).
    //
    for(ui32Idx = 0; ui32Idx < g_ui32FlashPBSize; ui32Idx++)
    {
    if(pui8New[ui32Idx] != 0xff)
    {
    break;
    }
    }

    //
    // If all bytes in this portion of flash are ones, then break out of
    // the loop since this is a good location for storing the parameter
    // block.
    //
    if(ui32Idx == g_ui32FlashPBSize)
    {
    break;
    }

    //
    // Increment to the next parameter block location.
    //
    pui8New += g_ui32FlashPBSize;
    if(pui8New == g_pui8FlashPBEnd)
    {
    pui8New = g_pui8FlashPBStart;
    }

    //
    // If every possible location has been checked and none are valid, then
    // it will not be possible to write this parameter block. Simply
    // return without writing it.
    //
    if((g_pui8FlashPBCurrent && (pui8New == g_pui8FlashPBCurrent)) ||
    (!g_pui8FlashPBCurrent && (pui8New == g_pui8FlashPBStart)))
    {
    return;
    }
    }

    //
    // Write this parameter block to flash.
    //
    MAP_FlashProgram((uint32_t *)pui8Buffer, (uint32_t)pui8New,
    g_ui32FlashPBSize);

    //
    // Compare the parameter block data to the data that should now be in
    // flash. Return if any of the data does not compare, leaving the previous
    // parameter block in flash as the most recent (since the current parameter
    // block failed to properly program).
    //
    for(ui32Idx = 0; ui32Idx < g_ui32FlashPBSize; ui32Idx++)
    {
    if(pui8New[ui32Idx] != pui8Buffer[ui32Idx])
    {
    return;
    }
    }

    //
    // The new parameter block becomes the most recent parameter block.
    //
    g_pui8FlashPBCurrent = pui8New;
    }

    Regards,

    Deepak

  • Hi,

      First of all, you didn't answer any of my questions. As far as between the two different parts, I don't think it should affect how the FlashPBSave worrks. The reason is that the 1294NCPDT actually has 1Mbyte of flash compared to 512kB as in 1294KCPDT. I may be able to understand if it works on 1294NCPDT but not 1294KCPDT but this is not your case. 

  • Hi Charles,

    I did reply but I think it wasn't posted correctly. Here are the answers, 

    1. The program that I have is for a custom board. The problem started when I made changes in my code and flashed the code.

    2. My Program runs completely fine for almost 12Hrs as at 8 AM and 8 PM I'm usingFlashPBSave and that's when I see this issue.

    3. Currently, I have only 1 board. I'll be getting few more boards by Monday. I can't test on a different board before that.

    4. I tried to revert back to the old code which was working fine. I see the same issue in that code as well. Can this be related to a bad memory?

    Sometimes I'm also getting this error (in image)

    Can this be related?

    Regards,

    Deepak

  • Hi,

      Do you know within 12 hours, how many times did you call usingFlashPBSave to store a new parameter? Bear in mind that you are writing to the flash memory. There is only a limited number of write cycles for the flash memory. If you go beyond the number of cycles specified then the flash memory may be damaged. 

  • Hi Charles,

    Thank you for your help. I figured out that my compiler version had changed and that was the reason for this issue.

    Regards,

    Deepak