Micro not loading sketch and/or sketch not running properly

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
norlander
 
Posts: 24
Joined: Tue Oct 15, 2013 11:53 am

Micro not loading sketch and/or sketch not running properly

Post by norlander »

The attached sketch is not loading properly or running properly.

Sometimes the sketch just won't load; geets stuck in "loading..." mode. Sometimes the sketch will run, but not have audio.

This may be a noob question, but I think I have run into something that is unique to the Micro. I can't find anything wrong logically with the code, albiet it may not be elegant or efficient. I am pretty sure the code is OK, as I can comment code out sections and have it run correctly. Then move the commented out code to another spot and comment out other code and it will still run; example in commenting in/out parts of the switch/case statement.

Is there some fundamental thing I am missing in how I have written the code? Is it too big? does it have too many Serial statements? Are the interrupts for SD Card audio hapening too quickly?

I just don't quite understand the problem.

In the attached, version 7 works fine and version 8 doesn't.

thank you
Krist
Attachments
sketchs.zip
sample sketches
(6.66 KiB) Downloaded 23 times

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Micro not loading sketch and/or sketch not running prope

Post by adafruit_support_mike »

The only two significant differences between version 7 and version 8 are the name of the file ('gday.mp3' -> 'watching.mp3') and the phrase it's supposed to say (5 -> 7).

The `sayPhrase()` function seems to be input-agnostic, so I'd guess the problem lies in the file 'watching.mp3'. First of all, try replacing it with a renamed copy of 'gday.mp3' and see if it's the name or the data that's causing the trouble.

User avatar
norlander
 
Posts: 24
Joined: Tue Oct 15, 2013 11:53 am

Re: Micro not loading sketch and/or sketch not running prope

Post by norlander »

That is exactly my frustration. I did that and verified it isn't the files or the name. I have been able to make all the files work. I did this by commenting and uncommenting sections of the switch/case. each case works as coded, but errors occur when whole switch/case is active. I didn't see anything in the logic of the code and println statements confirmed the logic flow is correct. But, I am obviously missing something. That is why I was concerned about sketch max size, baud rate, interrupt conflicts, serial ports, or something like that that is more behind the scenes of the code logic.

User avatar
norlander
 
Posts: 24
Joined: Tue Oct 15, 2013 11:53 am

Re: Micro not loading sketch and/or sketch not running prope

Post by norlander »

current immediate problem is Micro will not load a sketch. gets stuck in "uploading..." even on a simple blink sketch.

User avatar
norlander
 
Posts: 24
Joined: Tue Oct 15, 2013 11:53 am

Re: Micro not loading sketch and/or sketch not running prope

Post by norlander »

got Micro to load again. took several attempts at pushing reset button during compile/load sequence. verified, version 7 is working without problem still. got version 8 to run with hardcoded case select. going back to using random case select causes problems during load and/or runtime if I am able to get it to load.

just don't know why that would make a difference.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Micro not loading sketch and/or sketch not running prope

Post by adafruit_support_mike »

It's possible that you're running into a memory issue. Try removing as many Serial.print()s as you can and see if that helps.

User avatar
norlander
 
Posts: 24
Joined: Tue Oct 15, 2013 11:53 am

Re: Micro not loading sketch and/or sketch not running prope

Post by norlander »

that was the solution that fixed my problem. thank you.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”