ERR_VALUE writing using IntFlash on MK22FN512

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ERR_VALUE writing using IntFlash on MK22FN512

ソリューションへジャンプ
720件の閲覧回数
hypernerd
Contributor I

I'm trying to use the Processor Expert IntFlash component to use a part of the program memory of the MK22FN512 as non-volatile storage.

 

Whenever I call any of the SetByteFlash, SetBlockFlash etc. I get the return value 3 (ERR_VALUE). Stepping through the code sees that this is caused by an Access error.

 

I understand that the Flash memory on the MK22F512 is in 2KB blocks, so I allocated a ROM/RAM Area in the CPU Component's Build Options at 0x7FC00, with size 0x400 and qualifier RWX. I also reduced the size of the m_text area by 0x400 from 0x7FBF0 to 0x7FBC0. I pass the address 0x7FC00 as the dest in the call to SetByteFlash or SetBlockFlash.

 

The corresponding calls to GetByteFlash and GetBlockFlash return with no error (ERR_OK) and it appears that the data read out is valid (all 0xFF as I can't write anything there).

 

I would appreciate any assistance.

 

Thanks,

 

Jamie

ラベル(1)
0 件の賞賛
1 解決策
480件の閲覧回数
priya_dwivedula
Contributor III

I had a similar issue when I was using MK22F512 but I was using SSD flash driver with KSDK1.2.0. I found that the problem was that the microcontroller was running in high speed run mode by default (HSRUN) and after some research, I figured out that I cannot write to flash in that mode.

Check out the following link to learn more about HSRUN mode:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4985.pdf

After I changed the clock to run in normal run mode, I was able to write to flash.

元の投稿で解決策を見る

0 件の賞賛
3 返答(返信)
480件の閲覧回数
marek_neuzil
NXP Employee
NXP Employee

Hello Jamie,

The issue can be also caused by protection settings of your flash memory. You can find these settings in the Component Inspector of the CPU component, Common Settings / Flash configuration field / Protection regions property group. See also the following screenshot:

pastedImage_3.png

Best Regards,

Marek Neuzil

0 件の賞賛
481件の閲覧回数
priya_dwivedula
Contributor III

I had a similar issue when I was using MK22F512 but I was using SSD flash driver with KSDK1.2.0. I found that the problem was that the microcontroller was running in high speed run mode by default (HSRUN) and after some research, I figured out that I cannot write to flash in that mode.

Check out the following link to learn more about HSRUN mode:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4985.pdf

After I changed the clock to run in normal run mode, I was able to write to flash.

0 件の賞賛
480件の閲覧回数
hypernerd
Contributor I

Thanks, this solved it. I had the Core clock at 120MHz, which forces HSRUN mode.

I created a second clock configuration with the Core clock at 80MHz (the limit before HSRUN is forced) and switch to that just before writing to Flash. I also had to set the IntFlash to be enabled in Low Speed mode.

0 件の賞賛