S32K118 D-flash and EEEPROM configuration

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K118 D-flash and EEEPROM configuration

跳至解决方案
465 次查看
HiddenSquid
Contributor I

Hello,

I am bit new to the NXP ecosystem and would desperately require help.

I am using the S32K118 and have been trying to use D-Flash as non volatile memory, but I can't seem to make it work which ever way I try..

At first I tried to partition the FlexNVM to emulate EEEPROM, but that constantly gave me ACCERR. I tried to go over all the reason for it in the datasheet, but the only one I could think of was, that the function was written to P-Flash, but had to be in RAM ("The
Program Partition command must not be launched from flash memory, since flash
memory resources are not accessible during Program Partition command execution."). I couldn't get the function to RAM either, because then I ran in to some linker problems...

Since that didn't work I figured I'd try to just write manually to D-FLASH, but I get the MGSTAT error, which means it has not been cleared. When I tried to clear it, I get to HardFault... AI suggests that it might be the problem of not running the function from RAM again, but I can't get it to work as mentioned earilier...

I will add my files down below and would greatly appreciate any help.

0 项奖励
回复
1 解答
412 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

First you need to perform program partition operation to configure FlexRAM/FlexNVM as you needed according AN11983, section 2.2.2.

There is an example code in S32DS SDK (flash_partitioning_s32k144). It needs to be blank new device or with performed mass erase operation before programming the example code. There is no default values, this needs to be done once.

You may also use example code I did in the past. It configure FlexRAM as RAM what was the intention of example code but it also sets up FlexNVM as D-flash:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS...

 

EEPROM portion of FlexNVM will be accesses over FlexRAM memory address space.

Data flash portion of FlexNVM will be accesses ordinary way i.e. reading of flash address directly and erasing/programming of flash address.

Simple example how to program flash you may see for instance here:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-Flash-RW-simple/ta-p/1110000

在原帖中查看解决方案

1 回复
413 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

First you need to perform program partition operation to configure FlexRAM/FlexNVM as you needed according AN11983, section 2.2.2.

There is an example code in S32DS SDK (flash_partitioning_s32k144). It needs to be blank new device or with performed mass erase operation before programming the example code. There is no default values, this needs to be done once.

You may also use example code I did in the past. It configure FlexRAM as RAM what was the intention of example code but it also sets up FlexNVM as D-flash:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS...

 

EEPROM portion of FlexNVM will be accesses over FlexRAM memory address space.

Data flash portion of FlexNVM will be accesses ordinary way i.e. reading of flash address directly and erasing/programming of flash address.

Simple example how to program flash you may see for instance here:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-Flash-RW-simple/ta-p/1110000

%3CLINGO-SUB%20id%3D%22lingo-sub-2250309%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K118%20D-%E9%97%AA%E5%AD%98%E5%92%8C%20EEEPROM%20%E9%85%8D%E7%BD%AE%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2250309%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%82%A8%E5%A5%BD%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%EF%BC%8C%E6%88%91%E6%98%AF%E6%81%A9%E6%99%BA%E6%B5%A6%E7%94%9F%E6%80%81%E7%B3%BB%E7%BB%9F%E7%9A%84%E6%96%B0%E6%88%90%E5%91%98%EF%BC%8C%E6%80%A5%E9%9C%80%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FP%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%20S32K118%20%E5%B9%B6%E4%B8%80%E7%9B%B4%E5%9C%A8%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%20D-Flash%20%E4%BD%9C%E4%B8%BA%E9%9D%9E%E6%98%93%E5%A4%B1%E6%80%A7%E5%AD%98%E5%82%A8%E5%99%A8%EF%BC%8C%E4%BD%86%E6%97%A0%E8%AE%BA%E6%88%91%E5%B0%9D%E8%AF%95%E5%93%AA%E7%A7%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%E9%97%AE%3CBR%20%2F%3E%E9%97%AA%E5%AD%98%E8%B5%84%E6%BA%90%E3%80%82%22)%E3%80%82%E6%88%91%E4%B9%9F%E6%97%A0%E6%B3%95%E5%B0%86%E5%87%BD%E6%95%B0%E5%86%99%E5%85%A5%20RAM%EF%BC%8C%E5%9B%A0%E4%B8%BA%E6%88%91%E9%81%87%E5%88%B0%E4%BA%86%E4%B8%80%E4%BA%9B%E9%93%BE%E6%8E%A5%E5%99%A8%E9%97%AE%E9%A2%98......%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%97%A2%E7%84%B6%E4%B8%8D%E8%A1%8C%EF%BC%8C%E6%88%91%E5%B0%B1%E5%B0%9D%E8%AF%95%E6%89%8B%E5%8A%A8%E5%86%99%E5%85%A5%20D-FLASH%EF%BC%8C%E4%BD%86%E5%8D%B4%E5%87%BA%E7%8E%B0%E4%BA%86%20MGSTAT%20%E9%94%99%E8%AF%AF%EF%BC%8C%E8%BF%99%E6%84%8F%E5%91%B3%E7%9D%80%E5%AE%83%E5%B0%9A%E6%9C%AA%E8%A2%AB%E6%B8%85%E9%99%A4%E3%80%82%E5%BD%93%E6%88%91%E8%AF%95%E5%9B%BE%E6%B8%85%E9%99%A4%E5%AE%83%E6%97%B6%EF%BC%8C%E5%8D%B4%E5%87%BA%E7%8E%B0%E4%BA%86%20HardFault...AI%20%E8%AE%A4%E4%B8%BA%E8%BF%99%E5%8F%AF%E8%83%BD%E6%98%AF%E6%B2%A1%E6%9C%89%E5%86%8D%E6%AC%A1%E4%BB%8E%20RAM%20%E8%BF%90%E8%A1%8C%E5%8A%9F%E8%83%BD%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%8C%E4%BD%86%E6%88%91%E6%97%A0%E6%B3%95%E5%83%8F%E4%B9%8B%E5%89%8D%E6%8F%90%E5%88%B0%E7%9A%84%E9%82%A3%E6%A0%B7%E8%AE%A9%E5%AE%83%E5%B7%A5%E4%BD%9C......%3CBR%20%2F%3E%3CBR%20%2F%3E%EF%BC%8C%E6%88%91%E4%BC%9A%E5%9C%A8%E4%B8%8B%E9%9D%A2%E6%B7%BB%E5%8A%A0%E6%88%91%E7%9A%84%E6%96%87%E4%BB%B6%EF%BC%8C%E9%9D%9E%E5%B8%B8%E6%84%9F%E8%B0%A2%E4%BB%BB%E4%BD%95%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2251257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K118%20D-flash%20and%20EEEPROM%20configuration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2251257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E9%A6%96%E5%85%88%E9%9C%80%E8%A6%81%E6%89%A7%E8%A1%8C%E7%A8%8B%E5%BA%8F%E5%88%86%E5%8C%BA%E6%93%8D%E4%BD%9C%EF%BC%8C%E6%A0%B9%E6%8D%AE%20AN11983%20%E7%AC%AC%202.2.2%20%E8%8A%82%E7%9A%84%E8%A6%81%E6%B1%82%E9%85%8D%E7%BD%AE%20FlexRAM%2FFlexNVM%E3%80%82%3C%2FP%3E%0A%3CP%3ES32DS%20SDK%20%E4%B8%AD%E6%9C%89%E4%B8%80%E4%B8%AA%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%EF%BC%88flash_partitioning_s32k144%EF%BC%89%E3%80%82%E5%9C%A8%E5%AF%B9%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%E8%BF%9B%E8%A1%8C%E7%BC%96%E7%A8%8B%E4%B9%8B%E5%89%8D%EF%BC%8C%E5%AE%83%E5%BF%85%E9%A1%BB%E6%98%AF%E7%A9%BA%E7%99%BD%E7%9A%84%E6%96%B0%E8%AE%BE%E5%A4%87%E6%88%96%E5%B7%B2%E6%89%A7%E8%A1%8C%E5%A4%A7%E8%A7%84%E6%A8%A1%E6%93%A6%E9%99%A4%E6%93%8D%E4%BD%9C%E3%80%82%E6%B2%A1%E6%9C%89%E9%BB%98%E8%AE%A4%E5%80%BC%EF%BC%8C%E5%8F%AA%E9%9C%80%E6%89%A7%E8%A1%8C%E4%B8%80%E6%AC%A1%E3%80%82%3C%2FP%3E%0A%3CP%3E%E6%82%A8%E4%B9%9F%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E6%88%91%E4%BB%A5%E5%89%8D%E5%81%9A%E8%BF%87%E7%9A%84%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%E3%80%82%E5%AE%83%E6%8C%89%E7%85%A7%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%E7%9A%84%E6%84%8F%E5%9B%BE%E5%B0%86%20FlexRAM%20%E9%85%8D%E7%BD%AE%E4%B8%BA%20RAM%EF%BC%8C%E4%BD%86%E5%AE%83%E4%B9%9F%E5%B0%86%20FlexNVM%20%E5%AE%89%E8%A3%85%E4%B8%BA%20D-Flash%EF%BC%9A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS-ARM-2-2%2Fta-p%2F1245841%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS-ARM-2-2%2Fta-p%2F1245841%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EFlexNVM%20%E7%9A%84%20EEPROM%20%E9%83%A8%E5%88%86%E5%B0%86%E9%80%9A%E8%BF%87%20FlexRAM%20%E5%86%85%E5%AD%98%E5%9C%B0%E5%9D%80%E7%A9%BA%E9%97%B4%E8%AE%BF%E9%97%AE%E3%80%82%3C%2FP%3E%0A%3CP%3EFlexNVM%20%E7%9A%84%E6%95%B0%E6%8D%AE%E9%97%AA%E5%AD%98%E9%83%A8%E5%88%86%E5%B0%86%E4%BB%A5%E6%99%AE%E9%80%9A%E6%96%B9%E5%BC%8F%E8%AE%BF%E9%97%AE%EF%BC%8C%E5%8D%B3%E7%9B%B4%E6%8E%A5%E8%AF%BB%E5%8F%96%E9%97%AA%E5%AD%98%E5%9C%B0%E5%9D%80%E5%92%8C%E6%93%A6%E9%99%A4%2F%E7%BC%96%E7%A8%8B%E9%97%AA%E5%AD%98%E5%9C%B0%E5%9D%80%E3%80%82%3C%2FP%3E%0A%3CP%3E%E5%A6%82%E4%BD%95%E4%B8%BA%E9%97%AA%E5%AD%98%E7%BC%96%E7%A8%8B%E7%9A%84%E7%AE%80%E5%8D%95%E7%A4%BA%E4%BE%8B%EF%BC%8C%E8%AF%B7%E5%8F%82%E8%A7%81%E6%AD%A4%E5%A4%84%EF%BC%9A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K144-Flash-RW-simple%2Fta-p%2F1110000%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K144-Flash-RW-simple%2Fta-p%2F1110000%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E