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.

F28M36P63C2: Serial Bootloader

Part Number: F28M36P63C2

Hi all,

I'm trying to develop a bootloader to update my firmware from UART in F28m36. but I'm a beginner and I can't find any comprehensive example on how to do this.

Is there any sample project or tutorial that explains where to start?

Could someone give me a step-by-step guidance? 

Which files should I edit? It is just the .cmd file to divide my flash memory in two regions or I need to edit also the startup_css.c?

Thanks

  • Hi,

    Please see www.ti.com/lit/sprabv4

    This is the serial flash programmer Application Report and describes the functions of the serial flash programmer host PC utility and the SCI flash kernels available for C2000 devices. Unfortunately, we do not have the support for the F28M36, but you can likely still use or modify the SCI flash kernel and the serial flash programmer for your purposes.

    Hope this helps.

    sal
  • Hi Sal,

    Thanks for the material

    I'm using a custom board and I don't have access to the GPIOs for 'Boot Mode Selection'. The board is using this pins for another purpose.

    It is possible to handle this?

    Att.
  • Hi,

    Yes it is. You can keep a flash kernel in your flash, and when you need to perform a device firmware update, you can copy the flash kernel and flash API to RAM and begin to load and re-program the flash image.

    You can keep the kernel in flash, and then your system is signaled for a DFU, you can branch to the kernel from your application.

    sal
  • Hi Sal,

    How is the process to branch for the application?

    How I can handle this branch process in two cores?

    Att.
  • Hi,

    This is something you would have to integrate into your system. For example, suppose the SCI sends a DFU command to the MCU. The MCU software would receive this command and begin the DFU process using something like the flash kernel.

    You can see the F2837xD flash kernels for an example of how to solve this for the dual core device.

    Hope this helps.
    sal
  • Hi Sal,

    When I try to write in flash sector L, I'm getting the error 'Fapi_Error_AsyncIncorrectDataBufferLength'.

    Below is the code I'm using to write.

        // A data buffer of max 16 bytes can be supplied to the program function.
        // Each word is programmed until the whole buffer is programmed or a
        // problem is found.
        // However to program more a buffer that has more than 16 bytes,
        // program function can be called in a loop to program 16 bytes for each
        // loop iteration until the whole buffer is programmed
    
        // When AutoEccGeneration option is used, Flash API calculates ECC for the given
        // 64-bit data and programs it along with the 64-bit main array data.
        // Note that any unprovided data with in a 64-bit data slice
        // will be assumed as 1s for calculating ECC and will be programmed.
    
        for(i=0, u32Index = Bzero_SectorL_start;
           (u32Index < (Bzero_SectorL_start + img->len.u32))
            && (oReturnCheck == Fapi_Status_Success); i+= 16, u32Index+= 16)
        {
            oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index,
                           img->data+i,
                           16,
                           0,
                           0,
                           Fapi_AutoEccGeneration);
    
            while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
    
            if(oReturnCheck != Fapi_Status_Success)
            {
                // Check Flash API documentation for possible errors
                Example_Error(oReturnCheck);
            }
    
            // Read FMSTAT register contents to know the status of FSM after
            // program command to see if there are any program operation related errors
            oFlashStatus = Fapi_getFsmStatus();
            if(oFlashStatus != 0)
            {
                //Check FMSTAT and debug accordingly
                FMSTAT_Fail();
            }
    
            // Verify the values programmed.  The Program step itself does a verify
            // as it goes.  This verify is a 2nd verification that can be done.
            oReturnCheck = Fapi_doVerifyByByte((uint8 *)u32Index,
                           16,
                           img->data+i,
                           &oFlashStatusWord);
    
            if(oReturnCheck != Fapi_Status_Success)
            {
                // Check Flash API documentation for possible errors
                Example_Error(oReturnCheck);
            }
        }

    Maybe, it can be something related to the linker command files. I'm attaching the bootloader and the application .cmd files.

    Can you guide me on debug this issue, please?

    linker_files.zip

  • Hi,

    Can you give some information about img? Is the img size is a mutiple of 16?

    In the linker command file, FLASHLOAD size extended to 0xEDA8 i.e. it includes sector L. But you are trying to program again the sector L? Is it intended?

    If possible please attach the whole project. It will help understand the issue better.

    Thanks,
    Katta

  • Hi, Katta!

    Thanks for you reply.

    Yes, img size is 8624 bytes.

    Yes, I'm trying to erase sector L and I'm getting 'Fapi_Status_success'.

    The whole project is attached.

    flash_programming_m3.zip

  • Hi,

    I checked the implementation.
    Please add the missing steps of Initializing the Flash API (initialize_flash_api()) and setting active flash bank(Fapi_setActiveFlashBank(Fapi_FlashBank0)) before erasing the flash sectors.

    Can you please try making these changes and try again? Please follow the steps as is given in the flash programming example.

    Thanks,
    Katta