Can't upload sketch to Mega 2560

When I insert the USB jack into my Mega 2560, the TX, RX and L lights come on immediately (and of course, the ON light). If I press the Reset button, the L light blinks once and the TX and RX lights remain on solid.

When I try to upload a sketch (I've tried various ones) I get the following messages:

Sketch uses 10,630 bytes (4%) of program storage space. Maximum is 253,952 bytes.
Global variables use 598 bytes (7%) of dynamic memory, leaving 7,594 bytes for local variables. Maximum is 8,192 bytes.

avrdude: stk500v2_setparm(): failed to set parameter 0x9e
avrdude: stk500v2_command(): unknown status 0xc8
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500v2_command(): unknown status 0x01
avrdude: stk500v2_disable(): failed to leave programming mode

I've tried the Loopback test - that works OK.
I've tried various USB cables. I've even tried an external 9V power source and the same lights come on .
What does this message mean?
"Double check connections and try again, or use -F to override this check."
Specifically, what does "-F" mean in this context?

I was just searching through some some old posts on this topic and found one with an admonition to “NEVER USE !!! IN YOUR CODE” as it causes the bootloader to hang. S0 - I looked in my last sketch that successfully loaded to this 2560 and found the following line of code:

    pingScan();                    // fix logic bug here!!!!

Could this be the culprit??

If so, how can I fix the problem? Do I have to re-load the bootloader? (aaargh!!!) (oops -I’ll have to stop that.)

dandrum:
When I insert the USB jack into my Mega 2560, the TX, RX and L lights come on immediately (and of course, the ON light). If I press the Reset button, the L light blinks once and the TX and RX lights remain on solid.

When I try to upload a sketch (I've tried various ones) I get the following messages:

Sketch uses 10,630 bytes (4%) of program storage space. Maximum is 253,952 bytes.

Global variables use 598 bytes (7%) of dynamic memory, leaving 7,594 bytes for local variables. Maximum is 8,192 bytes.

avrdude: stk500v2_setparm(): failed to set parameter 0x9e
avrdude: stk500v2_command(): unknown status 0xc8
avrdude: initialization failed, rc=-1
        Double check connections and try again, or use -F to override
        this check.

avrdude: stk500v2_command(): unknown status 0x01
avrdude: stk500v2_disable(): failed to leave programming mode




I've tried the Loopback test - that works OK.
I've tried various USB cables. I've even tried an external 9V power source and the same lights come on .
What does this message mean? 
"Double check connections and try again, or use -F to override this check." 
Specifically, what does "-F" mean in this context?

The -F is a command line argument, since the IDE is just calling AVRdude behind the scenes, and if you were running AVRdude from the console, you could use the -F argument. However, almost invariably when you see that message, it's warning of a legitimate error condition (typically a wiring problem, or incorrect board selected, or something like that), and using -F to ignore it will only get you deeper into the woods.

The "!!!" bug only applies to cases where the !!! is making it through to what the IDE tries to upload to the board - so pretty much string literals, or arrays with a particularly unfortunate series of values - comments are stripped out during compilation, so it doesn't matter if you have "!!!" in your comments. If you are impacted by this bug, uploading other sketches will work, as long as they don't have a "!!!" in them. Burning bootloader using an ISP programmer will fix the problem with the "!!!" issue (it was present only in an old version of the bootloader, not the current one).

Can you attempt an upload with verbose uploads enabled, and post the results here?

Thanks for your quick response. Hope this is what you need (I've never done this before)
Why are the TX and RX leds staying on constantly? Is this not an indication of a problem?

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: stk500v2_getsync(): got response from unknown programmer , assuming STK500
         AVR Part                      : ATmega2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Wiring
         Description     : Wiring
         Programmer Model: STK500
avrdude: stk500v2_command(): warning: unknown, code 0x90
avrdude: stk500v2_getparm(): failed to get parameter 0x90
avrdude: stk500v2_command(): warning: unknown, code 0x91
avrdude: stk500v2_getparm(): failed to get parameter 0x91
avrdude: stk500v2_command(): warning: unknown, code 0x92
avrdude: stk500v2_getparm(): failed to get parameter 0x92
         Hardware Version: 255
         Firmware Version Master : 254.255
avrdude: stk500v2_command(): warning: unknown, code 0x9a
avrdude: stk500v2_getparm(): failed to get parameter 0x9a
         Topcard         : Unknown
avrdude: stk500v2_command(): warning: unknown, code 0x94
avrdude: stk500v2_getparm(): failed to get parameter 0x94
         Vtarget         : 18.1 V
avrdude: stk500v2_command(): warning: unknown, code 0x98
avrdude: stk500v2_getparm(): failed to get parameter 0x98
avrdude: stk500v2_command(): warning: unknown, code 0x95
avrdude: stk500v2_getparm(): failed to get parameter 0x95
avrdude: stk500v2_command(): warning: unknown, code 0x96
avrdude: stk500v2_getparm(): failed to get parameter 0x96
avrdude: stk500v2_command(): warning: unknown, code 0x97
avrdude: stk500v2_getparm(): failed to get parameter 0x97
         SCK period      : 116.6 us
         Varef           : 19.8 V
         Oscillator      : 22.897 kHz

avrdude: stk500v2_command(): warning: unknown, code 0x9e

avrdude: stk500v2_setparm(): failed to set parameter 0x9e
avrdude: stk500v2_command(): unknown status 0xc8
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500v2_command(): unknown status 0x01
avrdude: stk500v2_disable(): failed to leave programming mode

avrdude done.  Thank you.