当前位置:网站首页>TC397 Flash

TC397 Flash

2022-06-22 21:42:00 Delta-delta

routine

In this example , Flash program memory (PFLASH) Of 64 Bytes are written and then verified . Besides ,64 Byte data flash (DFLASH) Be written and verified .
Before any write operation , Flash memory erased . If the corresponding flash After successful operation , For each test LED Will light up .
Data storage unit (DMU) Control in program and data flash memory (PFLASH and DFLASH) Command sequence executed on , Standard interface with flash memory (FSI) And program flash memory interface (PFI) Connect .

FSI Erase all flash memory 、 Programming and verification operations .
AURIX TC39x The device has :

  • 6 Program Flash Banks (PFx)
  • 2 Data Flash Banks (DFx)

AURIX TC39x It has five sizes 3 MB Of Program Flash bank (PF0…PF4) And a size of 1 MB Of Program Flash bank (PF5). Every Program Flash bank Divided into sizes of 1024 KB Physical sector of , Each physical sector is divided into 64 Size is 16 KB Logical sector of .

AURIX TC39x With two data flash sets ,DFLASH0 and DFLASH1. Both include commonly used for EEPROM Simulation of multiple EEPROM A sector . Only DFLASH0 Contains user configuration blocks for data protection (UCB) And configuration sectors that users cannot access directly (CFS).

DFLASH EEPROM It can be configured in single ended mode ( Default ) Or complement detection . According to the selected mode , The size of each sector is set to 4 KB and 2 KB.

The minimum amount of data that can be programmed in flash memory is page

  • Program Flash pages are made of 32 Bytes
  • Data Flash pages are made of 8 Bytes

The smallest unit in which an erase operation can be performed is the logical sector .

 Insert picture description here

 Insert picture description here
The minimum command sequence for programming the flash program memory or the data flash memory is as follows :
 Insert picture description here

Flashing the Program Flash memory

To execute PFLASH Programming , It is recommended to start with the PFLASH Different memory locations run code . therefore , Before starting the flash operation , By function copyFunctionsToPSPR() Copy erase and programming routines to CPU0 Of Program Scratch-Pad SRAM (PSPR) in . This uses Standards c library string.h Medium memcpy() Function and allocate the function pointer to the new memory location . then , The actual flash programming operation starts from erasing the logical sectors involved .

Erase of Logical Sectors

To perform an erase operation , Must be cleared by EndInit The protection position is PFLASH Enable write operations on , By function IfxScuWdt_clearSafetyEndinitInline() complete . then , Can pass IfxFlash_eraseMultipleSectors() The erase() function executes a sequence of erase commands for one or more consecutive logical sectors , This function consists of a function pointer eraseSectors() from PSPR perform .
Last , Must pass the function IfxScuWdt_setSafetyEndinitInline() Set again EndInit Protection position .
A function pointer waitUnbusy() Called function IfxFlash_waitUnbusy() stop it , Until the sector is erased and PFLASH Be ready again .

Write operations

After erasing the required logical sectors , You can start writing .
A function pointer enterPageMode() from PSPR Called function IfxFlash_enterPageMode() Used to enter page mode . function waitUnbusy() For pause , until PFLASH Get ready , then , The data that must be written in the page is loaded , Call the function repeatedly IfxFlash_loadPage2X32(), from PSPR Use function pointers load2X32bits() perform .

Then by calling the function pointer writePage() To write the loaded page , The pointer from PSPR perform IfxFlash_writePage() function ( Before and after the write operation ,EndInit The protection bit is cleared and set separately ).
Last call waitUnbusy(), Wait for page write to complete ,PFLASH Ready again , The writing process can then be repeated , Until all the required data is successfully written PFLASH.

All the functions used to execute the flash operation command sequence can be found in iLLD The header file IfxFlash.h Find , And the function pointer is Flash_Programming.c Declared and assigned in the document .

Flashing the Data Flash memory

Except the address is different , Others follow PFLASH Agreement .

原网站

版权声明
本文为[Delta-delta]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222008345349.html