Hi All, I'm new at trying to program the EEPROM and was hoping you guys could shed some light on the problem I'm having. First off, I am using the MC9S12DG128B with a 40MHz external clock (20MHz bus). According to Metroworks, I have the EEPROM located at 0x2000-0x27FF as declared below: Block Module Name Address Range Status 0 EEPROM 2000 - 27FF Blank - Selected 1 FLASH_4000 4000 - 7FFF Blank - Selected 2 FLASH_C000 C000 - FFFF Blank - Selected 3 PAGED 388000 -3FBFFF Blank - Selected I'm trying to do a sector erase/program word. The debugger initially shows TOO_HOT as being 0, and after trying to program that location with my program it still displays a 0. The following is the code that I'm using. Any help would be much appreciated. Thanks. unsigned int TOO_HIGH @0x2000; // declared the variable to view // beginning of the EEPROM ECLKDIV = 0x59; // set up EEPROM with 192KHz clock ESTAT = 0x30; // clear misc error bits while (!(ESTAT & 0x80)); // wait until buffer is ready TOO_HOT = 900; // load address and data ECMD = 0x60; // erase sector and program word ESTAT = 0x80; // start programming while (!(ESTAT & 0x40)); // wait until all commands are done |
|
Problems programming the EEPROM
Started by ●June 16, 2003
Reply by ●June 16, 20032003-06-16
1) You are declaring TOO_HIGH and programming TOO_HOT - typo or could this be a/the problem? 2) Comment for ECLKDIV indicates value for 192Khz clock? While I am not familiar with the "S"128 I use the std DG128A. EEDIV (ECLKDIV?) is a write once register and must be set in relation to the MCU clock. This is **VERY** important to prevent damage to the EEPROM. -----Original Message----- From: Doug Brainard [mailto:] Sent: Monday, June 16, 2003 5:56 PM To: Subject: [68HC12] Problems programming the EEPROM Hi All, I'm new at trying to program the EEPROM and was hoping you guys could shed some light on the problem I'm having. First off, I am using the MC9S12DG128B with a 40MHz external clock (20MHz bus). According to Metroworks, I have the EEPROM located at 0x2000-0x27FF as declared below: Block Module Name Address Range Status 0 EEPROM 2000 - 27FF Blank - Selected 1 FLASH_4000 4000 - 7FFF Blank - Selected 2 FLASH_C000 C000 - FFFF Blank - Selected 3 PAGED 388000 -3FBFFF Blank - Selected I'm trying to do a sector erase/program word. The debugger initially shows TOO_HOT as being 0, and after trying to program that location with my program it still displays a 0. The following is the code that I'm using. Any help would be much appreciated. Thanks. unsigned int TOO_HIGH @0x2000; // declared the variable to view // beginning of the EEPROM ECLKDIV = 0x59; // set up EEPROM with 192KHz clock ESTAT = 0x30; // clear misc error bits while (!(ESTAT & 0x80)); // wait until buffer is ready TOO_HOT = 900; // load address and data ECMD = 0x60; // erase sector and program word ESTAT = 0x80; // start programming while (!(ESTAT & 0x40)); // wait until all commands are done -------------------- ">http://docs.yahoo.com/info/terms/ This e-mail and any files transmitted with it ( Message ) are confidential and may contain privileged information. This Message is intended solely for the addressee(s). If you have received this Message in error, please inform us promptly by reply e-mail then delete the Message and destroy any printed copy of it. Any unauthorized use, review, retransmission, dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. E-mails are susceptible to alteration. Neither Technip-Coflexip nor any of its subsidiaries and affiliates shall be liable for the Message if altered, changed or falsified |
|
Reply by ●June 16, 20032003-06-16
Yeah, sorry that was a typo. I am actually declaring TOO_HOT. Also I did go through the diagram that they display for configuring the clock, and I'm fairly certain that I have set it up correctly. I will look it over again though. Thanks for the advice. Still haven't got it working yet. --- In , "Killingsworth, Steve" <steve.killingsworth@u...> wrote: > > 1) You are declaring TOO_HIGH and programming TOO_HOT - typo or could this > be a/the problem? > > 2) Comment for ECLKDIV indicates value for 192Khz clock? While I am not > familiar with the "S"128 I use the std DG128A. EEDIV (ECLKDIV?) is a write > once register and must be set in relation to the MCU clock. This is > **VERY** important to prevent damage to the EEPROM. > -----Original Message----- > From: Doug Brainard [mailto:doug@b...] > Sent: Monday, June 16, 2003 5:56 PM > To: > Subject: [68HC12] Problems programming the EEPROM > Hi All, > I'm new at trying to program the EEPROM and was hoping you guys > could shed some light on the problem I'm having. First off, I am > using the MC9S12DG128B with a 40MHz external clock (20MHz bus). > According to Metroworks, I have the EEPROM located at 0x2000- 0x27FF > as declared below: > > Block Module Name Address Range Status > 0 EEPROM 2000 - 27FF Blank - Selected > 1 FLASH_4000 4000 - 7FFF Blank - Selected > 2 FLASH_C000 C000 - FFFF Blank - Selected > 3 PAGED 388000 -3FBFFF Blank - Selected > > I'm trying to do a sector erase/program word. The debugger > initially shows TOO_HOT as being 0, and after trying to program that > location with my program it still displays a 0. The following is > the code that I'm using. Any help would be much appreciated. > Thanks. > > unsigned int TOO_HIGH @0x2000; // declared the variable to view > // beginning of the EEPROM > > ECLKDIV = 0x59; // set up EEPROM with 192KHz clock > ESTAT = 0x30; // clear misc error bits > > while (!(ESTAT & 0x80)); // wait until buffer is ready > TOO_HOT = 900; // load address and data > ECMD = 0x60; // erase sector and program word > ESTAT = 0x80; // start programming > while (!(ESTAT & 0x40)); // wait until all commands are done > -------------------- > > ">http://docs.yahoo.com/info/terms/ > > > This e-mail and any files transmitted with it ( Message ) are confidential and may contain privileged information. > This Message is intended solely for the addressee(s). If you have received this Message in error, please inform us promptly by reply e- mail then delete the Message and destroy any printed copy of it. > Any unauthorized use, review, retransmission, dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. > E-mails are susceptible to alteration. Neither Technip-Coflexip nor any of its subsidiaries and affiliates shall be liable for the Message if altered, changed or falsified |
Reply by ●June 16, 20032003-06-16
Try erasing the sector before writing the word you are trying to change. Regards Dave Perreault Doug Brainard wrote: >Hi All, >I'm new at trying to program the EEPROM and was hoping you guys >could shed some light on the problem I'm having. First off, I am >using the MC9S12DG128B with a 40MHz external clock (20MHz bus). >According to Metroworks, I have the EEPROM located at 0x2000-0x27FF >as declared below: > >Block Module Name Address Range Status > 0 EEPROM 2000 - 27FF Blank - Selected > 1 FLASH_4000 4000 - 7FFF Blank - Selected > 2 FLASH_C000 C000 - FFFF Blank - Selected > 3 PAGED 388000 -3FBFFF Blank - Selected > >I'm trying to do a sector erase/program word. The debugger >initially shows TOO_HOT as being 0, and after trying to program that >location with my program it still displays a 0. The following is >the code that I'm using. Any help would be much appreciated. >Thanks. > >unsigned int TOO_HIGH @0x2000; // declared the variable to view > // beginning of the EEPROM > >ECLKDIV = 0x59; // set up EEPROM with 192KHz clock >ESTAT = 0x30; // clear misc error bits > >while (!(ESTAT & 0x80)); // wait until buffer is ready >TOO_HOT = 900; // load address and data >ECMD = 0x60; // erase sector and program word >ESTAT = 0x80; // start programming >while (!(ESTAT & 0x40)); // wait until all commands are done >-------------------- > >">http://docs.yahoo.com/info/terms/ |