How can I read out the Program Flash 1 IFR

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

How can I read out the Program Flash 1 IFR

2,418 次查看
jmag99
Contributor II

I would like to read out the Program Flash 1 IFR to get the Swap Field data.  I think I can do this using the ReadResource flash command, but the values I am getting back are not correct.  I am using the following commands to read out 16 bytes starting at address 0.  Any idea what I am doing wrong?

returnCode = FlashReadResource(&ftflCfg, (PFLASH_BLOCK_BASE + PFLASH_IFR_OFFSET + 0), dataReadback, FlashCommandSequence);
returnCode = FlashReadResource(&ftflCfg, (PFLASH_BLOCK_BASE + PFLASH_IFR_OFFSET + 8), dataReadback, FlashCommandSequence);
8 回复数

1,573 次查看
perlam_i_au
Senior Contributor I

In this case I suggest you to review the information on the AN4533 Robust Over-the-Air Firmware Updates Using Program Flash Memory Swap on Kinetis Microcontroll..., you cal also find the application software for this App note.

Also could you please share your part number? this will be helpful in order to search for specific information.


Have a nice day,
Perla Moncada

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,573 次查看
jmag99
Contributor II

Yes, I have read AN4533, our code is based on the app note.  However, the document does not show how to read the IFR or where exactly it is.  I know that the flash command "Read Resource" must be used, but what address should be passed to it?


The specific processor is MK60FN1M0VLQ12 rev 3N96B.

0 项奖励
回复

1,573 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi jmag99,

I have consulted our Expert Team, and they replied with the following table, please kindly refer to it for details.

1.png

so you may use the read resource command to access program flash 1 IFR.


Hope that helps,

Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,573 次查看
jmag99
Contributor II

Thanks, that address appears to be correct for the IFR1 location.  However, there are several errors in the Reference Manual for my part (K60P144M150SF3RM):

Program Flash 1 IFR is located at 0x20000-0x203FF

In section 30.4.12.14.1 - the locations of the fields are incorrect.  It should be

0-1 is enable word

2-3 is indicator address

On page 804, the address is not shifted by 1 bit, but rather by 4 bits.  This results in the indicator address going from 0x7F000 to 0x7F00.

Hopefully this information makes it into the Reference Manual someday.

0 项奖励
回复

1,573 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi All,

What I am referring to is K60P144M100SF2V2RM Rev. 2 Jun 2012, while K60P144M150SF3RM is Rev. 2, Dec 2011, and I was just told K60P144M150SF3RM and K70P256M150SF3RM will be updated next month, so I think the FTFE chapter will be updated with this release.

Have a great day!

B.R

Kan

0 项奖励
回复

1,573 次查看
perlam_i_au
Senior Contributor I

Well now I am a bit confused, I am using the K60P144M150SF3RM reference manual and I would like to confirm with you if you are using the same reference manual and also the information depicted above, please see the next points:

  • In this manual I found information regard IFR address on Table 30-44. Read Resource Select Codes on page 789, here is mention that IFR local address range is 0x0000 - 0x03FF.
  • You mention there is an error on section 30.4.12.14.1 Swap state determination, but I am no able to understand what you mean with 0-1 and 2-3, could you please explain me?
  • You mention that in page 804 is an address from 0x7F000 to 0x7F00 but I was not able to find it, could you be more specific?

Please confirm this information o let me know if I am using a different reference manual.

0 项奖励
回复

1,573 次查看
jmag99
Contributor II

It appears you have the same manual as me.

The 30-44 table only shows the IFR 0, not the IFR 1 where the swap details are stored.  Also, the flash driver needs to be modified to be able to Read Resource at address 0x20000.

The table on 30.4.12.14.1 shows the swap enable word at 0x006-0x007, but it's really at 0x000-0x001.  It also shows the indicator address at 0x00D-0x00F, but it's really at 0x002-0x003.

On page 804, the address is not listed (this is generally set as the last page in a sector), however, the way the address is stored in the IFR is not stated properly.  On that page, it states that the address is shifted right by 1 bit (exact text is (shifted with bit 0 removed), however, the actual data stored at that location is shifted by 4 bits.

0 项奖励
回复

1,573 次查看
perlam_i_au
Senior Contributor I

I have been reviewing the AN4533 software because I tried to understand better the original question and data depicted on the reference manual in order to know what is exactly going on. In this case I would like to ask you some questions:

  • Which is the value for your FlashCommandSequence variable before entering to FlashReadResource() function?
  • Which is the value of the same variable after going out the function?
  • Why you say this is not the correct value, what value do you expect?
  • Which is the value of the variable returnCode after going out of the function?
  • If you do not use this function you have any problems with the application? (I know you cannot be sure about if information has been correctly swapped) but have you noticed a strange behavior on your application? or does you application crash?
0 项奖励
回复