0
\$\begingroup\$

Hi I am unable to upload sketch to Atmel mega1284p using a mcp2221 usb to uart converter IC.

I have a simple code prints "message received" It works to program the Mega1284p using arduino nano as ISP. But not using the MCP2221 over usb. I took a long time and eventually errors out. I tried pressing reset button on ATMega while uploading, I tried swapping TX and RX. I double checked COM port. Please help.

avrdude:

     System wide configuration file is "C:\Users\hhuynh\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.0.1/avrdude.conf"

     Using Port                    : COM5
     Using Programmer              : arduino
     Overriding Baud Rate          : 38400

An error occurred while uploading the sketch

This is my setting

This is similar to how my circuit is connected

This is my setup.

This schematic is simular to how mine is setup.

\$\endgroup\$
  • \$\begingroup\$ Are you going to tell us the error you received?? \$\endgroup\$ – Bort Oct 15 '18 at 20:09
  • \$\begingroup\$ avrdude: System wide configuration file is "C:\Users\hhuynh\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.0.1/avrdude.conf" Using Port : COM5 Using Programmer : arduino Overriding Baud Rate : 38400 An error occurred while uploading the sketch \$\endgroup\$ – user201349 Oct 16 '18 at 17:21
1
\$\begingroup\$

Turns out bootloader is erased when programming using arduino as ISP. I need to re flash the bootloader and program through the MCP2221.

\$\endgroup\$
  • 1
    \$\begingroup\$ Yes, good realization. There's probably already the equivalent question here with the same answer but figuring it out for yourself is commendable. Incidentally, this is unavoidable - the ATmega series can only do a partial erase (preserving the bootloader) when manipulating the flash from an internal program. The only erase operation available via ISP is a full-chip erase, so using ISP to replace a program always and unavoidably wipes out the bootloader on these. It is however possible to use ISP to load both a program and a bootloader, either in one operation or without a second erase. \$\endgroup\$ – Chris Stratton Oct 16 '18 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.