How to run a newly flashed program?

This must be the stupidest question in the forum.

I can flash a program both OTA and over USB. Here are the commands and responses:

-------------------------------
C:\Dev Projects\Particle> particle flash --serial blinky.ino
! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: blinky.ino

Flash success!

-------------------------------
C:\Dev Projects\Particle> particle flash Sky-Electron-1 "firmware 3sec.bin"
Including:
    firmware 3sec.bin

! Flashing firmware Over The Air (OTA) uses cellular data, which may cause you to incur usage charges.
! This flash is estimated to use at least 0.107 MB, but may use more depending on network conditions.

! Please type 0.107 below to confirm you wish to proceed with the OTA flash.
! Any other input will cancel.
? Confirm the amount of data usage in MB: 0.107
attempting to flash firmware to your device Sky-Electron-1
Flash device OK:  Update started
-------------------------------

After the flashing nothing happens!!! I assume there must be a way to run the program that I just flashed. Is there a command or procedure to execute the program?

By the way, the led connected to D6 can be switched on and off manually by sending the digitalwrite command. So the hardware is working. For example:


C:\Dev Projects\Particle> particle call Sky-Electron-1 digitalwrite D6,HIGH
1
…\Dev Projects\Particle> particle call Sky-Electron-1 digitalwrite D6,LOW
1

Hope just by learning this one simple trivial step will open the new universe for me. :slight_smile:
I could not get this step in any of the reference documents. :frowning:

Thanks

Sky Basu

If that’s the case, then Tinker (the original demo), is still running on your device, and the update didn’t get through correctly. You might want to try updating your Electron first by using particle update in DFU mode. After that, you can flash your code locally (to save data, as well as being a lot quicker) by using particle flash --usb firmware.bin (substitute actual .bin file name).

Let us know if that helped?

This can’t work since flash --serial directly sends the file as is to the device - irrespective whether this is a valid binary (which your .ino most likely isn’t) or not.

On the other hand for OTA build’n’flash you’d have to provide the source files or a single binary (but without blanks - these are bad habits).

But I much prefer seperate steps

particle compile electron blinky.ino --saveTo firmware3sec.bin
particle flash --usb firmware3sec.bin
## or if needed (less verbose in case of errors)
particle flash --serial firmware3sec.bin
1 Like

Thanks, Moors7 and ScruffR for your guidances.

Now I have done some additional experiments and here are the results. The bottom line, it’s still not working.

06/23/2017 10:50:41 C:\WINDOWS\system32> particle call Sky-Electron-1 digitalwrite D6,HIGH
1
06/23/2017 10:51:33 C:\WINDOWS\system32> particle call Sky-Electron-1 digitalwrite D6,LOW
1

Which means Tinker is working OTA

06/23/2017 11:49:14 C:\particle> particle call --serial digitalwrite D6,HIGH
Function call failed Permission Denied

Which means Tinker is NOT working over Serial (USB).
Q1: Why Tinker is not working over Serial?

06/23/2017 11:08:22 C:\particle> particle flash Sky-Electron-1 blinky-2.ino
Including:
blinky-2.ino
attempting to compile firmware
downloading binary from: /v1/binaries/594d5949a0cc521d4e0c09a7
saving to: C:\Users\skyba\AppData\Local\Temp\117523-17864-10swjxj.ie9v9jatt9.bin
Memory use:
   text    data     bss     dec     hex filename
   5276      16    1528    6820    1aa4 /workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: C:\Users\skyba\AppData\Local\Temp\117523-17864-10swjxj.ie9v9jatt9.bin

! Flashing firmware Over The Air (OTA) uses cellular data, which may cause you to incur usage charges.
! This flash is estimated to use at least 0.006 MB, but may use more depending on network conditions.

! Please type 0.006 below to confirm you wish to proceed with the OTA flash.
! Any other input will cancel.
? Confirm the amount of data usage in MB: 0.006
attempting to flash firmware to your device Sky-Electron-1
Flash device OK:  Update started

As we can see the final status is Flash device OK: Update started
Also the the status LED changed to rapidly blinking purple which I understand means it is updating the Firmware.

Now let’s try to flash a .bin file over serial

06/23/2017 12:36:00 C:\particle> particle flash --serial firmware3sec.bin
! PROTIP: Hold the SETUP button on your device until it blinks blue!
? Press ENTER when your device is blinking BLUE
sending file: firmware3sec.bin

Flash success!

Here also the status LED went through the rapid purple mode to show that it is updating the firmware with the Flash success! message.

By the way, my device has Firmware V 0.4.8 and I am compiling to .bin using the same version.


I have also installed (at least that’s what I think) the DFU Util. Here is the result if I run it:

06/23/2017 11:46:49 C:\particle> .\dfu-util.exe --list
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

I was expecting it will give me some ID for the attached Electron device.

Q2. My original question is after flashing the firmware are we supposed to see the program start running immediately? Or there is a step to Run it?

Q3. Any suggestion to run it either using OTA or --serial. I am not sure whether DFU util is working or how to use it. At least it shows some header info, runs help but could not us it with some useful way.

Thank You

Sky

I assume that’s an external LED, since the onboard LED is on D7?

Because it’s not intended to work with Serial ;)[quote=“skybasu, post:4, topic:33976”]
particle flash Sky-Electron-1 blinky-2.ino
[/quote]

If I’m not mistaken, that will default to the latest version of user firmware, requiring the latest system firmware. As you’ve mentioned, you’re still on the default 0.4.8 which causes the device to go into Safe Mode, hence the Magenta.[quote=“skybasu, post:4, topic:33976”]
particle flash --serial firmware3sec.bin
[/quote]

Where did you get that .bin file from?

Unlike a computer, a microcontroller only has one thing running on it, your program (simplified). It’ll run that automatically, and no manual intervention should be required.

If you’ve added DFU util to your path, you should be able to use particle update and particle flash --usb firmware.bin while it’s in DFU mode.

Thanks, Moors7.

Yes. It is external. But I have tried with built-in D7 also.

Does it mean I should try to upgrade the Firmware version to 0.6.2? Without using DFU what will be the best way to update it?[quote=“Moors7, post:5, topic:33976”]
Where did you get that .bin file from?
[/quote]

Compiled online using the Web IDE cloud icon next to the file name ‘Compile and Download Binary’.

I have installed DFU and put all the DFU files in the same working folder. Here is what happens when I try either “particle update” or “particle flash --usb firmware.bin”

06/23/2017 14:06:00 C:\particle> particle flash --usb firmware.bin

!!! I was unable to detect any devices in DFU mode…

Your device will blink yellow when in DFU mode.
If your device is not blinking yellow, please:

  1. Press and hold both the RESET/RST and MODE/SETUP buttons simultaneously.
  1. Release only the RESET/RST button while continuing to hold the MODE/SETUP button.
  1. Release the MODE/SETUP button once the device begins to blink yellow.

Error writing firmware…No DFU device found

Or

06/23/2017 14:06:00 C:\particle> particle flash --usb firmware.bin

!!! I was unable to detect any devices in DFU mode…

Your device will blink yellow when in DFU mode.
If your device is not blinking yellow, please:

  1. Press and hold both the RESET/RST and MODE/SETUP buttons simultaneously.
  1. Release only the RESET/RST button while continuing to hold the MODE/SETUP button.
  1. Release the MODE/SETUP button once the device begins to blink yellow.

Error writing firmware…No DFU device found

The device in DFU mode i.e. as per my understanding it’s blinking yellow. Here is the photo. Please note the D7 LED is also solid (non-blinking) on.

You need the DFU drivers installed too

1 Like

Thanks ScruffR for the instructions on installing the DFU-Driver.

IT NOW WORKS!!! :smile:

I think what worked are:

  • Changing the USB driver for Electron
  • After DFU-uti could recognize my device, updating the version from 0.4.8 to 0.6.2

Thank you again.

3 Likes