Author Topic: How do I know when my Arduino sketch uploaded successfully?  (Read 6147 times)

werner

  • Newbie
  • *
  • Posts: 37
How do I know when my Arduino sketch uploaded successfully?
« on: February 09, 2016, 02:38:42 am »
I was able to connect my Oak and can see it in https://dashboard.particle.io/user/devices.

I can also start an Arduino IDE upload which gives me this:

Code: [Select]
Sketch uses 306,298 bytes (29%) of program storage space. Maximum is 1,040,368 bytes.
Global variables use 55,952 bytes (68%) of dynamic memory, leaving 25,968 bytes for local variables. Maximum is 81,920 bytes.
Sending file to cloud, to flash to device.
Device flashing started successfully.

Problem is, after this point I have no way of verifying the code actually made it to the Arduino or is in fact running.   Is the fact that it says "Device flashing started successfully" enough confidence to know it was successful?

Another question:   My Arduino IDE does not seem to pick up a serial port associated with the device.  Is that expected or do I still need to download some driver for that?   Or is the USB Micro connector on the Oak just to supply power?   Should I connect a FTDI USB to serial to the board in order to see printf outputs of my Arduino program?

kirby

  • Newbie
  • *
  • Posts: 19
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #1 on: February 09, 2016, 03:57:22 am »
In my limited experience 'Device flashing started successfully' is not a guarantee that the device got programmed. When everything goes as you want it to, the indicator (not power!) led will flash fast for several seconds.

You need no connection between the Oak and your computer. I have verified this by uploading sketches while my Oak was on a battery. If I understand things correctly, the arduino environment sends the compiled sketch to particle.io which then programs the Oak over WiFi. Somebody please correct me if I am wrong.

Check your dashboard on particle.io. Is your device registered?

werner

  • Newbie
  • *
  • Posts: 37
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #2 on: February 10, 2016, 12:00:18 am »
Yup, device is registered on particle.  I've got a suspicion the sketch actually loaded, but I'm now busy trying to add a FTDI cable so I can see what comes out of the serial port.

werner

  • Newbie
  • *
  • Posts: 37
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #3 on: February 11, 2016, 12:25:08 am »
Some more questions :
1.  How long does it typically take after you see the "Device flashing started successfully" message, until the sketch starts to run on the Oak?
2.  I registered several devices on the Particle cloud, which may all be powered up at the same time.  How do I control which one is programmed?

Sorry about the newby questions, but it will probably help others as well.

maximo80

  • Newbie
  • *
  • Posts: 17
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #4 on: February 11, 2016, 03:20:58 pm »
hi Werner,
I have the same behaviour, everything registered with more than one oak(only 1 powered) but when it is flashed
I go to my oak and the sketch does not work.

Thanks for the answers.

werner

  • Newbie
  • *
  • Posts: 37
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #5 on: February 11, 2016, 09:56:17 pm »
Hi @Kiirby.   At least I know the answers to these two questions now

Quote
1.  How long does it typically take after you see the "Device flashing started successfully" message, until the sketch starts to run on the Oak?

About 2 minutes

Quote
2.  I registered several devices on the Particle cloud, which may all be powered up at the same time.  How do I control which one is programmed?

You have to run the Aod command line CLI to select which Oak to program.

Quote from http://digistump.com/wiki/oak/tutorials/arduino:

Quote
Download and run the OakCLI tool from here: https://github.com/digistump/OakCLI and run it (from any directory), enter your Particle login and select your device, then re-run the upload. You only have to do this once.
« Last Edit: February 11, 2016, 09:58:21 pm by werner »

darklotus

  • Newbie
  • *
  • Posts: 7
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #6 on: February 13, 2016, 07:12:34 pm »
If you keep an eye on https://dashboard.particle.io/user/logs
When you flash a sketch you should see output like

spark/flash/status started
And then Anywhere between 1-10 minutes later you should see

spark/flash/status success
or
spark/flash/status failed.


werner

  • Newbie
  • *
  • Posts: 37
Re: How do I know when my Arduino sketch uploaded successfully?
« Reply #7 on: February 13, 2016, 11:42:07 pm »
Thanks for the tip.    But for some or other reason it does not work for me, even though my app actually program.     All I ever see there is a message like this:

Code: [Select]
Waiting for events...
Send some events using Spark.publish() in your firmware.
Visit the docs to learn more about publishing events.

But I now always print something out on the serial port so I can at least see immediately when the app uploads.  (Of course this only works if the Oak is connected to the same PC you are monitoring from?)