Author Topic: 89V51RD2 and FM command line  (Read 7633 times)

Mark Moulding

  • Guest
89V51RD2 and FM command line
« on: January 03, 2005, 09:32:07 pm »
Is the 89V51RD2 supported using the command line version (FM.EXE)?  The documentation does not list this chip as an option for the DEVICE() command line parameter, butI thought that maybe the documentation was lagging behind a bit.  Or... maybe not.  Whenever I try any form of the part number (including *excatly* that which is shown in the pull-down list in the graphical version),  I get an "invalid parameter" message.

I hope there's a way to make this work, as I intend to provide my customer with a fairly simple way to update the firmware in the field (by shelling the FM.EXE xxx from within my PC application).  If necessary, I may have to write my own downloader, but I'd *really* rather not spend the time...

As others have noted, getting the 'V' series into program mode is sometimes a little dicey, since the chip must successfully autobaud and receive a 'U' within a quite short time after reset.  However, this seems to be working reliably enough for development using the graphical interface.  Perhaps the need for some user interaction (specifically, the "reset the device..." mesage box) was difficult to work into the command line product...

Any ideas???


Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2160
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: 89V51RD2 and FM command line
« Reply #1 on: January 04, 2005, 06:27:45 am »
Yes, you found the reason why the V/LV devices are not supported on the command line. The idea behind the command line is that it is automated. You start the batch file and wait until everything is finished. Because the V and LV devices require manual intervention to reset them we couldn't find a good way to make it work.

Here is a possible solution that at least one other user has successfully used. They were calling FM.exe from their own application and were able to programmatically control the reset of the device by some means (can't remember how). They were able to start FM.exe within the necessary time period after resetting the device to make it work. If you wish to do it this way then you need to use the command line as follows:

1. Specify the device as an 89C51RD2Hxx
2. Use a negative oscillator frequency

This only works on the last couple of versions of Flash Magic, so make sure you are using one of them. The reason this works is because the ISP protocol for the V and LV devices is very similar to the Rx2Hxx family with one major exception. The oscillator frequency command has been replaced with the command to enter SoftICE mode. If that command is set to a V or LV device you will have a hard time getting it to go back into ISP mode. By specifying a negative oscillator frequency the sending of the oscillator frequency command is supressed.

Use this method at your own risk, of course.

Embedded Systems Academy, Inc.
support at esacademy dot com

Mark Moulding

  • Guest
Re: 89V51RD2 and FM command line
« Reply #2 on: January 10, 2005, 03:55:14 pm »
Well, thanks for the information - it clarifies the situation.  Unfortunately, I'm afraid the solution you proposed won't work in my application, since my method of controlling the device reset will be to issue a "Press the button now!" command to the (human) user.

Therefore, I guess I'll be writing my own downloader.  Could you point me to a source for the detailed specification of the download protocol?  Thanks!

--
Mark


Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: 89V51RD2 and FM command line
« Reply #3 on: January 11, 2005, 01:04:37 am »
> Could
> you point me to a source for the detailed specification of the
> download protocol?  

The P89V51RD2 datasheet, at the Philips site.
Particularly chapters 7.1.2 and 7.2.4.

Jan Waclawek



Post Edited (01-11-05 02:05)

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: 89V51RD2 and FM command line
« Reply #4 on: January 11, 2005, 11:50:04 am »
Maybe a simpler method can be employed.
Rather than writing a complete downloader on your own, try implementing only the "Reset now!" "button" while sending out "U"s, until the device responds with "U" (indicating successful autobaud and entering ISP mode). At this moment, you can spawn to FM (keeping the same baudrate of course) with parameters as already suggested.

This is only an idea, not tried.

Jan Waclawek

PS. When sending out the "U"s (=55h), either make spaces between them or send alternating  55h and 0FFh .

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2160
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: 89V51RD2 and FM command line
« Reply #5 on: January 11, 2005, 11:52:53 am »
The way FM does it is to send out the 'U's in bursts of 10, with as short a delay as possible between the bursts.

Embedded Systems Academy, Inc.
support at esacademy dot com