Author Topic: (solved) Need help writing a 89C51RC2  (Read 6214 times)

mockba

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
(solved) Need help writing a 89C51RC2
« on: January 05, 2013, 01:49:50 am »
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.
« Last Edit: January 14, 2013, 03:31:51 pm by mockba »

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2099
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Need help writing a 89C51RC2
« Reply #1 on: January 07, 2013, 10:32:09 am »
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

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Need help writing a 89C51RC2
« Reply #2 on: January 09, 2013, 02:05:34 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2099
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Need help writing a 89C51RC2
« Reply #3 on: January 09, 2013, 10:44:24 am »
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

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Need help writing a 89C51RC2
« Reply #4 on: January 09, 2013, 10:37:03 pm »
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

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Need help writing a 89C51RC2
« Reply #5 on: January 10, 2013, 12:36:24 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2099
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Need help writing a 89C51RC2
« Reply #6 on: January 10, 2013, 09:51:52 am »
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

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
    • Email
Re: Need help writing a 89C51RC2
« Reply #7 on: January 10, 2013, 08:02:51 pm »
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.