I've just start with Arudino, and I'm delight with this platform. But, I'm facing a very strange problem.
I'm using a Duemilanove with an ATmega328, and suddenly my program got crazy. After a lot of testing (A LOT) I detected than the more size my code has, the more problems in my program. My code has 17KB, and doesn't use much SRAM (all strings are defined as constants in the code). But, as soon as I try with shorter codes (<14KB), then everything worked fine.
This makes me think... ¿Am I using a ATmega168, with 16KB? The chip is clearly identified as "ATmega328" (but with a paper label) and I can't access now to the chip.. but... ¿Is there any code I can test to check which chipset version am I using?
¿Or... is there any other cause for his behaviour?
doesn't use much SRAM (all strings are defined as constants in the code)
It's not just constants variables and arrays take up space as well as the depth of procedures. That is a procedure calling another procedure and so on.
Is there any code I can test to check which chipset version am I using?
It is built into the environment. If you select the wrong board / processor, you will get an error when you try and uplaod the code.
It's not just constants variables and arrays take up space as well as the depth of procedures. That is a procedure calling another procedure and so on.
Yes, I know, but i doesn't have any recursive procedure or something similar. I don't use pointers or string operators, so I think it can't be related to a pointer issue. But as I'm using 3th party libs I can't be 100% sure (NewSoftSerial and TinyGPS from arduiniana.org so I think it's are a sure source)
Is there any Arduino simulator or similar where I could test the SRAM use?
(all strings are defined as constants in the code)
Defining a string as "constant" does not prevent it from occupying RAM; you have to go beyond that to putting the strings in PROGMEM and using special code to fetch/store them.