Kinetis flash operation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kinetis flash operation

1,609 Views
rodger_an
Contributor I

Hello,

From "K32 L2B Sub-Family Reference Manual",

rodger_an_2-1643345656752.png

 

rodger_an_1-1643345555612.png

 

rodger_an_0-1643345533944.png

What does it mean for the above table?

My application,

Such as: application SW is about 100k, the flash is 128k, flash 0 and flash 1 is equal(64k). Now I want to use the last page of flash 1 as eeprom emulator. Does this design work?

 

BTW,

rodger_an_3-1643345980183.png

What does it mean?

Can the flash be programmed and read for 8 bits, 16 bits and 32 bits? All these bits are supported?

0 Kudos
4 Replies

1,546 Views
PabloAvalos
NXP TechSupport
NXP TechSupport

Hi @rodger_an 

 

I would like to apologize for the delay. We are experiencing high volume of questions these days. I really appreciate your patience.

 

Regarding your question, that table means that you can do two operations at the same time to the 2 different flash memories that mcu has, for example you can read Flash 1 while you are programming Flash 0.
In order to use a flash as EEPROM, which design you are referring to? I can suggest you to read this thread of our community to use flash emulating an EEPROM: https://community.nxp.com/t5/Kinetis-Microcontrollers/Ways-of-Storing-data-in-non-volatile-memory/td...

And for your last question, you can only read from flash 8-bit, 16-bit or 32-bit too, but not program those words size,

 

Hope the information is helpful, please let me know if you have more questions.

 

Best Regards.
Pablo Avalos.

 

0 Kudos

1,539 Views
rodger_an
Contributor I

Hi,

Thanks for your feedback.

Now I know kinetis flash can not read and programmed/erased a same flash bank at the same time.

If I want to do this, it have to copy run command to ram or enable ESFC bit in MCM PLACR.

But I found the SDK as below. when FTFx_DRIVER_IS_FLASH_RESIDENT is open, it will copy run command to ram. but why do not add disable interrupt and enable interrupt before and after  running flash ram command. Also do not Enable stalling flash controller when flash is busy when FTFx_DRIVER_IS_FLASH_RESIDENT is not open.

if do not do this, it will lead something wrong, such as: chip reset(flash operation hard fault), print out messy logs, when read and programmed/erased a same flash bank at the same time.

-------------------------------------------------------------------------------------------------------------------

/*!
* @brief FTFx Command Sequence
*
* This function is used to perform the command write sequence to the flash.
*
* @param driver Pointer to storage for the driver runtime state.
* @return An error code or kStatus_FTFx_Success
*/
static status_t ftfx_command_sequence(ftfx_config_t *config)
{
uint8_t registerValue;

#if FTFx_DRIVER_IS_FLASH_RESIDENT

/* clear RDCOLERR & ACCERR & FPVIOL flag in flash status register */
FTFx->FSTAT = FTFx_FSTAT_RDCOLERR_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_FPVIOL_MASK;

/* Since the value of ARM function pointer is always odd, but the real start address
* of function memory should be even, that's why +1 operation exist. */
config->runCmdFuncAddr.commadAddr += 1UL;
callFtfxRunCommand_t callFtfxRunCommand = config->runCmdFuncAddr.callFlashCommand;

/* We pass the ftfx_fstat address as a parameter to flash_run_comamnd() instead of using
* pre-processed MICRO sentences or operating global variable in flash_run_comamnd()
* to make sure that flash_run_command() will be compiled into position-independent code (PIC). */
callFtfxRunCommand((FTFx_REG8_ACCESS_TYPE)(&FTFx->FSTAT));
config->runCmdFuncAddr.commadAddr -= 1UL;

#else
/* clear RDCOLERR & ACCERR & FPVIOL flag in flash status register */
FTFx->FSTAT = FTFx_FSTAT_RDCOLERR_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_FPVIOL_MASK;

/* clear CCIF bit */
FTFx->FSTAT = FTFx_FSTAT_CCIF_MASK;

/* Check CCIF bit of the flash status register, wait till it is set.
* IP team indicates that this loop will always complete. */
while (!(FTFx->FSTAT & FTFx_FSTAT_CCIF_MASK))
{
}
#endif /* FTFx_DRIVER_IS_FLASH_RESIDENT */

 

0 Kudos

1,456 Views
PabloAvalos
NXP TechSupport
NXP TechSupport

Hi @rodger_an 

 

Please accept my apologies for the delay, we are still overloaded on Kinetis request in our community. I really appreciate your patience.

 

Regarding your situation, I found a thread in our community marked as solution than can helps massively. You can find it clicking it here: 

https://community.nxp.com/t5/Kinetis-Microcontrollers/Problem-with-Erase-Flash-memory/td-p/823391

In addition, it mentions an Application Note, the AN4695, where you may take a look to find what you are looking for. I will attach this one to the post.

 

Please let me know if you have more concerns, so I can help you.

 

Thanks you so much.
Best Regards.
Pablo Avalos.

0 Kudos

1,600 Views
xiaoye
Contributor I

microcontroller (MCU) is a small computer built on a single metal-oxide-semiconductor (MOS) integrated circuit (IC) chip. A microcontroller is made up of a CPU  (processor core), memory, and programmable input/output peripherals. On chip, a small amount of RAM, as well as ferroelectric RAM, NOR flash, or OTP ROM , is commonly included. Microcontrollers  , in contrast to microprocessors  used in personal computers  or other general-purpose applications, are designed for embedded applications and are made up of a number of discrete chips. This article will delve deeper into the MCU.

0 Kudos