The Mega 4808 can normally programmed over UPDI. The UPDI Interface is great, you need only one data wire and ground, but in some cases you wanna program the microcontroller at your board and you don´t want to make a UPDI Programmer on this board. In this cases you can use a bootloader for programming.
In this post we use the Mega 4808 with the Optiboot bootloader. The bootloader is implemented in the MegaCoreX. If you don´t know how to start with the Mega 4808 and Arduino you can read the Getting started with Mega 4808 and Arduino post.
Lets start. At first choose the Mega 4808 and choose you favorite Mega 4808 settings. Choose also the UART for the bootloader interface. Only over this UART you can programm the Mega 4808 via the bootloader.
The pinout for the UART you can find in Mega 4808 Arduino pin usage / pinout. Now check if you select the correct Programmer. After this connect you UPDI programmer to the Mega 4808. Now we can start to program the bootloader. Click at the burn bootloader button under tools for programming the bootloader on the Mega 4808.
Now we have successfully burned the bootloader on the Mega 4808. Now every time we wanna program the Mega 4808 we must choose the bootloder in the Mega 4808 settings like in the image above. If you choose no bootloader the program overwrites your bootloader and you need to program the bootloader again.
If you wanna program the Mega 4808 via the bootloader you can connect the USB to UART converter, CP2102 or something else, to the Mega 4808 and power it on. Please make sure that the logic voltages from the programmer and Mega 4808 are the same. Choose also the correct COM Port of your USB to UART converter. Now you can program the Mega 4808 via Arduino. You need to reset the microcontroller before programming, because the bootloader only starts after a power on or a reset.
Now you can use your Mega 4808 with the Optiboot bootloader.
Other posts about Mega 4808