Bug? Impossible code to upload on MEGA 2560


today there strange problem. code not upload anymore. tried other board, same problem. tried come , problem persisted.
then removed last code made , problem gone.
i made short peice of code same.

to clarify not need have ram connected run test. compile , upload should trick.

code: [select]

#include <spi.h>
#include <spisram.h>
/* header spiram.h
copyright (c) 2010 arms22 (arms22 @ gmail.com)
microchip 23x256 spi sram library arduino
*/
//the spi ram 8x128k in size

#define csram 7

spisram myram(csram); // cs pin

void setup()
{
 serial.begin(115200);
 pinmode(csram, output);

 spi.begin();
 spi.setbitorder(msbfirst);
 spi.setclockdivider(spi_clock_div2);
 spi.setdatamode(spi_mode0);

 //dangerous code!!!!!!!!!!!!!!!!! upload not work this
 serial.print("testing ram :");
 myram.write(0x1ffff,0);
 myram.write(0x1ffff,85);
 if(myram.read(0x1ffff)==85)
 {
   serial.println("ram ok!");
 }
 else
 {
   serial.println("ram fail!!!!!!!!!!");
   serial.println(myram.read(0x1ffff));
   serial.println("remove power, remove battery backup. reinstall battery. retry");
   //   spiramtest();
 }

}

void loop()
{
 while(1)
 {
   serial.println("do something");
 }
}


i tested code on:
mega 2560 r3
mega 2560 (by sainsmart)
mega 2560 r1 (?) arduino board no mention of release code

mega 1280 tinker.it here code uploads fine.
i tried on arduino ide 1.0.1 , 1.0.5. osx on osx 10.7.5

about spiram have been using library on year , never had problems.

first thought address 0x1ffff outside of address space if use 0x1ff00 problem persists.
and strange code compile correctly can cause kind of error. code execution starts before programming has been completed. should impossible prevent errors this.

if have older bootloader, 3 !!! interpreted thing halts process.
update bootload code, or remove !!!s.


Arduino Forum > Using Arduino > Installation & Troubleshooting > Bug? Impossible code to upload on MEGA 2560


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support