Connect with us

Flashing program data to AT89S2051

Discussion in 'Microcontrollers, Programming and IoT' started by CPU Terminator, Mar 14, 2014.

Scroll to continue with content
  1. CPU Terminator

    CPU Terminator

    4
    0
    Mar 14, 2014
    Hello,

    I am quite a noob (seriously, this is my first) at MCU programming & design but through a few tutorials I seem to have got everything set up, except for getting the program data from my computer to the MCU.

    Steps I have taken so far:

    1. Basic circuitry set up on breadboard for AT89S2051
    2. Programmed simple program for MCU in Keil μVision 4 for the specific MCU.
    3. Debugged said program in the debugger and verified to work.
    3. Compiled said program to a HEX-80 file stored on my computer.

    I was under the impression that directly using the UART interface to perform serial communication with the MCU was all that it took to flash the program. Under this impression I went and bought myself a USB to TTL card to interface with the MCU directly. I then became kinda stumped at what to do next and poked around μVision's menu until I found a menu option for flashing.

    After a while I gave up with Keil and began researching other methods to flash a AT89S2051 and discovered PonyProg and AtmelISP, both turning out to not work (or maybe I'm doing something wrong).

    My question is:

    1. How would one flash a program from a computer to the MCU (AT89S2051) given my scenario?
    2. If not possible, what would I need to do/buy to make that possible?

    I seem to have dived right into the deep-end of MCU programming, skipping the common PIC or AVR chips which seem to just work like a charm... On well....
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    Hello and welcome to Electronics Point :)

    Thank you for giving so much information in your question!

    The AT89S2051 data sheet describes two programming methods: parallel and serial. Serial is simplest to connect, so let's go with that.

    The serial programming method doesn't use asynchronous serial data via the UART; it uses synchronous serial data (SPI-style, with an explicit clock line) using P1.5 for data to the device, P1.6 for data from the device, and P1.7 for the serial clock.

    The device must be powered up, its RST input must be high (active), and a clock source must be present. Details are in the data sheet starting at section 33. I think it's the same as the serial programming method used with their AVR devices, and you may be able to find an AVR programmer that programs these devices as well.

    Back in the days of standard parallel ports on PCs, you would have been able to make a pretty simple adapter to allow a PC to program a device serially, using "bit-banging". Nowadays you would use a specialised USB device.

    Keil's AT89S2051 page at http://www.keil.com/dd/chip/4030.htm lists various Dataman device programmers (which are probably all quite expensive), and a "Flash utility" called Winburn by Microware Technology, at http://www.microware-tech.com/winburn.html.

    I downloaded the evaluation version of Winburn from their homepage at http://www.microware-tech.com/ but it wouldn't run on my machine (Win7 x64). The installer executable is dated 2002. In any case it's not clear what hardware is required, nor how much they want for the software.

    You could try to contact Microware, or even Keil, to see if they have any other suggestions. Also have a look at the Atmel website http://www.atmel.com - do a search for the appropriate keywords.

    I tried a Google image search: https://www.google.com/search?q=AT89S2051+ISP+programmer&tbm=isch

    This brought up several pages that might be relevant:
    http://8051usbprogrammer.blogspot.co.nz/2011/01/89sxx-programmer.html
    http://8051expert.com/8051.php
    http://www.sunrom.com/3 - their programmer is USD 19

    I think you'll need to do some Googling and searching web sites.
     
  3. CPU Terminator

    CPU Terminator

    4
    0
    Mar 14, 2014
    Thanks for your response, I guess I have a better understanding of the situation now. I was trying as hard as I can to avoid either making more hardware or to purchase more but that seems inevitable now.

    I did find a dedicated flashing cable by Atmel which I might consider getting, depending on the price. So much work to get a 2 dollar MCU working...
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    Yeah. Many companies are trying to discourage end users from making their own device programmers. Partly because a lot of DIY programmers don't work very well and they don't want their products associated with that. Microchip (maker of the PIC devices) and Atmel (AVRs and your 2051, and others) seem to be pretty friendly to the student / maker market - trying to get their foot in the door with folks just starting out - so their own software and hardware tools are easy-to-use and reasonably priced.

    What's your project? What are you going to use microcontrollers for in the future?
     
  5. CPU Terminator

    CPU Terminator

    4
    0
    Mar 14, 2014
    Agree. Information is also quite scattered and outdated, making it quite hard to actually get something working straight away.

    Right now I'm using the IC as a timer circuit to trigger MOSFETs (as well as a low battery indicator via analog comparator). Once I get a "useful" device up and running I have a feeling that I would be using MCUs for a lot more things (trivial stuff included). Thinking of getting a PIC18 for long term testing/development purposes.
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    Yeah. You'd think that Atmel would make an effort to support their own products!
    Yeah, I'm sure you'll find LOTS of things for them to do.
    I've used many types of MCUs and IMO, of all the 8-bit MCUs, the PIC has the worst architecture. The 8-bit PIC core design is very restrictive and the workarounds are messy kludges. You get to see this if you program them in assembly language. A lot of that is hidden from you if you program in C (although the C implementation is also quite restricted), and the PIC's on-board peripherals are reasonable. They're very popular, and cheap, and they work fine.

    If you're looking at low-end microcontrollers, I would recommend AVR over PIC. The AVR's architecture is much tidier and easier to program in assembler, and has better support for high-level languages - it has separately vectored interrupts and an addressable stack for parameters, for a start. The AVR's internal peripherals are somewhat better-designed as well.

    The Texas Instruments MSP430 devices are really nice for high-level-language programming, and their internal peripherals are also very well designed. It's a 16-bit architecture and even the cheapest are several times the price of PICs and AVRs.
     
  7. CPU Terminator

    CPU Terminator

    4
    0
    Mar 14, 2014
    Hmm... Okay I'll take that into consideration.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-