1
\$\begingroup\$

Forgive me if this is a noob question, this is my first MCU project.

After reading a few tutorials here and there, I've set up my MCU circuit and programmed a simple program in Keil μVision 4 and compiled it to HEX-80. However, I'm having problems with attempting to flash the program to the MCU.

Fundamentally I am kind of lost in how to connect the devices (PC->MCU) up. I was under the impression a simple USB->TTL (Serial)->MCU UART input was going to do it, but apparently not.

After 5 hours of search, I only found articles relating to AVR or PIC with no mention of anything remotely related to 8051. I understand the AT89S2051 has ISP functionality so I don't need a dedicated chip flash programmer. I also found that the MCU does have serial flash capabilities.

Can anyone point me in the right direction here?

Additional Details:

MCU: Atmel AT89S2051 (on breadboard)
PC: Win 7 x64 (Shouldn't matter but here it is anyway)
USB->TTL: PL2303HX (on-board chipset)

Wiring:

The RXD (TTL output) is wired to the TXD (Pin 3.1) of the UART
The TXD (TTL output) is wired to the RXD (Pin 3.0) of the UART
The GND (TTL output) is wired to the circuit ground
The +5V (TTL output) is wired to the circuit +5V
The +3.3V (TTL output) is not connected.

Programs I have tried (and failed to use):

AtmelISP
PonyProg
IspPgm

\$\endgroup\$
  • \$\begingroup\$ Have you looked for a ISP programmer yet? \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 15 '14 at 6:52
  • \$\begingroup\$ @IgnacioVazquez-Abrams At this point I am quite confused about the whole flashing procedure. By a ISP programmer, are you talking about a hardware device/circuit board that programs ISP chips or a software program that facilitates such a feature through perhaps a serial output. \$\endgroup\$ – initramfs Mar 15 '14 at 6:55
2
\$\begingroup\$

Where you're getting into confusion is that while ISP stands for in-system programming it often still needs a dedicated hardware programmer to provide the necessary voltages and/or protocol for programming the FLASH. For that device you'll want something such as an Atmel AT89ISP.

I've never used the AT89 series in particular but on page 32 of the AT89S2051 datasheet you'll see it's an SPI type interface that requires a clock and data in and out lines. Some FTDI devices can support SPI communications but I'm fairly sure the PL2303HX can't and after a quick check of the datasheet it only seems to mention async mode.

Generally the easiest way would be to purchase the AT89ISP programmer or I believe there are a few DIY projects and clones available. Although unless the budget is tight it's probably always easiest to start with an officially supported programmer.

\$\endgroup\$
  • \$\begingroup\$ If I get this correctly, in terms of software I simply use the AtmelISP program with the actual AtmelISP cable connected to the pins specified in page 32 of the AT89S2051 datasheet. 31 dollars to program a 2 dollar MCU... \$\endgroup\$ – initramfs Mar 15 '14 at 7:47
  • \$\begingroup\$ @CPUTerminator, yes that's right, common to need to spend a bit when starting out. With that in mind you might want to think about your CPU choice, if you're writing code in C the 8051 instruction set isn't much of an advantage so maybe an AVR would be a better longer term choice. The Arduino (and cheaper clones) have a serial bootloader flashed into the chip already. Either that or if you spend the same sort of money on an AVR ISP programmer you might get more long term use out of it. \$\endgroup\$ – PeterJ Mar 15 '14 at 7:51
  • \$\begingroup\$ Well, I guess you're right again... But seeing that I already bought the MCU might as well use it... I'll definitely invest in a more "mainstream" (AVR/PIC) MCU in the long term, perhaps one that either can be programmed directly via UART (does this exist or am I misunderstanding something again?). Thanks for your answer. \$\endgroup\$ – initramfs Mar 15 '14 at 8:07
  • 1
    \$\begingroup\$ With the UART programming and the Arduino someone has already programmed in a serial bootloader using an ISP programmer. Some Atmel chips have something called SAM-BA (boot assistant) built in but that's only the more complex ARM chips. One advantage to an ISP programmer is that often they allow hardware debugging as well. \$\endgroup\$ – PeterJ Mar 15 '14 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.