EEPROM to JK3

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

EEPROM to JK3

1,611件の閲覧回数
kikepos
Contributor I
HI.  I need to save two bytes and to recover them soon.  I am being based on document AN2504 to write and to read the Flash, but it does not work to me.  I need a different example that it works with CodeWarrior and that makes the functions correctly.
 
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

741件の閲覧回数
bigmac
Specialist III
Hello,
 
If my understanding of your problem is correct, you wish to write two bytes of data to flash, as part of the normal operation of your JK3 code.  Assuming this needs to be done only infrequently, so as not to exceed the endurance limit for the flash, it is really only necessary to erase one page of flash (64 bytes), and re-program the first two bytes.  There are no special measures required to directly read the data from flash.  The first flash block would normally be chosen so that the remainder of the code can be write protected.
 
The code shown in AN2504 does far more than you require to do, and with more overheads, to cater for the more general case.  However, the various other sources of documentation on the use of the ROM based routines are generally described in assembly code, rather than C.  You did not say exactly what your problem is.
 
To use the ROM routines, the primary requirement is the use of specific locations in RAM, which would normally require six bytes for writing two data bytes only.  However, I would suggest you look at AN1831, where a problem with the page erase routine, applicable to the JK3 and other devices, is discussed.  This will involve a "page erase work-around", which requires use of a greater amount of RAM.  I am not sure whether AN2504 actually takes this issue into account.
 
The use of the ROM routines is also discussed in AN2874, but not the page erase problem.
 
I have previously used a very simple assembly sub-routine to do the same task that you seem to require, but for the QY device that does not have the page erase issue.  Let me know if you are interested in the code, and I will post it.
 
Regards,
Mac
 
0 件の賞賛
返信

741件の閲覧回数
J2MEJediMaster
Specialist I
Check out FAQ-26240. (Enter this string in the Enter Keyword field at the upper right of this web page.) It references a number of application notes, which may be of use to you.

---Tom
0 件の賞賛
返信