Issue with the SetPage method in Codewarrior 5.9 targeting HCS08

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

Issue with the SetPage method in Codewarrior 5.9 targeting HCS08

ソリューションへジャンプ
1,629件の閲覧回数
mrcdsmith
Contributor I

This question is in regards to CodeWarrior IDE version 5.9.0 targeting processor family HCS08. I am having an issue writing to flash using the methods provided through CodeWarrior. I am reading from and writing to a buffer using the GetBytePage, GetWordPage, SetBytePage, and SetWordPage methods. This buffer is in turn being read from and written to flash using the SetPage and GetPage methods. The problem occurs when I attempt to use the SetPage method: whenever the program attempts to write the buffer to flash, the results are erratic. Sometimes my registers are corrupted, sometimes my microcontroller locks up until the watchdog timer expires. If I comment out the SetPage method, my code functions as expected. Does anyone have a suggestion as to what the problem(s) may be?

 

Below is the section of code I am using to read from and write to flash.

 

     const word Buffer_Address = 0xDD00;

 

     // Reading from flash

 

     Flash_DataPtr2Addr(Buffer_Address);

 

     Flash_GetPage(Buffer_Address);

 

     Flash_GetWordPage(1, &Word1);

     Flash_GetWordPage(3, &Word2);

     Flash_GetWordPage(5, &Word3);

     Flash_GetWordPage(7, &Word4);

     Flash_GetBytePage(9, &Byte1);

     Flash_GetBytePage(10, &Byte2);

     Flash_GetBytePage(11, &Byte3);

 

 

     // Writing to flash    

 

     Flash_DataPtr2Addr(Buffer_Address);

 

  Flash_SetWordPage(1, Word1);
  Flash_SetWordPage(3, Word2);
  Flash_SetWordPage(5, Word3);
  Flash_SetWordPage(7, Word4);
  Flash_SetBytePage(9, Byte1);
  Flash_SetBytePage(10, Byte2);
  Flash_SetBytePage(11, Byte3);

     

  Flash_EraseSector(Buffer_Address);

     

  Flash_SetPage(Buffer_Address);
ラベル(1)
0 件の賞賛
返信
1 解決策
1,452件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Smith,

the page related methods are only available for the chips that have paged memory. for example 9S08QE128.

for MC9S08SH16, it hasn't page memory. so it doesn't support  GetBytePage, GetWordPage, SetBytePage, and SetWordPage methods.

for more information, I suggest you look:

{CW6.3 install}\ProcessorExpert\Projects\Test projects\IntFlash

can this help you?


Have a great day,
Zhang Jun

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

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,452件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Smith,

what chip do you work with?

can you please upload your demo project so that we can check it directly ? thanks!


Have a great day,
Zhang Jun

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

0 件の賞賛
返信
1,452件の閲覧回数
mrcdsmith
Contributor I

I am using Freescale CPU part # MC9S08SH16CTL.

I can upload a snippet of the code I am working on. This is the section that deals directly with the flash read/write.

0 件の賞賛
返信
1,453件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Smith,

the page related methods are only available for the chips that have paged memory. for example 9S08QE128.

for MC9S08SH16, it hasn't page memory. so it doesn't support  GetBytePage, GetWordPage, SetBytePage, and SetWordPage methods.

for more information, I suggest you look:

{CW6.3 install}\ProcessorExpert\Projects\Test projects\IntFlash

can this help you?


Have a great day,
Zhang Jun

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

0 件の賞賛
返信
1,452件の閲覧回数
mrcdsmith
Contributor I

Thank you for the assistance. This has been extremely helpful.

0 件の賞賛
返信