When I went into the boards.txt file, I already found the line in the mega2560 section as:
mega2560.upload.protocol=wiring
so, I changed it to:
mega2560.upload.protocol=stk500v2
Unfortunately, this did not work at all, and the board now refused to compile at all. I decided to change it back to mega2560.upload.protocol=wiring
It still refused to compile at all, and gave me this error code:
Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
Error reading file (C:\Program Files (x86)\Arduino\hardware\arduino\avr\boards.txt:0): Invalid line format, should be 'key=value'
Error compiling for board Arduino/Genuino Mega or Mega 2560.
I have no idea what to do now. any and all help is appreciated
Avram_Alter:
When I went into the boards.txt file, I already found the line in the mega2560 section as:
mega2560.upload.protocol=wiring
This doesn't make sense to me. Your error message shows you're using Arduino IDE 1.8.7 but that line from boards.txt you posted hasn't been used since Arduino IDE 1.0.6.
I also don't think you understood that ancient forum thread correctly. The original advice was to change the protocol from stk500v2 to wiring, not the other way around. There is no need to do that because it's already set to wiring. Yes, there is someone on the thread who had to change it back, but that was for a completely different problem that you definitely don't have. Many thousands of people are successfully using their Megas with the standard protocol. I really don't think changing it will help. It's more likely to just compound your problems.
Avram_Alter:
Error reading file (C:\Program Files (x86)\Arduino\hardware\arduino\avr\boards.txt:0): Invalid line format, should be 'key=value'
This error means you saved boards.txt using UTF-8 BOM encoding. Please save the file with UTF-8 encoding.
Once that's resolved, please do this:
File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
Sketch > Upload
After the upload fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
Paste the error messages in a reply here USING CODE TAGS (</> button on the forum toolbar).
I used notepad++ to revert the boards.txt file to UTF-8 encoding. It seems to have worked. the mega uploaded and executed my program successfully. Thanks for the help! do you think i should still update my boards.txt file to 1.8.7?
Edit: it is no longer allowing me to upload at all:
Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
Sketch uses 2714 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 188 bytes (2%) of dynamic memory, leaving 8004 bytes for local variables. Maximum is 8192 bytes.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM6 -b115200 -D -Uflash:w:C:\Users\Ralte\AppData\Local\Temp\arduino_build_566851/volz_rfid_test.ino.hex:i
avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM6
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: ser_open(): can't set com-state for "\\.\COM6"
avrdude: ser_drain(): read error: The handle is invalid.
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude done. Thank you.
the selected serial port
does not exist or your board is not connected