MCUdude / MegaCore

Arduino hardware package for ATmega64, ATmega128, ATmega165, ATmega169, ATmega325, ATmega329, ATmega640, ATmega645, ATmega649, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega3250, ATmega3290, ATmega6450, ATmega6490, AT90CAN32, AT90CAN64 and AT90CAN128
Other
384 stars 118 forks source link

uploading through USB #186

Closed ilikegitlab closed 2 years ago

ilikegitlab commented 2 years ago

This is probably not a bug, but I'm confused, so maybe at least the documentation can be slightly improved.

Goal for me was a nice way to configure 8 Mhz and lowerering BOD voltage on an Arduino mega 2560. I burned the MegaCore boatloader using a second arduino. This works fine. I uploaded a sketch via the second arduino, which also works fine, and the sketch now runs happily at 8 Mhz and 3.3V (though it seems i now need double the Baudrate for serial comm over the usb port on the mega).

What does not work is uploading sketches over USB: avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00

Is this intended? I've tried with the same settings (ATmega2560, 8Mhz ext) as for burning the boatloader (and various other options).

The documentation says: ".. you can upload your code in two ways: Disconnect your programmer tool, and connect a USB to serial adapter to the microcontroller, like shown in the pinout diagram. Then select the correct serial port under the Tools menu, and click the Upload button. If you're getting some kind of timeout error, it means your RX and TX pins are swapped, or your auto reset circuity isn't working properly (the 100 nF capacitor on the reset line). Keep your programmer connected, and hold down the shift button while clicking Upload. This will erase the bootloader and upload your code using the programmer tool.".

I figured I have already an USB-to-Serial: its on the Arduino board driven by the , but maybe it now stopped working? Or do I need this 100 nF capacitor to make uploading working (it is actually not exactly clear to me where to put it when using the usb connection driven by the 16u2 mcu)?

JAndrassy commented 2 years ago

upload with programmer deletes bootloader

MCUdude commented 2 years ago

The docs were recently updated to reflect some boards.txt changes (support for the original Arduino MEGA 2560 bootloader), but since I haven't done a new release yet, these changes aren't present in the latest boards manager version.

All that's needed to do is to:

Now the LED on your Arduino MEGA should flash twice every second. This indicates that the bootloader is present. Now you can upload using the onboard 16u2 USB to serial chip.

ilikegitlab commented 2 years ago

I think this did not work. But I will do a clean test today and report back

ilikegitlab commented 2 years ago

I'm going to close this. It does work. But I spend many hours. I still do not fully understand the issues I had. With the latest git, I still had issues, but it may be that the problem was using Arduino as ISP without a capacitor (I left things at work), and even although avrdude claimed everything was fine, maybe it wasn't. Since I disabled the auto reset in software, it seems to work better (still had some trouble getting a sketch running but then suddenly it did).

Thanks for your input and sorry for the noise!