Suddenly can't reprogram my Core!

Hello everyone. I’ve been doing some Core programming over the last couple of days. Through that time, I have had numerous stability issues (about 5 factory resets in 2 days). Well, last night was the clincher…I couldn’t find solutions on the forum, so I guess it’s time to ask for help!
A quick summary: After struggling all day with unexplainable code results (generally crashing in multiple “println()” statements), I finally FLASHed the code example from TCPClient hangs up core. It worked amazingly well…but only for a few minutes before locking up; a simple reset gets another few minutes of run time. (Probably another question, but I’ll stay on topic for now!) BUT now I cannot reprogram the Core with my original project! I loaded my original project into Particle Dev, and clicked “Compile and upload code using cloud.” Compiling…uploading…flashing magenta…solid white…flashing green…breathing cyan. And guess what: the Core is still running the example code, NOT my project! I’ve FLASHed my project about six times now, restarted Particle Dev (on Win 7 Ultimate x64) three times, unplugged and/or pressed the RESET button on the Core each time I’ve tried to program it, Factory Reset the Core, shut my computer down, went to sleep, woke up, and tried again—and in every case, after the “cloud upload” (flashing magenta), the Core runs the code example, not my project! What in the world is going on?

To reiterate:

  • I load my project into Particle Dev (NOT the example!)
  • Click the “compile and upload code with cloud” button
  • Core starts flashing magenta (“programming”)
  • Core successfully completes programming, and restarts
  • The Core runs the example code I flashed last night, not what I wrote! Of this I am absolutely, 110% positive. 'Cause the example code hosts an A/D readout webpage…my code is supposed to light an LED (which remains dark).

This is the first time I’ve had a problem like this, and obviously, I’m grounded until it’s resolved! I have a half suspicion that the Core is not running the latest firmware, as I’m having problems with it that are marked “SOLVED” on this forum (I.E. TCPClient hangs up core). Please don’t tell me to go to GitHub and compile the latest firmware—I must admit that toolchains and I do NOT mix. Past attempts generally have resulted in property damage (IP or otherwise :slight_smile: )

Any idea what’s going on?

Try flashing the app via DFU mode.

(groan). Will try to figure out how to do that. All I have installed is Particle Dev…

After a factory reset, the app flashed via OTA doesn’t run?

Determining based on the output might be hard guessing. I would recommend doing a Spark.publish() and get a random value before OTA flashing each time and check that the value was the published one when the core gets online :wink:

OK, did a factory reset. Restart Core, give it WiFi credentials. Good and hunk-dory.

1st attempt to flash my program: flashed magenta for awhile, then went to breathing cyan. Neither program FLASHed–I have no idea what’s in it.

2nd attempt to flash my program: flashed magenta for awhile, and is now flashing green (very unevenly), for about 3 minutes (while I write this).
OK, reset the Core.

Wait…now it restarts to a flashing green LED (or is it supposed to be orange–I see the red chip dimly lit). Factory reset #2

Wifi credentials…(oh yes, that does black out Particle Dev. Restart Particle Dev so I can click any of the buttons…)

3rd attempt to flash my program: flashing magenta for awhile (programming)…then right back to unevenly flashing green. After a minute, finally booted to breathing cyan. It sure isn’t running my code (board LED isn’t lighting, no RS-232 output, etc.) Guess what: It’s running the old webhost example code again!

Sorry, @kennethlimcp

After a factory reset, have you tried whether or not Tinker is running? If you’d like to, you can check this to see your exposed functions/variables. If you haven’t yet done so, it’s definitely worthwhile installing the CLI. As you progress it will become increasingly more useful, and you’ll start to use it more often. being able to flash over USB (DFU) is very useful, as well as a lot faster :smile:
Rather than trying to flash your new code, could you try flashing the ‘blink an LED’ example to see it that works?

Yes, after a factory reset, Tinker runs. I flashed “led_blink” via Particle Dev, and the LEDs start blinking away. Hmm???

Aha…possible flash…is it possible that Particle Dev is purposely flashing the example code file, even though it’s in a subfolder of my project folder, and not linked to in any way by the main file that I have open? I know that I have to #include files into my project, but this is not one of them.

Okay, so flashing work, and it will happily take new firmware.

Particle Dev is very picky about how you organise your files. You should keep your projects in their own folders, without subfolders, whenever possible. A ‘flat’ directory seems to work best with the least possible issues.
Furthermore, you need to make sure you save your project before hitting flash, since it will compile the last saved version. It won’t automatically save it.
Could you try creating a clean directory with your project files, and retry the flashing process?

Yes. I renamed the example file to a TXT document (but probably should get all those files out of there completely), and presto: it flashed my project (LED lit up, etc.) Back to the original issues (which I’m afraid you’ll be hearing from me about). But that’s what the community is about.

Yes, I figured out pretty quickly that I had to save the files if I wanted to see my changes! Having worked in the past with PSPad and a toolchain (oops, there I go—but I could never get “make” to work), it didn’t take long to realize that I had to save the files first! Thanks for the reminder, though.

Thanks for your quick responses @kennethlimcp…while I’d probably have figured this out on my own in another couple of frustrating days, thanks for your help.

P.S. Now I’m trying to figure out why it isn’t flashing “Base64Converter.exe” to the Core. If we could have Windows on the Core…yes, I’m teasing ;-).

1 Like

Yup, back to the same ol’ problems: crashing the core with TCPClient.println(“text”);
I’m pretty much stumped, but should create a new topic for that.

Before marking this thread SOLVED, is there a way to make sure that the Core has the latest firmware? I don’t want to be banging my head against the wall for some bugs that have already been fixed “in the cloud.” I have Particle Dev 0.0.23, downloaded last week.

I you don’t mind waiting for a bit, there’s a big release scheduled in the not too distant future. It’s 0.4.2 for both the Photon and the Core, and should offer various improvements. You could try updating the CC3000 firmware though, if you haven’t yet done so, and still have an ‘old’ Core. To do so, you’re going to need the CLI (which I recommend installing anyhow).

OK, off to install the CLI, and will try to update the CC3000, as I really can’t explain the bugs I’m experiencing. The web example works fine…but when I pretty much copy-paste the code into my project, well, it doesn’t work and crashes the Core (flashing red LED, reboot). No interrupts, just a button-press to a web host subroutine.

Just a small correction - the 0.4.2 release will be for the Photon only. The Core release will be 0.4.4, scheduled mid July.

5 Likes

@mdma, @suda Interesting again a forum member is referring to the strict requirements for namind and storage of Dev programs. All of which should be handled by the IDE, like it is in all the “civilized” IDEs. :smile: