Second photo with Nano looks good for me but check the connections with the DMM. Sometimes wires are no reliable.
You do not need the capacitor with Arduino as ISP if you see "Using Programmer: stk500v1".
The capacitor prevents the source board from resetting but stk500v1 does not generate reset pulse.
USBasp can have problem with the raw chip because of default internal clock settings. You have to use slow SCK. There is jumper on USBasp for this, or use the avrdude command with -B parameter to decrease the frequecy, or upload the FW into the USBasp which do this automatically. Google for more informations.
Anyway, it should work for Nano as is.
okay, i have tried it on different computer, and indeed it works. thanks a lot.
so i have uploaded blink on the amtega328pb, and transferred it on my board.
however there is another issue, the diode on my board runs 16x slower, so the chip is running on 1MHz? even if i have 16MHz crystal.
tried:
different atmega328pb
different crystal
remove some components
i have another board(previous revision of the same board) and it works just fine (it has atmega328p)
It is possible. It depends on the fuses. You have to set them to use an external clock/crystal/resonator. There is also possibility to set the division factor. Factory default is set to internal 8MHz oscillator divided by 8, hence 1MHz.
Probably this is it. It uses internal clock because without the clock ATmega won't start. Check out the datasheet.
Another thing. R1 why? You probably took it from UNO schematics. It is not needed. In fact it can cause problems. If you do not check the oscillation on the oscilloscope, it is better to not use it.
okay... my bad, I had the crystal soldered the wrong way, so now i can upload bootloader successfully.
But now it seems like the bootloader is being erased. I got the "bootloader burned successfully" message from the arduino IDE.
The board is recognised by the computer, but when i tried to upload code i get the "avrdude urclock_getsync() warning: attempt 1 of 10: not in sync" message.
I found that if the board has bootloader the SCK diode should blink few time after reset, but my board isn't doing that.
what could cause the issue?
Could it be bad Atmega328?
yea, seen it at UNO schematic's. removed it from the board, thanks for advice.
good idea. I'm using KiCad to draw my boards, and when i was selecting the footprint for my crystal (3.2mm x 2.5mm footprint) i had to edit the pad number to match my crystal, (the crystal is diagonally in the case, pin 1 and 3) and i did it the other way around. so i just rotated the crystal on the board by 90deg and its working now.
I found out that MiniCore uses Urboot bootloader which don't have to blink on reset( as far as i read) so i will try optiboot. If that wouldn't work, will try avrdude, then get back here. Thanks for your help.
Also forgot to mention that when I upload code via "Arduino as ISP", so bypass the bootloader, the code runs fine.
it's working!
I have tried https://github.com/WestfW/OptiLoader arduino sketch, and it recognised the atmega328pb chip correctly, and loaded bootloader for atmega328p on it, and for some reason it works now. And now when i upload code, Arduino IDE writes it has detected atmega328p chip.
Any idea why that could be?
Anyway thanks a lot for help, I really do appreciate it.
At the time I wrote optiLoader, there was no "core" support for the 328pb, so the "trick" was for the bootloader to identify it as an ordinary 328p. Since the pb is a superset of the p, that enabled people to use it during the "great 328p shortage"...