Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USBasp fails to erase AT89S52, but all other functions work.

Status
Not open for further replies.

cgchas

Member level 3
Member level 3
Joined
Jul 19, 2011
Messages
56
Helped
2
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
2,001
I have built the circuit from here using an ATMEGA8 avr:

USB 8051/AVR programmer - Free 8051 Microcontroller projects

The fuse bits are properly set. (hfuse is 0xc9, lfuse is 0xef)
I have loaded the USBasp driver (windows xp) and the programmer is detected successfully.
I have tried numerous libusb drivers. They all seem to work the same with regards to this issue.
I can program the flash memory of a previously erased AT89S52 successfully.
I can verify the flash memory of the AT89S52.

What I can not do with USBAsp is erase the AT89S52.

I have tried with Avrdude as well as ProgISP. All functions aside from erase work as expected.

I can erase the AT89S52 using a parallel port programmer with no problems so I know the chip is good.

I know that USBasp is failing to erase because when I read back from the flash into the buffer after an erase command, the program is still there, but if I erase using the parallel programmer, the flash is set to all F's.

I get no errors from Avrdude when erasing yet a proper erase does not occur.
I get no errors from ProgISP when erasing, but it does fail the blank check.

What can cause everything to work with USBasp except for AT89S52 chip erase?

Charles

---------- Post added at 15:28 ---------- Previous post was at 13:59 ----------

I get no errors from Avrdude when erasing yet a proper erase does not occur.
It would seem that increasing the chip_erase_delay from 20000 to 500000 has solved the issue for use with avrdude.
ProgISP is unusable for me however because the delay does not seem to be long enough to actually cause the erase to work.

So it seems that the circuit at least works.

Does anybody know if the latest usbasp firmware (version 2009-02-28) can program the AT89S52 using the ATMEGA8 programmer?
When I try it, avrdude does not see the AT89S52 target.

2006-12-29 version seems to work, but when I use it with the latest avrdude, I get this warning:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.

Any help is greatly appreciated.
Charles
 

Hi,

My version of ProgISP is June 10 2010 direct from this site, its an English version. zhifengsoft.com ( sorry wont link?)

2006-12-29 version seems to work, but when I use it with the latest avrdude, I get this warning:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.

Yes I see that as well but looking around its a common message and general views are that you do not need to do anything about it.

I have only erased mega328 chips but that does clear the data ok.
 

Hi,

My version of ProgISP is June 10 2010 direct from this site, its an English version. zhifengsoft.com ( sorry wont link?)



Yes I see that as well but looking around its a common message and general views are that you do not need to do anything about it.

I have only erased mega328 chips but that does clear the data ok.

I have ProgISP v1.72 and it cannot erase AT89S52. Do you have a newer version? The site you linked appears to have v1.72 as the latest version. Perhaps ProgISP's AT89S52.xml file might allow for a longer chip erase delay, but the format of that file does not seem to be documented.

Also, neither Avrdude v5.6 nor ProgISP v1.7 seems to work with the latest USBasp firmware given the published circuit schematic for USBasp. I can not explain why this is, as I can build and use the older USBasp firmware.

Charles
 

Hi,

No, mine is the same version, just a later date.
I see. That is because the dates I was referring to were for USBasp firmware revisions. The older of those dates came from the free circuit at the link in this thread's initial post and not directly from a USBasp release (at least that I can see). That firmware resides in the directory usb51 that comes from the usb51.zip packaged intended for use with ProgISP and Avrdude.

Here is what I am trying to figure out. Since USBasp was originally intended for AVR programming only, there was a time that it did not support programming AT89S chips. Then the firmware was modified to support AT89S52 and other close family members. So the question is, do subsequent USBasp firmwares also contain the modifications to support AT89S chips and if so, why doesn't the latest USBasp firmware work with Avrdude v5.6 or ProgISP v1.7 using the circuit schematic provided in the USBasp package?

Using the latest USBasp firmware with the circuit provided by that package as well as with the USB driver from that same package version (the libusb driver is packaged separately from USBasp), Avrdude responds with an error "target does not respond" and ProgISP returns "chip select error". Yet if I roll back the firmware version to the one that came packaged in usb51.zip, the programmer works.

Does it not seem odd that older firmware works and newer does not with respect to AT89S targets?

Charles
 

This is my very first post.:)
I actually purchased an SLK having a dev board with AT89S52 as target MC and another smaller PCB having USB connector and ATMEGA8L-8PU chip (as programmer i suppose).
Though the dev board has an RS232 connector but the manufacturer (thinnkware.com) provided a complicated setup -which allows a user to connect PC to programmer(smaller PCB having ATMEGA8) via USB to USB cable and then the atmega is to be connected to target device by making some pin to pin connections(mosi,miso,rst etc ).
Anyway, We had this problem to program the target /flash code to target flash area -
"chip enable program error" and "no programmer found".
As we are newbies ,we had no idea what to do,so we contacted the manufacturer and found that atmega pcb was faulty. They then replaced it yet we continued to face this issue.
Later we came to know that there might be some issue with the drivers etc. The technical support representative of that company stated that "THIS CANNOT WORK ON WIN7 X64 PLATFORM".
Going with that we then tried doing it on XP and other x32 bit systems. No wonder, problem still persisted.
After doing hell lot of work and googling so many things i came across USBasp 29-07-2010 update.(included in progISPv1.72)
As soon as I did it and gave a try on WIN7 X64 bit OS , I noticed NO ERROR message.
When i tried it for 2nd time , the same error encountered again.
I, then unplugged and replugged into another USB cable - i got success, 2nd time- ERROR
again replugged - SuCCESS. 2nd time - ERROR.
Oops, i forgot to mention , ERASE function is WORKING on this driver update (Needless to mention, rest of the functions are also working fine.:))
PS= As mentioned i am a newbie ,so i would like to know that what can be the cause and solution(other than unplugging and replugging) to this "chip enable program error" problem.
Also , I would like to share that the adapter which we got with the SLK is dead and company has denied to replace it (the kit is not even a month old) and we feel cheated :-(. The quality of product and support is not at all good.:-(,Dont buy things from them.
 
Last edited:

Hello saurabhreigns,

I cannot be sure what the problem is given the information you have provided, so I will make some comments. I am not familiar with the SLK, but I have built more than one programmer from scratch for programming the AT89S52. As I mentioned in the original post, the AVRDude script was simply lacking the necessary delay for a proper chip erase. Once I corrected that, programming the AT89S52 using a USBASP programmer via AVRDude worked very well.

The pin connections you describe are for ISP (in system programming). For this to occur, the target device must have a stable clock with a closed reset switch. Also, make sure nothing is interfering with the SCK, MISO, and MOSI lines. It is ok to share these lines with other hardware for your project, but you need to be aware of their states during programming so they can be properly used. You must also have properly set fuses for your programmer's AVR. There are several possible combinations, but for USBASP, you need to use the following:

For example, for ATmega8:

DEFAULT
LFUSE 0xE1 1110 0001
HFUSE 0xD9 1101 1001

USBASP
LFUSE 0xEF 1110 1111
HFUSE 0xC9 1100 1001


Given that you seem to be having a "no programmer found" error, I am guessing that one possibility is that your USB driver is not loading under Windows. This is a frequent complaint with modern 64-bit windows versions and unsigned USB drivers. I am not saying yours is unsigned, but it is worth looking in to.

For 64-bit operating systems, various unlicensed or unsigned USB drivers may not work by default. One way to get the driver to load is bring up the kernel menu during boot time for Windows by pressing F8 repeatedly just before you see the "Starting Windows" screen. Then from the boot menu, make the selection "Disable Driver Signature Enforcement".

For clarity, here are the versions of the software that I use to program the AT89S52 under Vista x64:
WinAVR version 20100110
avrdude-mingw32-v5.10svn built with libusb-win32-device-bin-0.1.12.1
libusb - DriverVer = 03/20/2007,0.1.12.1
An ATMEGA8-based USBASP programmer. I built this one: http://www.8051projects.info/resources/usb-8051-avr-programmer.23/
The only difference is that I used a 2k2 resistor instead of the 1k5 R2 that is listed in the schematic listed.
This schematic is also very helpful for bulding this circuit: http://www.fischl.de/usbasp/
The USBASP firmware I use in my programmer is the one that came with the USB 8051/AVR programmer project. (The first URL)
Newer versions of the firmware may not work for the AT89S52 without modification. Perhaps others can comment on this, but I have had good luck with the 2006-07-18 release.


Here is the modified avrdude.conf section specific to the AT89S52:
#------------------------------------------------------------
# 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";
;
;
#------------------------------------------------------------

You can build it with a similar command to this: Software\AVRDude\avrdude-mingw32-v5.10svn\bin\avrdude -W -C Software\AVRDude\avrdude-mingw32-v5.10svn\bin\avrdude.conf -p AT89S52 -c usbasp -e -U flash:w:"filename.hex":i

I cannot say much positive about progISP as I had mixed results with it when I tried it some years back.
In fact, for the AT89S52, it did not work reliably for me.

ISPProg by Adam Dybkowski works beautifully for the parallel port, but I do not think he maintains the project, but if you build yourself a cable like this one, which I have, it does work: **broken link removed**

The AEC_ISP parallel port pinout works with AVRDude and ISPProg. ...if you should ever want to do something with DOS and the parallel port, I have tried this and it works: and

Some will say that building your own programmer is not worth the trouble and in some cases they are certainly correct, but for me, the learning experience has been valuable.

Regarding the programmer you purchased. If they are unwilling to support it, strip what you can from it for spare parts and throw away the rest. There are many ways to program the 8051, but the AT89S52 is most convenient with the ISP which gives you more options. Just make sure if you spend money for a programmer again that the USB driver that comes with it specifically supports Windows 7 x64.

Otherwise if you are willing to build your own using the resources I provided, you only face the minimal inconvenience of selecting "Disable Driver Signature Enforcement" from the boot menu.

I hope that you can find any of this to be helpful.

- - - Updated - - -

I, then unplugged and replugged into another USB cable - i got success, 2nd time- ERROR
again replugged - SuCCESS. 2nd time - ERROR.

This type of intermittent USB related communications issue is the same type of issue that would present itself if one tried to build a USBasp programmer but neglect to use the the proper pin for the microcontroller interrupt that is necessary for proper USB event handling.

If you have to keep reconnecting the USB device in order to get interrmittent at best functionality then I am guessing the company's design is flawed (not likely, but certainly possible), there is a hardware or software issue with the programmer itself, or there is a communications issue with the atMega8 you are using.

Anyhow, I wanted to comment again because I once interfaced with a different pin than the one shown in the USBasp schematic which resulted in very similar intermittent USB communcations issues when using the V-USB firmware.
 
Last edited:
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top