Hello everyone!
So, things are like this, I wanted to make some simple boards with uC like ATMega8 or ATMega328, DIP package versions. I program them using the FTDI circuit with the FT232RL:
I managed to do this, but I didn't have many pieces. I decided to try something else, and I bought some microcontrollers from a well-known
website where many cheap things are sold, and I found 10x pieces of ATMega8AU-TH in the SMD package version at a low price. I bought them and started to modify the circuit (basically, in the circuit below I changed the DIP version of the uC with the SMD version; maybe it's not the best, anyway), but I can't program the uC. Funny thing, I also had an Arduino Nano (not original) with damaged uC and serial chip, which I took down. I soldered an ATMega8AU-TH instead and even managed to program uC using FTDI as well.
The question would be, seeing my circuit, do you identify any reason why I can't program the uC?
Another idea that came my mind would be that uC is damaged, unlikely, or maybe I damaged it.
Genuine, new ATmega chips come from the manufacturer with no bootloader and the fuses set for internal RC clock, with the CKDIV8 fuse set so that the MCU clock frequency is about 1 MHz.
You need an ISP programmer to change the fuses to use an external crystal, to unset the CKDIV8 fuse, and to load a bootloader. You can use another Arduino as an ISP programmer.
This tutorial explains most, if not all of what you need: Gammon Forum : Electronics : Microprocessors : How to make an Arduino-compatible minimal board
Many chips you buy on Aliexpress are not genuine, and may even be nonfunctional fakes.
Did you repeat the burning of the bootloader (as described in the "program" link that you provided) for those chips that failed to work with the FTDI?
Can't you burn the bootloader or can't you program using FTDI? We do not know what your modification looks like; I suggest to double / triple check the wiring and check the orientation of the microcontroller.
The circuit for the ATMega8AU-TH that I presented above is the current one. The other circuit with FTDI is the one I used to program the uC (I provided the link to see the source of the information), and following it I managed to program other uCs, including this ATMega8AU-TH, but placed on an Arduino Nano board (the old uC was damaged, and the adapter for the serial chip). I'm going to check the schematic from the Arduino Nano one more time to compare it with my schematic, because I can't explain why one board worked and the other didn't. And I will also check the information from @jremington.
By the way, I followed the circuit with the FTDI as is and am able to program other uCs without bootloader. Anyway, my circuit only includes the uC, so every time I need to program the uC I will use the FTDI module.
I'm going to check the schematic from the Arduino Nano one more time to compare it with my schematic, because I can't explain why one board worked and the other didn't.
Thank you for information.
I will be back with an answer.
I ran the "Atmega board detector" sketch and I got this:
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x93 0x07
Processor = ATmega8A
Flash memory size = 8192 bytes.
Writes are timed, not polled.
LFuse = 0xE4
HFuse = 0xCA
EFuse = 0xFF
Lock byte = 0xCF
Clock calibration = 0xA6
Bootloader address = 0x1C00
Bootloader length = 1002 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
So the chip was detected. It's ok so far. I typed V to verify the chip as it is:
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
Verifying ...
No errors found.
Done.
Programming mode off.
Type 'C' when ready to continue with another chip ...
No errors, which is good.
Next, I ran the "Atmega board programmer" sketch and press G to program the chip:
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x93 0x07
Processor = ATmega8A
Flash memory size = 8192 bytes.
Writes are timed, not polled.
LFuse = 0xE4
HFuse = 0xCA
EFuse = 0xFF
Lock byte = 0xCF
Clock calibration = 0xA6
Bootloader address = 0x1C00
Bootloader length = 1002 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x1C00
Committing page starting at 0x1C40
Committing page starting at 0x1C80
Committing page starting at 0x1CC0
Committing page starting at 0x1D00
Committing page starting at 0x1D40
Committing page starting at 0x1D80
Committing page starting at 0x1DC0
Committing page starting at 0x1E00
Committing page starting at 0x1E40
Committing page starting at 0x1E80
Committing page starting at 0x1EC0
Committing page starting at 0x1F00
Committing page starting at 0x1F40
Committing page starting at 0x1F80
Committing page starting at 0x1FC0
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xE4
HFuse = 0xCA
EFuse = 0xFF
Lock byte = 0xCF
Clock calibration = 0xA6
Done.
Programming mode off.
Type 'C' when ready to continue with another chip ...
In the tutorial there were two options: " Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ... " . I do not receive this message in my case. Probably the reason for this is that I already have a 16MHz crystal in the circuit. Anyway, I verified the chip again:
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
Verifying ...
No errors found.
Done.
Programming mode off.
Type 'C' when ready to continue with another chip ...
So, it did not work in my case. I don't see that the circuit from the following steps, for MCU programming, differs from the one posted above.
I will use another MCU, I have plenty.
Sorry, I have no idea what you mean by "did not work". The programmer successfully did quite a bit of stuff.
I was referring to the fact that although I followed the instructions and got no errors, I still can't program the MCU using the FTDI adapter, and I have two options for that. The first is the default one, from the Arduino IDE:
Board: arduino NG or older
Processor: ATMega8
The second is as I saw in the first tutorial, using Minicore library, and this method worked for me with other MCU.
Since I have the SMD version of the ATMega8 (so I can't use it on the breadboard) and I have placed all the components as in the circuit, I will try another way. I'll just solder only the MCU on the board, then follow the steps in the tutorial again. I already had a 16MHz crystal in the circuit and that I ran the "Arduino Board Programmer" sketch, but I don't have the "L" or "U" option.
I'll come back with a reply.
Most likely this is a problem with the MCU clock and/or UART baud rate.
The check for those is to use the ISP programmer to upload a simple Arduino program that blinks the LED at 1 Hz, to check the MCU clock rate, or outputs a stream of 'U' (uppercase character), and use an oscilloscope to check the bit rate of the output.
Or, just use the ISP programmer to upload code. Then, all of program memory is available for the application.
A friend suggested me to use an AVR USP ASP programmer, and I tried it and it works.
I don't intend to program the MCU too often, once the project is finished it will stay that way.
I really don't know why I didn't succeed with FTDI, I was probably doing something wrong.
Solution! https://www.youtube.com/watch?v=ToKerwRR-70&ab_channel=ZeroAmpsElectronics