Go Down

Topic: No code execution after power cycle (Read 608 times) previous topic - next topic

mkc2lr

Dec 26, 2016, 03:22 am Last Edit: Dec 26, 2016, 03:31 am by mkc2lr
Hello,

I'm quite experienced with single PCB linux based systems, but I'm really beginner on Arduino. And even though Arduino is quite popular, I have significant trouble to find basic information for setup.
Meanwhile I can compile and upload, I can interface with Processing on my Mac, but every time I do a power cycle, the Arduino seems to have lost the uploaded file.
To my understanding it should have a flash, does the IDE only load the code into the RAM? Is there any possibility that the Arduino executes my code on power on?
I'm using a MKR1000.
I found this issue in the troubleshooting guide, but I don't understand. I suggests that the cause may be serial data coming in. But I just connect the board to a USB power supply. Same if I connect it to the laptop.

Thanks in advance !


Cheers,
Christof

sterretje

There is a dedicated MKR1000 section. You can ask a moderator to move the question there.

What are the symptoms? It might be that the Mac assigns a different port every time that you reset the MKR1000 and if your program uses serial comms it will fail.

Go back to the blink example, change the delay to something that you can easily distinguish from the default and check the behaviour.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

mkc2lr

Thanks a lot for your answer sterretje !
I tried the basic blink example and you're right. It works after reset. Then I tried my code, it doesn't.
Then I commented all serial debugging messages, then it also worked !!!   :o

But it's quite inconvenient to comment all messages and if you want to continue, you need to uncomment again. Is there no more elegant way to get around this issue?


Thanks,
Christof

SupArdu

When you find strange behaviour of your sketch always think about RAM shortage. The Uno e.g. only has 2k.

If you have a lot of debugging print's with a lot of text then use the F macro.
Serial.print(F("long text));

When using the F macro, the content of the string will be stored in Flash memory not in RAM.
-------------------
have success
SupArdu

sterretje

When you find strange behaviour of your sketch always think about RAM shortage. The Uno e.g. only has 2k.

If you have a lot of debugging print's with a lot of text then use the F macro.
Serial.print(F("long text));

When using the F macro, the content of the string will be stored in Flash memory not in RAM.
OP is using a MKR1000; not that likely to run out of memory.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

mkc2lr

Thank you for your answers.
I don't think that it's a RAM issue as the code works well after upload.

Just after reset it doesn't. It rather seems to be a general issue with serial communication.
No solution for this? This must be a pain for everyone...

Cheers
Christof

Go Up