
In older electronic equipment that has been withdrawn from use, you can find interesting elements, including various types of microcontrollers.
Although nowadays 32-bit microcontrollers with high computing power and network interfaces are easily available for a small amount of money, sometimes an older 8-bit chip, obtained, for example, from a device intended for disposal, may be enough to implement the project.
Particularly interesting are the 89S5x chips from Atmel. These are devices belonging to the 8051 family, equipped with an ISP interface (the letter S in the designation), which today is nothing unusual and even a norm, however, it should be remembered that other devices from this family could only be programmed in parallel (e.g. AT89C51 , not to mention non-flash versions).
I was starting to design a DCF77 clock with a programmable controller function and I was looking for a suitable processor.
Since I have several 89S52 systems from disassembly in my collection, I decided to use them for this purpose. In order for the development process to run in accordance with current standards, of course I wanted to use ISP for programming. It turned out, however, that all AVR programmers that I have are not able to communicate with the 89S52 in a serial way.

A short web search led me to the USBasp project: https://www.fischl.de/usbasp. Within a few hours, a prototype with ATmega8 was created, mounted on a universal board. The launch went without a problem, the avrdude program detected the programmer.
Unfortunately, when trying to read the content of 89S52, I got the following message:
Code: bash
Something was wrong with the communication on the USBasp - AT89S52 line.
Debugging with an oscilloscope and searching the web yielded the answer. The problem was that USBasp had a hardcoded procedure for setting the RESET pin on the ISP interface. The AVR chips have a negated RESET input, while the 89S5x chips have a non-negated input. In other words, the RESET active state for AVR is low, for 89S5x it is high.
The author of USBasp has placed sources on his website where you can find the reason for this state of affairs:
[syntax=c]void ispConnect() {
/* all ISP pins are inputs before */
/* now set output pins */
ISP_DDR |= (1
Cool? Ranking DIY