To enable the JTAG Interface on an Arduino Mega the JTAGEN fuse bit must be set to zero.
A modified Arduino bootloader with JTAGEN fuse bit enabled can be programmed by using an Arduino Uno as ISP (In-circuit Serial Programmer).
The Arduino IDE can be used to burn the bootloader after making the following modifications to <Arduino IDE Path>\hardware\arduino\avr\boards.txt
"C:\Program Files (x86)\Arduino\hardware\arduino\avr\boards.txt"
The following calculator can be useful to calculate the correct value: Fusecalc
The mega.menu.cpu.atmega2560.bootloader.high_fuses value is modified from 0xD8 to 0x98
## Arduino Mega w/ ATmega2560 ## ------------------------- mega.menu.cpu.atmega2560=ATmega2560 (Mega 2560) mega.menu.cpu.atmega2560.upload.protocol=wiring mega.menu.cpu.atmega2560.upload.maximum_size=253952 mega.menu.cpu.atmega2560.upload.speed=115200 # mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD8 mega.menu.cpu.atmega2560.bootloader.high_fuses=0x98
Connect the Arduino ISP (Arduino Uno) to the target (Arduino Mega).
Connect the Arduino ISP (Arduino Uno) to the PC with an USB cable.