(solved) Need help writing a 89C51RC2

Started by mockba, January 04, 2013, 04:49:50 PM

Previous topic - Next topic

mockba

Hello everyone,

I have connected a 89C51RC2 via serial (using a PL2303 USB-Serial adapter) going thru a MAX232 to my laptop.
The MCU is running on a 12Mhz Xtal and seems to be working fine. I have connected it with EA up, PSEN down and tried with ALE both up and disconnected. The "circuit" is just the chip on a protoboard with the XTAL and reset circuit (RC) in place.
I have configured the serial port to 9600 8N1 and opened Putty ... then I type "U" and get "U" back, meaning the MCU bootloader discovered the speed and replied.
Then I open the FlashMagic's terminal and do the same thing ... reset the circuit and type "U", getting a "U" back.
In fact from that moment on I get back anything I type, echoed back by the MCU.
However, when I command FlashMagic to start writing (or anything else) I see both TX and RX blink once (checked on the oscilloscope to make sure the MCU was sending something back) then I get a message stating that it was unabe to communicate and suggesting me to either lower or increase the speed.
I have read the post regarding speed autodiscover and tried almost everything there. I just didn't try replacing the USB adapter as I am getting a response back both thru putty and flashmagic's terminal.
At this point I don't know what else I could do.
I have tried programming the device on a Willem compatible (GQ-4X) programmer but it doesn't seem to be supported.

Any insight on this would be much appreciated.

Thanks everyone for even reading up to this point.

Best regards,
Marcelo "Mockba" Dantas.

Andy Ayre

Please generate a send us a debug file so we can see what is happening. Instructions here:

http://www.flashmagictool.com/debugfile.html

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

mockba

Here it is ...

The first one I took when pressing "Start" and trying to write a .hex file.
The second one I took when going to the ISP menu and selecting Erase Flash.

The Capture.jpg file shows the error I got.
The Capture2.jpg file shows how the program is configured.

The chip I am trying to configure is a 89C51RC2-IM.
I have tried with the high speed option on (both 6 and 12 clock) and off, same results.
I have tried with different speeds, same results.

I am able to program the chip using the terminal option, pasting the commands manually from a text file.
That method works fine.

I hope this helps find a solution. I hope it is me doing something stupid here.


Thanks a lot,
Marcelo.


Andy Ayre

Both files show the same thing:

tx> U
rx> U
tx> :010000020CF1
debug> ReadFile - not enough or too many bytes read
debug> wanted 16 bytes, read 13 bytes
rx> :010000020CF1
debug> Comport closed

Flash Magic sees the crystal frequency command echoed back but then expects a '.' followed by carriage return and line feed, but they are not transmitted.

You could try increasing the timeouts in Flash Magic from four seconds to something larger and see if that helps. If it doesn't put a scope on the TxD pin and measure the time from the '1' to the '.' and let me know what it is.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

mockba

Hi Andy,

Thanks for the prompt response. I will do some more testing once I get home later today.
But before that, a couple things just popped into my mind.
I am using the Atmel 89C51RC2, and on its datasheet there's no reference to the 02 command (or the 01 for that matter). However I see those commands on the datasheet of the 80C51RC2 from Philips.
Can this be the problem? Maybe the Atmel variant silently ignore the command?
I have LEDs on my RS232->TTL adapter and I remember all the comands I typed other than the full chip erase came back immediately. Which also happens when I press start.
Even when I was using the oscilloscope to track the TX/RX and troubleshoot the physical connections I could see that the replies where pratically immediate, definitely not longer than 4 sec. Not even 1 Sec.
What is this XTAL set command used for? Is it relevant for the Atmel once it has already done the autobaud?
Maybe it is valuable for some timing, but I was able to program the device manually line by line using the terminal.

Please let me know if this new information would ring a bell.

Cheers,
Marcelo.

mockba

Hi Andy,

Confirmed!
I got home and did a test using the terminal (attached .JPG). The chip doesn't reply with a dot to that command.
I have tested on the terminal and also using PuTTY. A bug on the Atmel boot loader?

Is there an option to disable the sending of the XTAL command on FlashMagic?

Not sure if it is ultimately necessary as I am able to configure the chip manually.

Thanks,
Marcelo.

Andy Ayre

Flash Magic is sponsored by NXP and therefore only supports NXP devices. Try FLIP from Atmel.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

mockba

Oh boy ... living and learning.
Thanks a lot for the reply, I will try FLIP (didn't even know it existed).
Again, thank you so much.

Cheers,
Marcelo.