hii all , there is something that i don't understand
i want to buy the
ARDUINO MEGA2560 ATMEGA2560 , and i want to load a firmware to the ATMEGA2560 at the board using the arduino ide how can i do that?? , cause from the board schematic i can see that the usb connector is connected to ATMEGA16U2-MU on the board and not to ATMEGA2560 .
i am a little confused and i am newbee to arduino i be glad for help
thanks for your help , so from what i understand the ATMEGA16U2-MU loads the ATmega2560 serially?? i see in the board schematic that the connection between the ATmega2560 and ATMEGA16U2 is through serial port .so the job of the ATMEGA16U2 is to load the firmware serially to ATmega2560 ??
Yes, but the ATmega2560 writes the sketch to its own Flash memory (the bootloader does that).
The ATmega16U2 has firmware to present itself to the computer as a serial port over USB.
The ATmega2560 has a bootloader, and the computer can communicate with the bootloader (with the ATmega16U2 in the middle).
When you upload a sketch, the sketch is written in the Flash memory of the ATmega2560, next to the bootloader. The actual writing to Flash memory is done by the bootloader.
If you do a Serial.println() to the Serial Monitor on the computer, then the TX pin is used, via the ATmega16U2 and to the computer.
Now you also know that you should not use pin 0 and 1, because those are the RX and TX pins that are used to get the sketch in the ATmega2560.
hii
thanks for your reply , now i understand how it works , but i have one more question
lets say i am developing my own custom board using ATMEGA16U2 and ATmega2560 and my board will be exactly like the atmega2560 dev board with additional peripherals, where i can get the firmware to ATmega16U2 and the bootloader for ATmega2560 in order to sketch the ATmega2560 ??
or is it a default firmware's supplied with the chips once i buy them.
i just connect the chips according to the ATmega2560 schematic and i suppose to see my custom board in arduino IDE ?
packages/arduino/hardware/avr/1.8.6/bootloaders/stk500v2/Mega2560-prod-firmware-2011-06-29.hex
or maybe
packages/arduino/hardware/avr/1.8.6/bootloaders/stk500v2/stk500boot_v2_mega2560.hex
If the firmware currently loaded includes DFU (Direct Firmware Update) mode you should be able to use the Atmel FLIP program to upload new firmware. Here are instructions:
If the DFU firmware has been overwritten you will need to use an In-System Programmer (ISP) like the USBasp or USBtinyISP to burn fresh firmware. On my Mac the firmware you want appears to be this file: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/firmwares/atmegaxxu2/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex