How can I upload my code to Atmega328p?
The arduino IDE works because the is a &quot;bootloader&quot; programmed into the 328P's that Arduino uses.
This bootloader allows the chip to be programmed using RX/TX TTL pins instead of the regular programmer.
You can actually use one Arduino to program the bootloader into another. One (of many) tutorials is here: