SPRAD51A December   2023  – April 2024 TMS320F2800157 , TMS320F280039 , TMS320F280039-Q1 , TMS320F280039C , TMS320F280039C-Q1 , TMS320F28P659DK-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Programming Fundamentals
  6. 3ROM Bootloader and Hex Utility Usage
  7. 4DCAN Flash Kernel
    1. 4.1 Implementation
      1. 4.1.1 Custom Flash Bank and Sector Erase
      2. 4.1.2 Application Load
  8. 5MCAN Flash Kernel
    1. 5.1 Implementation
      1. 5.1.1 Custom Flash Bank and Sector Erase
      2. 5.1.2 Application Load
  9. 6Example Implementation
    1. 6.1 Device Setup
      1. 6.1.1 Flash Kernels
      2. 6.1.2 Hardware
    2. 6.2 Host Application: dcan_flash_programmer
      1. 6.2.1 Overview
      2. 6.2.2 Building and Running dcan_flash_programmer Using Visual Studio
      3. 6.2.3 Running dcan_flash_programmer for F28003x
      4. 6.2.4 Using the Project With DCAN Bootloader
      5. 6.2.5 Using the Project With CCS
    3. 6.3 Host Application: can_flash_programmer [MCAN]
      1. 6.3.1 Overview
      2. 6.3.2 Building and Running can_flash_programmer Using Visual Studio
      3. 6.3.3 Running can_flash_programmer for F28003x
      4. 6.3.4 Using the Project With MCAN Bootloader
      5. 6.3.5 Using the Project With CCS
    4. 6.4 Application Load: CPU2 Image
      1. 6.4.1 Combining Two Images (.txt)
  10. 7Troubleshooting
    1. 7.1 General
    2. 7.2 DCAN Boot
    3. 7.3 MCAN Boot
  11. 8References
  12. 9Revision History

Custom Flash Bank and Sector Erase

The F280015x and F28P65x (both the 128-bit and 512-bit programming projects) DCAN flash kernels allow the user to specify which flash banks and flash sectors should be erased before the application is loaded to flash. This section will discuss how it is implemented for the F28P65x device, but the F280015x implementation is very similar.

Within the flash_kernel_ex5_can_flash_kernel.c file, there are four 32-bit unsigned integer arrays that control the flash banks and sectors erased by the kernel.

    uint32_t Application_Flash_Banks[5] = {0,1,2,3,4};
    uint32_t WE_Protection_A_Masks[5] = {0,0,0,0,0};
    uint32_t WE_Protection_B_Masks[5] = {0,0,0,0,0};
    uint32_t WE_Protection_OTP_Masks[5] = {0,0,0,0,0};

Within Application_Flash_Banks, the flash bank numbers should be entered. Within WE_Protection_A_Masks, the Write/Erase Protection Masks corresponding the sectors 0-31 for each bank in Application_Flash_Banks should be entered. As shown above, flash sectors 0-31 of each bank will be erased. Within WE_Protection_B_Masks, the Write/Erase Protection Masks corresponding the sectors 32-127 for each bank in Application_Flash_Banks should be entered. As shown, flash sectors 32-127 will be erased in each bank. For more information about these masks, see the device-specific Flash API Guide. Similarly, WE_Protection_OTP_Masks should be filled with the desired masks for each bank's OTP. Note that configuring this array will not result in OTP being erased, but rather enable the device to program a flash bank's OTP during the application load.

Additionally, WE_Protection_A_Masks and WE_Protection_B_Masks is used when programming the application to flash. The proper masks are determined based on the target address of the data being programmed.

Once these arrays are configured as desired, recompile the flash kernel and generate the new kernel image.