Problem flashing Photon using Particle Dev in MAC

Hi, I’m new with Photon and I’m trying to flash my first example. If I try to flash it from Particle Dev in local, it says Success!, and my photon blinking as a normal process, but never installs my code, in fact, the default Tinker app is still there and works using my smartphone.

If I try to flush the example source code from the Web UI, it works !

I also found out that if I press compilation button, the xxxxxx.bin file is generated in my local. The strange thing here is, If I edit the code to introduce a clear syntax error, and then press the compilation button, everything compile ok, and no errors occurs… It seems as if the compilation (or flush) buttons are using another source code, and not my opened current file from my local editor.

Any ideas? Am I missing something?

Thank you for your help!
Diego

1 Like

I have seen this from my Mac as well, and the only way I could get it to work was to flash something – anything – from Particle Build (web) first. This seems to trigger a full-on firmware flash, as it takes a good 5-10 minutes to recover - but from then on, I can flash from Particle Dev.

I have two Photons – the process needed to be repeated with each.

Nice trick!, I’ll try it soon and back with the results.

Thank you,
Diego

I have had that problem and the above fix works. I wonder if my issue is related in some way?

I am trying to run some example code from the documentation (I am an experienced C programmer, h/w, firmware designer, etc.) but either there is something obvious that I’m missing (probable) or there’s a bug here (also possible).

The flash from Particle Build works. Flashing from Particle Dev continues to fail:

The code is the provided examples for the Web Blinky, without modification. Target is the Photon, current firmware is the latest update(0.4.4). Mac OS X Yosemite 10.10.5.

No problem flashing this code from Build. The code appears to compile under Dev, but the error says “build didn’t produce binary”. See attached screenshots. So - is there a file reference missing? Since there are no #includes, I assume all necessary core libraries would already be present during compilation on the server. Any ideas?

Second problem: The html required for the UI renders correctly, of course. When the post action takes place there is an error:

{
  "error": "invalid_request",
  "error_description": "The access token was not found"
}

The access token is that shown on the account setup page - see the code segment at the bottom. (And yes, I’ll change the numbers for the account later.) The device id is the name of the device, e.g. “corona-one”.

I sure would like to get this launched soon!

Any suggestions?

Screen shots
Project files and directories shown:

Cloud compiler error:

Html code:

<!-- Replace your-device-ID-goes-here with your actual device ID
and replace your-access-token-goes-here with your actual access token-->
<! -----  html error reported:
{
  "error": "invalid_request",
  "error_description": "The access token was not found"
}
----------------------------------------------------------------->


<!DOCTYPE>
<html>
  <body>
  <center>
  <br>
  <br>
  <br>
  <form action="https://api.particle.io/v1/devices/corona_one/led?access_token=6ebc85e7eae70d1b26e811c6256a45e0c7577788” method="POST">
    Tell your device what to do!<br>
    <br>
    <input type="radio" name="args" value="on">Turn the LED on.
    <br>
    <input type="radio" name="args" value="off">Turn the LED off.
    <br>
    <br>
    <input type="submit" value="Do it!">
  </form>
  </center>
  </body>
</html>

Guys this is definitely a problem! If I don’t save first at least once the code from WEB UI, the local Particle DEV, doesn’t work. If you save the code from WEB UI and then forces selecting the device again from the Particle Dev, it turns working again, and even the syntax verification button (in local) works again.

It seems to have a sync problem with web-ui or similar problem. :S

There is no synchronization involved between code in the Web IDE and Particle dev.

Same problem over here. Particle Dev does not flash the latest firmware. What a pain!!!

I’m having to flash a silly little program from the Web IDE in order to update the firmware and get flashes from Dev to work.

Someone please fix this! We’re at 100 devices and this is a nightmare!

Ping @jonlogan

Thanks for the heads kenneth and everyone else for raising the issue. I will review this with the team and see what we can do to get a resolution soon.

I have experienced a similar problem using Particle Dev on a Mac. When you compile or flash from Particle Dev it uses the saved code rather than any changes you make to the code within Particle Dev. Just save your changes before compiling or flashing.

Actually that is not what is happening. The Particle Dev build (regardless of save state) does not compile and load via Cloud even though the code is identical to Build and the device is identical. Saving, etc has no effect.

Actually I just tested this using Particle Dev. I have a simple program that loads a library, prints out “SI1145 Test”, initializes the sensor, and then prints out via serial the UV, visible, and infrared light levels in a loop. If I simply change “SI1145 Test” in the Serial.println statement to “SI1145 Searching” and flash the code to the Photon the program will still print out “SI1145 Test” after completing the OTA program update. However, if I click on the save icon or select save from the file menu and then flash the code to the Photon the program will print out “SI1145 Searching”. Saving your modified code using Particle Dev will insure that the modified code is what is compiled and flashed. An easy test would be to simply remove “;” at the end of any line of code in a working program and without saving click on the compile icon. It will compile with a “Success!” but if you save the program and then compile it will report an error.

right, unlike the Build web dev tool that will automatically save any changes and then compile...

It is a big difference that makes it difficult to go from one to the other and not eventually make that observation.

Ok, that s valuable ! I still have not had any success with Particle Dev - it always returns either “no .ide or .cpp file found” or “Compile complete, no exe produced” or something equivalent. This is with basic example code with no #includes.

Odd behaviour.

Are your link libraries local when using Dev? How do you define the #include file location with the Dev IDE? This should be transparent.

Intriguing problem.

Thanks for the update, I will stay tuned to this thread and update when I understand and test a solution.

Regards,
Don

Your .ino file and ALL of the associated libraries need to be in a single folder when using the Particle Dev tool. Those files and nothing else.

That may be your issue. Perhaps post the folder you are working in.

Unlike Arduino, there is no path to a collection of libraries.

OK, I understand that. But what libraries? Any dev environment I have ever worked with includes an env variable for file paths, and by default all necessary core libraries are part of the standard env. Why should anyone need to include core libraries in their source dir for compilation of extremely simple code ?

Basically guys, the issue here is Make It Simple. If this is by design, then explain how. If it is a bug, fix it. ?

So, it is by design... you have to put the header file (MyLibrary.h) and implementation file (MyLibrary.cpp) in the directory in which your program (myProgram.ino) resides... like this:

you can see that after the file is compiled (think about the word 'compile' which means 'produce while assembling') the binaries are produced by assembling the library files with your program...

Arduino is clever (but not unique) in that it has a magic path to their standard libraries, which makes things nice and easy, particularly for beginners.

for your reference,here is my #include lines in the header of the above referenced .ino file:

Notice the directory structure on the left, it matches the directory above... the same files.

Hi all, thanks for the additional info. I notified the team. If someone could, please file an issue in the github repo with steps to reproduce.

In the meantime, one workaround could be to use the particle CLI. You can pass in the name of a directory, and all the files will be pushed to the cloud, compiled, and the firmware will get either pushed to the device and/or to your computer.

Thanks everyone.

1 Like

Hi Jon,

Back to the original topic.

I would like to emphasize the Keep It Simple mantra. Seriously, the technology is there, or almost there, but the documentation and dev environment need some real work. If you need help, please PM me.

I was pointing out an inconsistency within the product line and product experience. If the documentation says “do this” one would expect the product to behave according to the documentation. This is, I think a simple case of documentation lagging the product evolution. Unless that is in step, you can expect lots of hiccups as the Particle product family matures and stabilizes. That initial experience will determine how interested your potential customers are in adding more Particle devices to their systems and explorations.

@arbutus99 thanks for the update and clarification – this is a great callout. My suggestion was a workaround, but yes, a fix could be warranted as well. As a small team with much to do, gaps in our documentation sometimes occur, not to mention bugs in our technology too. We appreciate your patience as we work to address many things in parallel.

Could you file this as an issue in our public github tracker with the gaps you observe, and a full description of your recommended fixes? This would be the best and fastest way to get it into our priority stack. (As you can imagine, we are working on a lot of things across a small team, and github is one of our best ways to escalate bugs and gaps to the team for prioritization). Thank you!