Author Topic: 89C51RD2BN and Win XP  (Read 18673 times)

David Little

  • Guest
89C51RD2BN and Win XP
« on: October 21, 2003, 05:37:10 am »
Hello

I have a problem programming a 89C51RD2BN successfully with Flash Magic v1.82 at baud rates above 9600 when running under Windows XP pro.

Part way through the programming cycle a message box "Unable to communicate" is displayed and the program halts.  The Flash Magic dialog has the "erase all flash+security+clk" and all of the "set security bit" boxes checked to start with.  Once the failure has occurred of course, the boot vector is destroyed and has to be restored on a parallel programmer.

19200 baud fails every time, 14400 baud fails sometimes, 9600 always works.

Programming the 89C51RD2BN under Win 95/98 on the same PC is successful at up to 19200 baud (the rate I would like to use to minimise re-programming time).

The 89C51RD2HBPs I have previously been using program successfully at 19200 baud on either Win XP or 95/98 without a problem.

Finally, I have written my own Windows ISP programming applet using the ISP data from the 89C51RA2xx/RB2xx/RC2xx/RD2xx, July 2002 data sheet and this fails in exactly the same manner as Flash Magic.  When observing the behaviour of my own program at the point of failure, no reply at all is received from the 89C51RD2BN to one of the "program data" frames (no "X", no "R", no ".").  After this, 89C51RD2BN doesn't respond to further
hex records.  

Both the 89C51RD2BNs and the 89C51RD2HBPs are running at 11.0592 MHz and x12 clock.  Flash Magic isn't using high speed mode, although I have also tried this without success.

Maybe something in the timing of the bootstrap loader might have changed between the 89C51RD2BN and the 89C51RD2HBP?

Has anybody else had a similar problem?

Regards - David

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2178
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: 89C51RD2BN and Win XP
« Reply #1 on: October 21, 2003, 09:35:54 am »
I can see the same behavior. At 6 clocks/cycle, 19200 works fine. At 12 clocks/cycle, 19200 works some of the time, 14400 seems ok, 9600 seems ok. If I enable high speed comms, select 12 clocks/cycle and switch to 9600 baud, I can erase, program, etc. fine at 19200 baud.

What I see at 19200 baud is that the autobauding appears to be successful, but then the device echoes junk back in response to commands. This tells me that 19200 baud almost works.

It seems that 19200 is just a little too high for this device to autobaud at when running at 12 clocks/cycle.

I'm not quite sure why autobauding at 19200 works ok on Win95/98. The only thing that I can think of is that either WinXP or Win95/98 is less accurate at generating exactly 19200 baud.

When using high speed comms, make sure the number of clocks/cycle you select matches your device. In this case you need to select 12 clocks/cycle.

Embedded Systems Academy, Inc.
support at esacademy dot com

Dong-Liang Shiue

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #2 on: October 21, 2003, 10:08:11 pm »
I run flash magic in win98 OS.
My experiment tell me the best choice is:(for 89c51rd2,89c51rd2h,89c61x2)
IF your crystal above 6MHz, your best choice is Baud Rate=9600,
IF your crystal under 6MHz, your best choice is Baud Rate=4800.
If your chip is 6 clks, choice  "high speed communication" + 6 clock part.
If your chip is 12 clks, choice  "high speed communication" + 12 clock part.

Then, you  can success communicate with rs-232, and can get the fast programming time.

good luck.

erik malund

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #3 on: October 22, 2003, 06:07:52 am »
Just a comment:
Are you using an 'on the nose' crystal such as 11.0592?

Erik

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2178
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: 89C51RD2BN and Win XP
« Reply #4 on: October 22, 2003, 08:44:43 am »
Some general information regarding ISP and 11.0592MHz crystals:

Because the high speed communications feature allows exact calculation of the baud rate to use, and because 11.0592MHz when running at 12 clocks/cycle allows most standard baud rates to be used with 0% error, you would expect the high speed communications feature to operate at a higher speed than 19200 baud.

The reason it doesn't is because in the past I have found using this feature, that if the timer 2 reload value is too high (close to 65535) then it causes problems for the boot loader. Therefore Flash Magic only uses timer 2 reload values that are lower than a certain threshold value that I have found results in reliable bootloader operation. In this case the resultant baudrate is 19200.

Using a frequency such as 11.0592MHz does not appear to give any speed advantage when autobauding. Hence the highest reliable rate of 9600 baud is in my opinion likely.

Embedded Systems Academy, Inc.
support at esacademy dot com

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2178
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: 89C51RD2BN and Win XP
« Reply #5 on: October 22, 2003, 08:48:22 am »
In general (but not true for every specific case):

The higher the crystal frequency and the lower the number of clocks/cycle, the faster a device can autobaud successfully.

Embedded Systems Academy, Inc.
support at esacademy dot com

Dong-Liang Shiue

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #6 on: October 25, 2003, 08:49:08 pm »
Re:Erik

Yes, I run mostly in 11.0592MHz.
Future, I will test another frequency.
Thank you.

Dong-Liang Shiue

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #7 on: October 25, 2003, 09:08:39 pm »
The following test data is test result recently.
I don't promise the data is exactly corrective.
But, I will continue to test in future.
"Baud:" means your choice Baud Rate.
"Commu." means  your communication speed.
"Oscillator Freq." means your circuit crystal frequency.
Chip is any one: 89c51rd2,89c51rd2h,89c61x2.


                                Chip is 6 clock          Chip is 12 clock
Oscillator Freq.   Baud:   Commu.   Baud:   Commu.
2 MHz          4800   7200   4800   4800
4 MHz          4800   14400   4800   7200
6 MHz          9600   19200   9600   9600
8 MHz          9600   19200   9600   14400
10 MHz         9600   19200   9600   14400
11.0592 MHz     9600   38400   9600   19200
12 MHz         9600   38400   9600   19200
14.3181 MHz     9600   38400   9600   19200
16 MHz         9600   57600   9600   19200
20 MHz         9600   57600   9600   19200
22.1184 MHz     

Dong-Liang Shiue

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #8 on: October 25, 2003, 09:25:47 pm »
re-post

|                        |Chip is 6 clock       |Chip is 12 clock
|Oscillator Freq. |Baud:   |Commu.  |Baud:  |Commu.
|2 MHz               |4800    |7200       |4800   |4800
|4 MHz               |4800    |14400     |4800   |7200
|6 MHz               |9600    |19200     |9600   |9600
|8 MHz               |9600    |19200     |9600   |14400
|10 MHz             |9600    |19200     |9600   |14400
|11.0592 MHz    |9600    |38400     |9600   |19200
|12 MHz             |9600    |38400     |9600   |19200
|14.3181 MHz    |9600    |38400     |9600   |19200
|16 MHz             |9600    |57600     |9600   |19200
|20 MHz             |9600    |57600     |9600   |19200
|22.1184 MHz    |

Dong-Liang Shiue

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #9 on: October 25, 2003, 09:38:10 pm »
Sorry, again post

|_________________|Chip is 6 clock__|Chip is 12 clock
|Oscillator Freq._|Baud:___|Commu.__|Baud:__|Commu.
|2 MHz____________|4800____|7200____|4800___|4800
|4 MHz____________|4800____|14400___|4800___|7200
|6 MHz____________|9600____|19200___|9600___|9600
|8 MHz____________|9600____|19200___|9600___|14400
|10 MHz___________|9600____|19200___|9600___|14400
|11.0592 MHz______|9600____|38400___|9600___|19200
|12 MHz___________|9600____|38400___|9600___|19200
|14.3181 MHz______|9600____|38400___|9600___|19200
|16 MHz___________|9600____|57600___|9600___|19200
|20 MHz___________|9600____|57600___|9600___|19200
|22.1184 MHz______|

Dong-Liang Shiue

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #10 on: October 25, 2003, 11:46:14 pm »
If you don't understand the table.
You will see the table in http://www.8052.com/users/shiue/

David Little

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #11 on: November 05, 2003, 07:12:30 am »
Hello All

Thanks for the replies.

I've tried using Flash Magic high speed comms with x12 clock checked and selected initially either 19200 or 9600 baud, and both failed part way through programming with an "unable to communicate" message box.

I have even experienced failures sometimes at 9600 baud with no high speed comms enabled.  Again, the failure is always part way through the hex file download in the programming cycle.

In addition, I modified my own ISP programming applet to set the baud rate to 19200 using the direct load baud rate function (timer 2 reload value 0xffee) after auto bauding initially at 19200.  The auto bauding seems to work ok (i.e.  the subsequent "erase data" command works and the "program data" command is acknowledged) but again, the programming cycle fails part way through the .hex file download.  Up to the point of failure, all downloaded data is echoed back correctly - the next transmitted data record is not acknowledged at all.

The Xtal is a genuine 11.0592MHz part.

The problem only happens under Win XP pro and only with the 89C51RD2BN part.  Win 95/98 works ok at 19200 and the 89C51RD2HBP part works at 19200 on Win 95/98 or XP pro (v2002 + service pack 1, Celeron 1.70GHz ).  I've run XP pro with Flash Magic as the only user application running and no virus checkers etc.

Fortunately, the boot vector isn't destroyed by a full chip erase on the 89C51RD2BN part as it is on the 89C51RD2HBP so it is possible to try again if the programming cycle fails.

erik malund

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #12 on: November 06, 2003, 04:49:54 am »
"The problem only happens under Win XP pro . Win 95/98 works ok at 19200"
after Win 98 Mr Gates decided that timing did not matter.  I have, for that reason not downgraded from '98 to XP.  Several timing critical programs such as JTAG programmers and Parallel programmers work excellent under '98 and very poorly under any downgrades from that.

Erik

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2178
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: 89C51RD2BN and Win XP
« Reply #13 on: November 06, 2003, 06:27:07 am »
The last couple of versions of Flash Magic have the ability to increase the COM port timeouts used. You can access them in the Advanced Options. Please try increasing the values and see if that improves the reliability.

Embedded Systems Academy, Inc.
support at esacademy dot com

gaurang

  • Guest
Re: 89C51RD2BN and Win XP
« Reply #14 on: October 14, 2004, 02:23:39 am »
hi i am gaurang from india i have also problem in programming 89c51rd2bn, in serially as well as parrallely now. i used win 98 and winisp software and also flashmagic. in both cases ic dosen't work . i tried all possible baudrates. but result is nothing it shows "UNABLE TO CONNECT> TRY TO ICREASE OR DECREASE BAUD RATE". if do you have any solution then please  please  please mail it to me. I WILL BE VERRY THANKFULL TO YOU.