EEPROM erase/ write problem

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

EEPROM erase/ write problem

2,583件の閲覧回数
rdkarthik
Contributor I
Hello All,
 
I am using a 9s12dg128 controller and P&E ICD. The EEPROM erase and write routines work fine as long as the BDM is connected and debugger is running, but fails to do so otherwise.
 
I use a 16Mz oscillator. I have also tried initializing EEPROM related registers the way codewarriror erase command does. There are no protection or access errors. EEPROM is readable. Disabled COP. Disabled PLL. Tried different values of ECLKDIV within range.  But nothing seems to work.I was not able to gather anything specific to this problem from the datasheets or errata either.
 
Any help would be appreciated.
 
Thanks in advance.
 
 
Karthik.
ラベル(1)
0 件の賞賛
返信
1 返信

830件の閲覧回数
Lundin
Senior Contributor IV
Maybe you are writing to ECLKDIV more than once? In that case you would get the behaviour you describe since that register is "write once" in normal single chip mode, ie when the BDM isn't connected to put the mcu in special single chip mode.

And then you would get the wrong ECLKDIV and the eeprom won't work. I once made that mistake myself:

/* bad */
ECLKDIV = calculated_value;
ECLKDIV |= PRDIV8;

/* good */
ECLKDIV = calculated_value | PRDIV8;
0 件の賞賛
返信