TRAVEO™: Accessing work flash in TRAVEO™ T2G devices
1 Work flash memory
Work flash is a flash memory used to store data, and is a part of the eCT flash, which is an embedded flash targeted for use in automotive applications. All sectors in the work flash are assigned as work region, which is the memory field to store the data.
See the device Architecture TRM for more details on work flash geometry, configurations, and features.
1.1 Programming the work flash
Work flash can be erased and programmed using special system services like EraseSector, ProgramRow, and ProgramWorkFlash. See the “Non-volatile Memory Programming” section in the device Architecture TRM for details on these system services. Note the following points:
- Work flash word can be reprogrammed only when it is in the erased state.
- Before programming or erasing the work flash, ensure that the “WorkFlashWriteEnable” bit in the FLASHC_WORK_FLASH_SAFETY register is set to ‘1’.
- It is highly recommended that the WORK_ECC_EN bit in FLASHC_FLASH_CTL register is set to ‘1’ before targeting any work flash programming.
1.2 Reading the work flash
The contents of the work flash are uncertain immediately after an erase operation. When the contents of an erased work flash are read, an ECC error occurs; in addition, a hard fault exception also occurs if FLASHC_FLASH_CTL. WORK_ERR_SILENT is ‘0’.
Therefore, work flash should be read by a master (CPU or DMA) only after it has been programmed. To determine whether the work flash is in erased state, use the BlankCheck special system service. BlankCheck does not trigger any ECC errors when the contents are erased.
If you are not sure if the work flash is programmed or erased, first perform a BlankCheck and proceed with reading the work flash only if the area is not blank.
Also note that in CM7-based devices, reading 32 bits of work flash via CM7_0/1 or other AXI master and adjacent 32 bits of work flash when not initialized can result in an ECC error. To avoid ECC errors, use one of the following options:
- Limit the work flash data size to 64 bits and program work flash in units of aligned 64-bit double words and read it as 64-bit double words through CM7_0/1 or another AXI master.
- Use M-DMA or P-DMA channel to read the work flash which can perform 32 bits AHB reads.
1.3 Work flash errors
The following faults can be captured by the fault structure mechanism in TRAVEO™ T2G devices:
- CPUSS_FLASHC_WORK_BUS_ERROR: Typically, this fault is set when there is a read access while a program or erase operation is ongoing.
- CPUSS_FLASHC_WORK_C_ECC: This fault is set when there is a correctable ECC violation in the work flash cache.
- CPUSS_FLASHC_WORK_NC_ECC: This fault is set when there is a non-correctable ECC violation in the work flash cache.
To capture these faults by a Fault Structure, enable the corresponding Fault Mask bits in the FAULT_STRUCTx_MASKy register. See the device datasheet to know the Fault IDs of the above faults and see the device Architecture TRM to understand how to capture faults using Fault Structure mechanism.
Be careful with the configuration of the WORK_ERR_SILENT bit of the FLASHC_FLASH_CTL register. When this bit is ‘0’ (default value), a work flash bus error or a NC_ECC error triggers a core hard fault when the error is detected during the read operation. If this bit is set to ‘1’, the error is silent and does not trigger a core hard fault.
An internal error with the work flash (for example, read access while a program erase operation is ongoing) can also be logged in the FLASHC_CMx_STATUS registers (x = 0, 4, 7_0, 7_1).
1.4 Work flash protection
Work flash can be protected against unintentional erases or writes using Software Protection Unit (SWPU) objects. For more details, refer the following documents:
- AN228680 - Secure System Configuration in TRAVEO™ T2G Family
- Configure Software Protection Unit (SWPU) objects in TRAVEO™ T2G devices - KBA234634
You can use MPUs or SMPUs for Work flash read protection.
Note: This KBA applies to the following series of TRAVEO™ MCUs:
- TRAVEO™ T2G
Community Translation: TRAVEO™: TRAVEO™ T2Gデバイスのワークフラッシュにアクセスする - KBA235277