Author Topic: P89V51RD2 clocks bit programming  (Read 8678 times)

phonoplug

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
P89V51RD2 clocks bit programming
« on: June 27, 2006, 04:04:25 am »
Hello!

Now having problems programming the clocks bit in the 89V51RD2. Everything seems to program ok (although either the erase is extremely quick or it doesnt happen though the erase box is checked), but at the end I get the message "Operation Failed. (programming clocks bit)"

I understand that the clocks bit cannot be erased through Flash Magic, which is fine, I just want it to run at double clock mode but it seems not to want to program. Any ideas why this bit only could be failing, when the rest of the programming seems to verify fine?

phonoplug

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: P89V51RD2 clocks bit programming
« Reply #1 on: June 27, 2006, 05:38:38 am »
Hmmm, perhaps this is a bug in Flash Magic...?

Reading back the clocks setting using Menu --> ISP --> Read Clocks shows that the chip is actually in 6 clock mode. Philips datasheet says 12 clock mode is the default so it must have programmed the bit, yet it still says there is an error. I confirmed that the chip is in 6 clock mode by examining its behaviour with our code and its running correctly so I am thinking there is a bug in Flash Magic that beings up the Operation Failed error message??

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89V51RD2 clocks bit programming
« Reply #2 on: June 27, 2006, 08:36:38 am »
What you are describing sounds exactly like the bug that was fixed in version 2.04. Which version are you using? Double-check by going to Help -> About.

Embedded Systems Academy, Inc.
support at esacademy dot com

phonoplug

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: P89V51RD2 clocks bit programming
« Reply #3 on: June 27, 2006, 08:43:26 am »
I was using 3.02, and today I have updated to 3.12 but it has not made a difference :puzzled:

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89V51RD2 clocks bit programming
« Reply #4 on: June 27, 2006, 08:49:47 am »
Hmmm...I'll give it a test and see if it resurfaced somehow.

Embedded Systems Academy, Inc.
support at esacademy dot com

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89V51RD2 clocks bit programming
« Reply #5 on: June 27, 2006, 09:30:42 am »
It appears that if you attempt to program the clocks bit when it is already programmed, the baud rate the device is using immediately changes.

Because of this Flash Magic does not get confirmation that the command was received ok, so it generates the error.

From that point on no further communication with the device is possible until it is reset.

So the workaround is to not program the clocks bit if it is already programmed.

Embedded Systems Academy, Inc.
support at esacademy dot com

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89V51RD2 clocks bit programming
« Reply #6 on: June 27, 2006, 09:32:00 am »
Perhaps I can make a check to not program the clocks bit if it is already set. I'll look into it.

Embedded Systems Academy, Inc.
support at esacademy dot com

phonoplug

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: P89V51RD2 clocks bit programming
« Reply #7 on: June 27, 2006, 12:06:46 pm »
Aaaah right that makes more sense now. I remembered that somewhere I read the clocks bit could not be 'unset', but not checking the option of course raises questions as to whether it will program properly!

So I know what to do at the moment, thanks. :yah:

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89V51RD2 clocks bit programming
« Reply #8 on: June 27, 2006, 12:08:18 pm »
Next non-bugfix-only release of Flash Magic will not attempt to set an already set clocks bit. No release date yet.

Embedded Systems Academy, Inc.
support at esacademy dot com

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: P89V51RD2 clocks bit programming
« Reply #9 on: June 28, 2006, 12:13:18 am »
Actually, this should perhaps be considered as a bug in the bootloader code (rather than FM's bug). The bootloader should check the status of clock bit before it attempts to program it + change the baudrate.

Of course, it is easier to persuade Andy to fix it in FM than Philips to fix it in the bootloader... :-)

Jan Waclawek