Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
angrysurgeon
PostPosted: Oct 17, 2010 - 04:09 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


Hi guys, this is probably not the correct forum and Im sorry if this is well trodden territory. I have read our friend Jecksons attempts to try to make an USBasp program a At89S52 via AVRdude. As a matter of fact, im trying to do the exact same thing.

Im actually able to read and partially write to the AT82S52 through the USBasp and Avrdude 5.10 with a modified conf.

Here is how i did it.

0. WinXP system
1. Bought/soldered a usbasp
2. Knowing that the usbasp functions fully (tested to program atmega8s all day with it) i interconnected the MISO, MOSI, SCK, GND, RST, VCC and GND of the Atmega8 on the USBasp and the target µC AT89S52.
3. Hooked up a 4,096mhz Xtal and 33pf capacitor to the target µC.
4. Connected the entire setup to the usb
5. Edited the conf file of avrdude with the work of Joy Shukla:

Code:
#------------------------------------------------------------
# Below chips by added by me .. Joy Shukla(joy_shukla@yahoo.in)
# these chips can be programmed with my usbasp programmer(changed atmega8 program)
# after adding avrdude support in this file ..
#------------------------------------------------------------

#------------------------------------------------------------
# AT89S52
#------------------------------------------------------------
part
    id               = "8052";
    desc             = "AT89S52";
    signature        = 0x1E 0x52 0x06;
    chip_erase_delay = 20000;
    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                       "x x x x  x x x x    x x x x  x x x x";

    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                       "x x x x  x x x x    x x x x  x x x x";

    timeout      = 200;
    stabdelay      = 100;
    cmdexedelay      = 25;
    synchloops      = 32;
    bytedelay      = 0;
    pollindex      = 3;
    pollvalue      = 0x53;
    predelay      = 1;
    postdelay      = 1;
    pollmethod      = 0;

    memory "flash"
        size            = 8192;
        paged           = no;
        min_write_delay = 4000;
        max_write_delay = 9000;
        readback_p1     = 0xff;
        readback_p2     = 0xff;
        read            = "  0   0   1   0    0   0   0   0",
                          "  x   x   x a12  a11 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        write           = "  0   1   0   0    0   0   0   0",
                          "  x   x   x a12  a11 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  i   i   i   i    i   i   i   i";
   mode      = 0x21;
   delay      = 12;
      ;

    memory "signature"
        size            = 3;
        read            = "0  0  1  0   1  0  0  0   x  x  x  0   0  0 a1 a0",
                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
      ;
  ;

5. Copied my target hex "Loghman.hex" of 380 (threehundred and eighty bytes) of led-blinking-code to avrdude's location

6. Fired up avrdude with the following command:
avrdude -p 8052 -c usbasp -e -U flash:"blabla\loghman.hex" -vvvv

7. Got the following screen:


Conclusion:
A) AVRdude can write to the AT89S52 but only 110 bytes, and NOT the full 380 bytes. Avrdude can read the supposedly written 110 bytes and it looks like this (gibberish?):

Code:
oߟ¯¯¯¯¯¯¯¯¯Ï__ï/ÿï?ÿï?ÿï?ÿÏŸߟ/ŸÏïÿÿÿÿÏïŸÿÿïŸOÿïŸOÿïŸOÿ/ïÿßÿÿ



Discussion:
A) I know through previous searches that AVR and the AT89 chips are programmed in a different way but hoped that the .conf file modification might do the trick. Obviously it didnt or i have due to ignorance missed something. Would any of the more versed AVR experts care to comment on what i might have done wrong?

B) Also, im getting a warning message that avrdude cannot set sck period. Tried to hook pin 25 to GND to set the SCK to slow mode but get the exact same warning. Any suggestions would be appriciated.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 17, 2010 - 05:10 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 71878
Location: (using avr-gcc in) Finchingfield, Essex, England

Just to note that the source of avrdude (and usbasp for that matter) is open so if there's really a demand to add 8051 programming to it then it's quite possible for someone to do this then contribute the work back to the project (under the "beerware" or "Free BSD" licence)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
newbie123
PostPosted: Oct 18, 2010 - 12:36 AM
Hangaround


Joined: May 05, 2005
Posts: 218


try this config, it works.
add this to the config file near the other defines
Code:
#define AT89START   0xE0
#define AT89S51     0xE0
#define AT89S52     0xE1

add this at the end of the config file
Code:
 #------------------------------------------------------------
  # AT89S51
  #------------------------------------------------------------
  part
      id               = "8052";
      desc             = "AT89S51";
      signature        = 0x1E 0x51 0x06;
      chip_erase_delay = 500000;
      pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                         "x x x x  x x x x    x x x x  x x x x";
 
      chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                         "x x x x  x x x x    x x x x  x x x x";
 
      timeout      = 200;
      stabdelay      = 100;
      cmdexedelay      = 25;
      synchloops      = 32;
      bytedelay      = 0;
      pollindex      = 3;
      pollvalue      = 0x53;
      predelay      = 1;
      postdelay      = 1;
      pollmethod      = 0;
 
      memory "flash"
          size            = 4096;
          paged           = no;
          min_write_delay = 4000;
          max_write_delay = 9000;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
          read            = "  0   0   1   0    0   0   0   0",
                            "  x   x   x a12  a11 a10  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          write           = "  0   1   0   0    0   0   0   0",
                            "  x   x   x a12  a11 a10  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
     mode      = 0x21;
     delay      = 12;
        ;
 
      memory "signature"
          size            = 3;
          read            = "0  0  1  0   1  0  0  0   x  x  x  0   0  0 a1 a0",
                            "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
        ;
    ;
#------------------------------------------------------------
# AT89S52
#------------------------------------------------------------
part
    id               = "8052";
    desc             = "AT89S52";
    signature        = 0x1E 0x52 0x06;
    chip_erase_delay = 500000;
    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                       "x x x x  x x x x    x x x x  x x x x";

    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                       "x x x x  x x x x    x x x x  x x x x";

    timeout      = 200;
    stabdelay      = 100;
    cmdexedelay      = 25;
    synchloops      = 32;
    bytedelay      = 0;
    pollindex      = 3;
    pollvalue      = 0x53;
    predelay      = 1;
    postdelay      = 1;
    pollmethod      = 0;

    memory "flash"
        size            = 8192;
        paged           = no;
        min_write_delay = 4000;
        max_write_delay = 9000;
        readback_p1     = 0xff;
        readback_p2     = 0xff;
        read            = "  0   0   1   0    0   0   0   0",
                          "  x   x   x a12  a11 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        write           = "  0   1   0   0    0   0   0   0",
                          "  x   x   x a12  a11 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  i   i   i   i    i   i   i   i";
   mode      = 0x21;
   delay      = 12;
      ;

    memory "signature"
        size            = 3;
        read            = "0  0  1  0   1  0  0  0   x  x  x  0   0  0 a1 a0",
                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
      ;
  ;
#------------------------------------------------------------
# AT89S8253
#------------------------------------------------------------
part
    id               = "8253";
    desc             = "AT89S8253";
    chip_erase_delay = 20000;
    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                       "x x x x  x x x x    x x x x  x x x x";

    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                       "x x x x  x x x x    x x x x  x x x x";

    timeout      = 200;
    stabdelay      = 100;
    cmdexedelay      = 25;
    synchloops      = 32;
    bytedelay      = 0;
    pollindex      = 3;
    pollvalue      = 0x53;
    predelay      = 1;
    postdelay      = 1;
    pollmethod      = 0;

    memory "flash"
        size            = 12288;
        paged           = no;
        min_write_delay = 4000;
        max_write_delay = 9000;
        readback_p1     = 0xff;
        readback_p2     = 0xff;
        read            = "  0   0   1   0    0   0   0   0",
                          "  x   x a13 a12  a11 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        write           = "  0   1   0   0    0   0   0   0",
                          "  x   x a13 a12  a11 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  i   i   i   i    i   i   i   i";
   mode      = 0x21;
   delay      = 12;
      ;

    memory "signature"
        size            = 2;
        readback_p1     = 0x1E;
        readback_p2     = 0x73;
        read            = "0  0  1  0   1  0  0  0   x  x  x  x   x  x  x  x",
                          "x  x  1  1   0  0  0 a0   o  o  o  o   o  o  o  o";
      ;
  ;

this is the bat file I use:
Code:
avrdude -c usbasp -p AT89S52 -C avrdude.conf -B 250 -e -U flash:w:file.hex

ensure you have the right code in the usbasp. If you are having trouble with avrdude, try progisp172 here:
http://www.zhifengsoft.com/download/progisp172.rar
 
 View user's profile Send private message  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 18, 2010 - 04:03 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


Thanks for your replies guys. Followed the instructions but still get the 348/110 problem, meaning my hexfile is detected by avrdude as Intel hex and of size 110 bytes although the size obviously is 348bytes large.

Does anyone know what might be the problem?
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Oct 18, 2010 - 04:55 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 20692
Location: Wormshill, England

I get a different behaviour.

1. You get a 'warning' about not setting SCK frequency.
I can set SCK frequency or just leave as default.

2. You can erase successfully.
I get a 'target does not answer' after the erase.

3. You say that your file is 384 bytes. I am sure that avrdude can correctly count 110 bytes.
I can successfully program and verify providing that I use the -D flag. i.e. I need to erase in one session and program in a different session.

My other anomaly is with the SCK setting.

Usbasp starting from cold will happily communicate at SCK=750kHz.
However any subsequent 'run' needs to use SCK=32kHz.

Usbasp seems happy programming AVRs without issue.

Incidentally, I get the -e and -D behaviour with the STK500 too.

n.b. AT89 parts have an active-high RESET pin. If you do not use an inverter, you need to add a 'nRST' line to usbasp. i.e. it does the inverse of the regular /SS line.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
wek
PostPosted: Oct 18, 2010 - 05:09 PM
Raving lunatic


Joined: Dec 16, 2005
Posts: 3219
Location: Bratislava, Slovakia

Isn't the size confusion the classical "intelhex file size does not match binary size" problem?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
glitch
PostPosted: Oct 18, 2010 - 05:10 PM
Raving lunatic


Joined: Jan 12, 2002
Posts: 7834
Location: Canada

angrysurgeon wrote:
Thanks for your replies guys. Followed the instructions but still get the 348/110 problem, meaning my hexfile is detected by avrdude as Intel hex and of size 110 bytes although the size obviously is 348bytes large.

Does anyone know what might be the problem?


you do realize that the size of the hex, is not the size of the program writen to the part. The hex will be more than 2x the size of what is written due to the encoding scheme used in hex files.

Back-calculating from your 110 bytes, which requires 220 hex bytes. Encoding that at 16 hex bytes per line, plus 11 bytes of overhead per line, add a segment definition line [15], and the EOF marker [11], plus a CRLF [2] per line, I get 341 bytes for the hex file.
 
 View user's profile Send private message  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 18, 2010 - 07:02 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


Quote:

you do realize that the size of the hex, is not the size of the program writen to the part. The hex will be more than 2x the size of what is written due to the encoding scheme used in hex files.


so in other words, im actually able to program the AT89S52, its just that my ledblinking code is not working?

So here is "my" code (actually the code i use from a AT89S52 tutorial):
Code:

#include <REGX52.h>
#include <math.h>

unsigned long time, ON_time; //Global Variables

void main(){
    P1_3 = 1;     //Set up P1_3 as input pin
    ON_time = 100000;
    while(1){
         if (time < ON_time){
            time++;    // start or continue counting
            P1_0 = 0;     //Turn ON the LED
         }else{
            P1_0 = 1;    // Turn OFF the LED
        }
        if (P1_3 == 0){     // if the switch is pressed,
            time = 0;    // reset 'time' to 0
        }
    }
}


Using Keil µvision 4.02, I get this compilation:

http://www.mediafire.com/?uba0td7qfxpb3br

To startup the At89S52 i use 2x 22pf a 11.0952Mhz crystal, connected (pin20), connected VCC 5.0V (pin 40) and to pin 1, i connect a red LED of 1.9V attached to the 5v via a 500ohm-1K resistor attached to 5V.

Unfortunately it does not work. With an oscilloscope, Ive tried to check if the oscillator swings correctly but all i get is gibberish, not the expected nice sine curve with the correct frequency that i get with Atmega8 (or any other microcontroller for that matter) when the power is turned on.


Last edited by angrysurgeon on Oct 18, 2010 - 07:10 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 18, 2010 - 07:07 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


David, i soldered the SCK to gnd on the usbasp that I use, but I was getting the exact same warningmessage before i did that "maneuver" so I just left it on since the AT89S52 manual mentions that the programming frequency must be 1/16th of that of the attached crystal.

And what do you mean with the following: " you need to add a nRST' line to usbasp", how would i go about doing that? That the RST of the AT89S52 must be 5V during programming?
 
 View user's profile Send private message  
Reply with quote Back to top
newbie123
PostPosted: Oct 19, 2010 - 02:23 AM
Hangaround


Joined: May 05, 2005
Posts: 218


Did you try progisp172? This way you will know your hardware is working.

If you get the SCK warning in avrdude, you don't have the latest code in the usbasp.
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Oct 19, 2010 - 01:39 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 20692
Location: Wormshill, England

angrysurgeon wrote:
David, i soldered the SCK to gnd on the usbasp that I use, but I was getting the exact same warningmessage before i did that "maneuver" so I just left it on since the AT89S52 manual mentions that the programming frequency must be 1/16th of that of the attached crystal.

I presume that you are referring to the 'SCK_slow' i/p pin on the usbasp board. This is nothing to do with the SCK o/p pin on the ISP header.

Quote:
And what do you mean with the following: " you need to add a nRST' line to usbasp", how would i go about doing that? That the RST of the AT89S52 must be 5V during programming?

An AVR cpu and most civilised cpu's in all history have an active-low /RESET pin.
The MCS51 family have an active-high RESET pin. wek has written an excellent explanation of this 'feature'.

So any ISP programmer must be capable of sending the
correct polarity of signal to the /RESET or RESET pin.
I simply duplicated the usbasp code that affects the /RESET o/p. i.e. I selected another GPIO pin for nRST, and always set it to the inverse of the RST o/p pin.

I have also added a flag to allow SPI mode#1 for the AT89S8253. All AVRs and other AT89 parts use regular mode#0 SPI !
The ispEnterProgrammingMode() function now accepts byte#4 == 0x69 (what the AT89S52 replies) as well as the byte#3 == 0x53 (what AVRs and 8253 replies)

I discovered the reason for my strange clock speed behaviour. The usbasp was simply driving a naked chip on a breadboard. I had a pull-down resistor for the AT89's RESET. But I did not have a pull-up resistor for the SS pin of the usbasp. The AVR SPI peripheral must never have the SS pin as a floating i/p.

Incidentally, your 'at89.c' program works just fine. But of course it needs human intervention. A simple Blinky.c is easier to check.

n.b. the AT89S52 is a 5V part. You can read it at 3.3V. But erase or program needs to have a full 5V.
AVR parts are very tolerant of low voltage operation.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 20, 2010 - 08:07 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


Hmm, would it be possible to ask for a favor and requesting a working blinkey hex code working for a at89S52? It would be fantastic if someone could upload that for me. That way, i could operate with the absolute certainty that the software is of no fault and that my hardwareconfiguration is defective...As a matter of fact, i would be able to send anyone who does that 3 AT89S52s to any address in the world if that person posts the stuff here for all of humanity and pms me his address Very Happy
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Oct 21, 2010 - 10:56 AM
10k+ Postman


Joined: Feb 12, 2005
Posts: 20692
Location: Wormshill, England

Code:

:03000000020003F8
:03005C0002005F40
:05005F0012009E80FE6E
:0C006400D582FD1583E583B4FFF622224F
:04007000AA82AB8332
:090074008A048B051ABAFF011B76
:06007D00EC4D601C7C0A42
:0E0083008C051CED60EB90004CC002C003C069
:0C00910004120064D004D003D00280E60A
:01009D002240
:02009E007A00E6
:0E00A000C3EA6480948A50106390019000645B
:0A00AE00C002120070D0020A80E8C0
:0500B80063900280E1ED
:06003200E478FFF6D8FDA2
:080010007900E94400601B7A4D
:05001800009000C1781A
:03001D000075A0CB
:0A00200000E493F2A308B800020503
:08002A00A0D9F4DAF275A0FF81
:080038007800E84400600A7939
:030040000075A0A8
:0600430000E4F309D8FC03
:080049007800E84400600C7926
:0B00510000900000E4F0A3D8FCD9FAF6
:03000300758107FD
:0A0006001200BDE582600302005FF6
:0400BD007582002226
:00000001FF

This was compiled for an 18.432MHz crystal and should run on ANY mcs51 part. So you will be 3Hz for a 12MHz crystal. Put a stopwatch on the P1_1 o/p pin. Count 20 blinks and calculate your crystal frequency (should be 40.00 seconds for 18.432MHz).
Code:

#include "mcu.h"
#include "sleep.c"

void main(void)
{
   char i;
        while (1) {
      for (i = 0; i < 10; i++) {
         P1 ^= (1<<0);      // P1_0 blinks at 5Hz
         msleep(100);
      }
      P1 ^= (1<<1);         // P1_1 blinks at 0.5Hz
   }
}

Incidentally, avrdude + usbasp are incredibly slow with 8051 devices. This is because they only read one byte for every USB packet. So reading 8k flash takes 33 seconds!

With a simple modification to the usbasp firmware, this can be speeded up to something more reasonable.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 27, 2010 - 07:22 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


It works...

IT WORKS! David and all the others, thank you! Very Happy Feierabend! as the germans say! Very Happy
 
 View user's profile Send private message  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 27, 2010 - 07:57 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


Here is the deal, here is how i got it to work for dummies like me:
0. connected the at89s52 to the usbasp as per above and modified the conf file.
1. copy pasted davids code into a new textfile and saved it (as pgm.hex)
1a. pgm.hex must be in the same folder as avrdude.exe
2. used this command to program the chip:
avrdude -p 8052 -c usbasp -e -U flash:w:Pgm.hex


(762bytes actual file size of pgm.hex
written after avrdude is done 194bytes)

3. hookup the now programmed at89s52 according to this schematic:


4. Enjoy.

Again, thank you all. Special thanks to David!
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Oct 27, 2010 - 09:02 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 20692
Location: Wormshill, England

@angrysurgeon,

If you are seriously using the AT89Sxx or AT89S82xx parts, I have modified the usbasp firmware.

The reading and writing works at a sensible speed. And you can access all the memory areas, just by configuring the avrdude.conf

In fact, I am very impressed with the performance of usbasp. You can use all the AVR's ISP features, so AVRs program efficiently.

I do not use the page modes that are available on some of the AT89S parts. Even so, byte mode writing is reasonable. Byte mode reading is almost as fast as any page mode reading.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 27, 2010 - 09:42 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


Wow! yes, i will be using at89s52 pretty extensively until the atmega prices of current models will come down (1-2 years from now?). Would you care to elaborate on what modifications you did with the usbasp in more detail? Are they hard to implement?
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Oct 28, 2010 - 10:12 AM
10k+ Postman


Joined: Feb 12, 2005
Posts: 20692
Location: Wormshill, England

I am a little confused as to how you got that command to work. Especially, how did you have the AT89S52 wired to the usbasp board.

Please can you post here / email me exactly what your hardware setup is. Do you have a commercial dev board?

8051's require pull-up resistors on the PORTS and fancy RESET circuits to operate. You cannot just put a naked 8051 on a breadboard.

Which usbasp kit did you build?
Did it come with a pre-programmed AVR?
Can you program that AVR with any other programmer?
Or do you need a pre-programmed chip?

By all means use your drawer full of AT89S52's. You will need the Keil evaluation compiler or the free sdcc compiler. The Keil tools are excellent for small beginner programs. (they are excellent for large programs too. just a LOT of money)

Some things work very differently at the hardware level on the 8051 compared to an AVR.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 28, 2010 - 03:20 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


The usbasp:

No commercial dev board, all DIY (or almost). I didnt build the usbasp from a kit, i used the schematics from fischl.de and took it from there.

Result:

[{The above picture is large, right click on it and choose view picture and zoom in by left clicking on it (FIREFOX)}


Last edited by angrysurgeon on Oct 28, 2010 - 03:44 PM; edited 2 times in total
 
 View user's profile Send private message  
Reply with quote Back to top
angrysurgeon
PostPosted: Oct 28, 2010 - 03:36 PM
Rookie


Joined: Oct 29, 2009
Posts: 34


I used the hexcode (2009 february) provided by fischl and programmed an atmega8 via a bought usbasp on a breadboard.

On the AT89S52 side of things:

1. put µC on a breadboard
2. connect pin 40 (VCC) of AT89S52 to usbasps 10pin input/output port pin 2


3. connect pin 20 (GND) of AT89S52 to usbasps "port-pin 10"


4. connect mosi of at89s52 to mosi of the atmega8 on the usbasp, miso to miso, sck to sck and RST to RST VIA the 10pin connector


5. attach 2x 20-30pf capacitors and an appropriate crystal to the AT89S52 (i used 4.33619mhz, tested also with 19mhz, 16mhz, all work fine for me, but using no crystal will NOT work {for me}). I also checked that the crystal swings fine with an oscilloscope.


6. Program by using a modified avrdude.conf using the provided command as per above.

I havnt tried with any other programmer, just the homemade usbasp. Havnt tried to program other chips other than atmega8, atmega88 and at89s52. If anything is unclear, contact me again and ill try to answer your questions.


Last edited by angrysurgeon on Oct 28, 2010 - 04:13 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits