Menu

Flash mega2560 error

Help
2018-07-07
2021-09-14
  • stan cartwright

    stan cartwright - 2018-07-07

    If I knew the problem, I would not post.
    I changed simple ssd1306 glcd demo to mega2560. Flash hex gives - programmer returned status (-1)
    If I use Xloader to flash the gcb hex file the demo works.

     

    Last edit: stan cartwright 2018-07-07
    • Anobium

      Anobium - 2018-07-07

      Had to decode the question Stan.

      So, I figured out the following:
      1. You do not know the answer
      2. You have changed to a mega2560.
      3. I think for the first time since using v0.98.02 in terms of programming the board.
      4. You get an programming error -1 from the GCB IDE.
      5. But, XLoader works.

      So, I think the question is. What are the correctcommand line parameters in the Programmer Preferernces tool to make the Mega2560 work?

      -c wiring -p m2560 -P %port% -b 115200 -D -U flash:w:"%filename%":a

      Replace what is the with the above. Test. Report back.

       

      Last edit: Anobium 2018-07-07
  • stan cartwright

    stan cartwright - 2018-07-07

    Where is this message has been logged to error.txt stored?

     
  • Anobium

    Anobium - 2018-07-07

    GCBASIC only produces errors.txt if there is an error, that makes it easier for IDEs to detect if the program compiled successfully - if the file was not produced then the IDE would be unalbe to present the error message to the user.

    The file error.txt is always produced in the same folder as the compiler. Typically: C:\GCB@Syn\GreatCowBasic\Errors.txt

     
    • Anobium

      Anobium - 2018-07-07

      You are probably going to find the error message from the programmer is not in errors.txt

      This is because avrdude. exe issues the error message not the compiler.

      Programmers that we are developing pipe errors to programmers.txt

       
  • stan cartwright

    stan cartwright - 2018-07-07

    -c wiring -p m2560 -P %port% -b 115200 -D -U flash:w:"%filename%":a --- worked. Thank you.
    programmer returned status (-1) seems generic error for something wrong.
    I didn't note what default values were first time I've used mega2560.
    In programmer preferences -- Type in the command line parameters for the programmer here,
    It doesn't mention flash but somehow I was getting flash messages??
    Working Directory can be the folder containing the programmer exe file, or the folder containing the current program. ??

     
  • Anobium

    Anobium - 2018-07-07

    All sorted then. Explaination of the parameters when using Programmer Preferences can be found in the Contributions Section of the forum.

     

    Last edit: Anobium 2018-07-08
  • Rikki

    Rikki - 2021-09-13

    Problem:

    1) Flash button does nothing or freezes console window in GCB IDE

    2) need to unplug arduino usb cable every single time a code flash needs to be done

    Resolution:

    Download xloader (use your favorite search engine and search for "hobbytronics xloader')

    extract the ZIP to a folder

    xloader uses a modified configuration that is able to repeatedly program non-official mega 2560 boards without resetting them/unplugging USB cable each time.

    Copy and paste these three files from xloader into the AVRdude directory in the GCBasic\GCB@syn\ folder, (overwriting existing files) . Save the original files to a backup folder first if desired.

    averdude.conf

    avrdude.exe

    libusb0.dll

    In the GCB IDE menu, select IDE tools ->GCB tools -> edit programmer preferences

    Find "Avrdude (Stk500V2 @ 115200)" in the list. Click and hold then drag it to the very top of the "Programmers to Use" section.

    Click "Avrdude (Stk500V2 @ 115200)" to highlight it then click edit.

    Delete everything in the command line parameters box then paste in the following line:

    -c STK500v2 -b 115200 -P %port% -p m2560 -D -U flash:w:"%filename%":i

    On the righthand side of the editor select your comport from the dropdown list. Use device manager in Windows to identify which serial comm port your mega 2560 is connected to.a

     
  • stan cartwright

    stan cartwright - 2021-09-14

    Wow! This is so old I forgot. I just tried this on a mega2560 board I had forgotten I had!

    #chip mega2560, 16
    #option explicit
    
    dir portb.7 out
    Do
      portb.7=not portb.7
      wait 1 s
    loop
    

    I selected mega2560 in programmer preferences and pasted it to the top of the list and it flashed and worked ok. This is using the clone board I must have had problems with at the time... 5 years ago!
    Compiler Version: 0.98.07 2021-05-27 (Windows 64 bit) Program Memory: 342/262144 bytes (0.13%) RAM: 0/8192 bytes (0.0%) OSC: 16Mhz Chip: MEGA2560

    So I guess it's been sorted in gcb later releases.

    As I'd forgotten I had a 2560 board I ordered another and it says arduino and the logo so may be genuine. Still in it's anti static bag but told seller that it arrived with socket A8 to A15 bent like it got damaged in post but bent them back while still in anti static so don't know if to send back or open and try it.

     
  • stan cartwright

    stan cartwright - 2021-09-14

    I tested the new board and the pins that were bent and it works ok!

    #chip mega2560, 16
    #option explicit
    
    dir portk.7 out
    Do
      portk.7=not portk.7
      wait 1 s
    loop
    

    Seems mega2560 works ok with gcb now.

     
  • stan cartwright

    stan cartwright - 2021-09-14

    Why does the com port change between uno/nano/2560 boards change with different boards?
    Like one 2560 is com 5 and the other com 4. Same with uno and nano boards.
    The lgt328 nano board is always the same but not showing as a com port but as a serial device.

     
    • Rikki

      Rikki - 2021-09-14

      Different hardware ID number= different com port assignment by the OS
      Different USB port = different com port assignment regardless of hardware ID number

       

      Last edit: Rikki 2021-09-14

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.