# Multiple software timers, how many?, third timer not triggering

**URL:** <https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449>\
**Category:** Firmware\
**Created:** [February 21, 2017, 5:47pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449 "2017-02-21T17:47:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 5:47pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/1 "2017-02-21T17:47:28Z")

</div>

Using Particle Electron 0.4.8-rc.6

Output indicated that timer03 never gets triggered.  
If I change the timer.start() order it appears only the  
first two timers are activated.

Are only 2 timers allowed?  
Also changing the time delay does not appear to make a difference.

As per another help thread SYSTEM\_THREAD(ENABLED); makes no  
difference.

```cpp
// THIS IS MY CODE

Timer timer01(1100, doTimer01); // 1.2 seconds
Timer timer02(3600, doTimer02); // 3.6 seconds
Timer timer03(5400, doTimer03); // 5.4 seconds

void setup() {
    Serial.begin(9600);
    delay(5000);
    Serial.printlnf("System version: %s", System.version().c_str());
    timer01.start();
    timer02.start();
    timer03.start();
}

void loop() {
    // do nothing
}

void doTimer01() {
    Serial.println("Timer 01");
}

void doTimer02() {
    Serial.println("Timer 02");
}

void doTimer03() {
    Serial.println("Timer 03");
}

```

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 5:56pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/2 "2017-02-21T17:56:00Z")

</div>

I don’t think that we will be going to deep into outdated system versions.  
0.6.0 (soon to come 0.6.1) is the current stable (not Release Candidate) version and I’d suggest you’d update the system version to a version that had a boatload of bug fixes done over time.

BTW, AFAIK you can have [up to 10 Software Timers](https://docs.particle.io/reference/firmware/photon/#software-timers), but you need to consider that they are all running on the same thread.

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 6:54pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/3 "2017-02-21T18:54:04Z")

</div>

Ok so I need to Update the firmware... so I run...

> particle update  
> It updates but i still end up with the same version! 0.4.8-rc.6  
> How do I update to 0.6.0 please?

The docs state update , updates to the latest version!  
I found 0.6.1 here...

> **[Releases · particle-iot/device-os](https://github.com/particle-iot/device-os/releases)**
>
> Device OS (Firmware) for Particle Devices. Contribute to particle-iot/device-os development by creating an account on GitHub.

But where is 0.6.0 ?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 7:18pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/4 "2017-02-21T19:18:19Z")

</div>

You need the most recent CLI (currently 1.19.4).  
Also you need to re-target your application firmware to 0.6.0.

Can you post the output of

```nohighlight
particle serial inspect

```

_(in Listening Mode)_

0.6.0 can be found here

> **[particle-iot/firmware](https://github.com/particle-iot/firmware/releases/tag/v0.6.0)**
>
> firmware - Firmware for Particle Devices

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 7:41pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/5 "2017-02-21T19:41:13Z")

</div>

Ok I managed to update over USB  
Result was Flash Success for both parts but with warning  
Invalid DFU suffix signature

I now can’t connect over USB and the D7 LED is lit blue but the mode light is not flashing for any known mode!

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 7:48pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/6 "2017-02-21T19:48:48Z")

</div>

> [@BrianMoreau](#):
>
> Invalid DFU suffix signature

This is just an ignorable warning, but the dim D7 LED is not good.  
This usually happening when there was a power issue during update or a brownout condition.

Can you still enter DFU or Safe Mode?

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 8:06pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/7 "2017-02-21T20:06:24Z")

</div>

Ok first time was from CLI using  
particle flash --usb system-part1-0.6.0-electron.bin  
particle flash --usb system-part2-0.6.0-electron.bin

second try was using DFU  
dfu-util -d 2b04:d00a -a 0 -s 0x8020000 -D system-part1-0.6.0-electron.bin  
dfu-util -d 2b04:d00a -a 0 -s 0x8040000 -D system-part2-0.6.0-electron.bin

Result was…  
File downloaded successfully

Still got the D7 LED on (very dim) no mode LED

Unable to put into safe mode, mode LED is magenta but not flashing.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 8:17pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/8 "2017-02-21T20:17:40Z")

</div>

How about DFU Mode and

```nohighlight
particle flash --usb tinker

```

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 8:27pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/9 "2017-02-21T20:27:29Z")

</div>

I did particle update so now I’m back where I started with 0.4.8  
Maybe the file was corroupt or as you suggest a power issue.  
Ill try again when I calm down.  
Thoughts iI had bricked it ☹

Much thanks for your fast help ScruffR  
Realise this is not quite on original topic now and is more a firmware update subject.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 8:44pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/10 "2017-02-21T20:44:16Z")

</div>

Can you check

```nohighlight
particle --version

```

BTW, the 0.6.0 firmware for the Electron consists of **_three_** parts and when doing it manually, you should add an intermediate 0.5.3 update.

You will need this too  
[https://github.com/spark/firmware/releases/download/v0.6.0/system-part3-0.6.0-electron.bin](https://github.com/spark/firmware/releases/download/v0.6.0/system-part3-0.6.0-electron.bin)

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 8:48pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/11 "2017-02-21T20:48:09Z")

</div>

Yes I am on that road now…  
Version CLI 1.11.0

I attempt npm update -g particle-cli@v1.18.0 but it appears to do nothing after a short pause.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 8:48pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/12 "2017-02-21T20:48:49Z")

</div>

As I said earlier

> [@ScruffR](#):
>
> You need the most recent CLI (currently 1.19.4).

You either only do

```plaintext
npm update -g particle-cli

```

to get the most recent version or you first

```plaintext
npm uninstall -g particle-cli

```

and then reinstall

```plaintext
npm install -g particle-cli

```

or when you're on Windows, use the installer.

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 9:28pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/13 "2017-02-21T21:28:33Z")

</div>

Ok I did npm update -g particle-cli  
and got…  
particle – version  
1.19.4

Since documents state…  
If you use DFU over USB, you can update to v0.6.0 directly, but make sure you have installed v1.18.0 of the CLI first.

I downloaded parts 1, 2 and 3 from

> **[particle-iot/firmware](https://github.com/particle-iot/firmware/releases/tag/v0.6.0)**
>
> firmware - Firmware for Particle Devices

then ran  
particle flash --usb system-part1-0.6.0-electron.bin  
particle flash --usb system-part2-0.6.0-electron.bin  
particle flash --usb system-part3-0.6.0-electron.bin  
Got flash success for each part

Now got D7 led lit again and unable to enter DFU mode!  
Mode light will not come on for any combination of mode / reset presses

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 21, 2017, 10:00pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/14 "2017-02-21T22:00:34Z")

</div>

I guess it’s BRICKED since I am unable to access it in DFU or OTA or change mode.  
After uploading was I supposed to press reset? as that’s what I did I think!

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [February 21, 2017, 10:26pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/15 "2017-02-21T22:26:25Z")

</div>

Your device is not bricked, it is just not running any useful firmware if the D7 LED is on dimly and it doesn’t respond. If you have JTAG programmer or programmer shield you can fix it for sure. The ST Micro JTAG programmers can apparently be found on eBay for under $10. Here is a link to programmer shield:

> **[Programmer Shield](https://store.particle.io/products/prog-shield)**
>
> The new and improved Programmer Shield is essentially a USB-JTAG converter that gives advanced users complete access to the Photon's memory space. It supports o

If you have another Particle device, you may be able to use it as JTAG programmer and fix it but that has been running about 50/50.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [February 22, 2017, 12:02am UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/16 "2017-02-22T00:02:03Z")

</div>

Are you able to place the device in DFU mode?

@BDub, somehow the user got an electron bricked with the firmware upgrade.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 22, 2017, 6:48am UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/17 "2017-02-22T06:48:24Z")

</div>

Can you also try

```auto
particle flash --usb tinker

```

again?  
This should usually be done after a modular update (`particle update` wouldn't need that AFAIK).

> [@BrianMoreau](#):
>
> If you use DFU over USB, you can update to v0.6.0 directly, but make sure you have installed v1.18.0 of the CLI first.

This is why I usually write something like: _"... CLI vX.Y.Z (or later) ..."_ or _"... use the latest version (currently vX.Y.Z) ..."_

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [February 22, 2017, 3:13pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/18 "2017-02-22T15:13:48Z")

</div>

> [@BrianMoreau](#):
>
> Since documents state....If you use DFU over USB, you can update to v0.6.0 directly, but make sure you have installed v1.18.0 of the CLI first.

> [@ScruffR](#):
>
> This is why I usually write something like: "... CLI vX.Y.Z (or later) ..." or "... use the latest version (currently vX.Y.Z) ..."

It's stated this way to ensure if you want 0.6.0, you will get 0.6.0. Updating to the latest CLI may be the latest version and won't necessarily be 0.6.0 anymore. It just so happens that the latest CLI does also still contain 0.6.0 firmware. So either will work, but you should always be able to follow the documentation and it be correct.

> [@BrianMoreau](#):
>
> I guess it's BRICKED since I am unable to access it in DFU or OTA or change mode.After uploading was I supposed to press reset? as that's what I did I think!

If you updated firmware via `particle flash --usb` for system parts, you would have to press reset after the firmware transfer completed. The RGB LED would have still been flashing yellow. If you have the correct CLI version, you can also just run `particle update` and it will flash all 3 images for you (for 0.6.0 electron) and reset the device for you after it completes.

Try to remove ALL power sources for a few minutes, and connect just the USB while holding the MODE button down. Does the RGB flash magenta, then yellow again?

If not, please contact [https://support.particle.io](https://support.particle.io) about this latest issue and reference this thread.

Can you remember exactly the point in time when the unit was working, vs. not. Was it transferring via DFU, completed transfer, still flashing yellow, then you pressed RESET and immediately after D7 was dimly lit for good? Did you have the battery plugged in at that time and was it charging or fully charged? Good USB power source? We might not be able to determine exactly what went wrong here but I'd like to ask for as much detail as you can provide to help us solve [this issue](https://community.particle.io/t/bug-bounty-electron-not-booting-after-battery-discharges-completely/25043).

---

<div class="post-metadata">

**Author:** ![BrianMoreau](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BrianMoreau](https://community.particle.io/u/BrianMoreau)\
**Post date:** [February 22, 2017, 8:59pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/19 "2017-02-22T20:59:52Z")

</div>

Ok just tried it again…  
USB power applied while holding down MODE, no battery connected.  
The RGB LED failed to light any colour, just the dim D7 on and flashing red battery led.

I remember after flashing via USB the RGB LED was flashing or steady yellow.  
The CLI reported that all 3 code blocks had flash success.  
Then I am sure I pressed reset and that is when the D7 LED came on.  
The battery was connected and charging but I am also quite certain it was nowhere near flat since battery and USB were connected for several hours while attempting to update the CLI and Firmware.  
I do have a GPS sensor and XYZ sensor connected to the 3.3V pin  
The GPS consumes 40mA and the XYZ about 400uA.  
I had an LED connected via 220 Ohm R from Pin D1 to GND  
GPS Serial out to Pin USART1-RX  
XYZ OUT to Pins A0, A1 and A2

I am using WindowsXP and DOS Command Window to run the CLI  
Still unable to put into DFU Mode.  
Now looking at JTAG programmers on eBay to see what damage I can do with that!

Thank you all for your help.

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [February 22, 2017, 11:48pm UTC](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449/20 "2017-02-22T23:48:32Z")

</div>

Thanks for the extra details @BrianMoreau! You’ll definitely be able to restore things with a JTAG tool. I recommend these (search “ST-Link” on eBay or Amazon): [[eBay]](http://www.ebay.com/itm/ST-Link-V2-Programming-Unit-mini-STM8-STM32-Emulator-Downloader-M89-Top-ST-/172256542811?hash=item281b4a405b:g:vIgAAOSwgY9XcoCG) [[Amazon]](http://a.co/dYLsgSE) I purchased from the seller on eBay and they worked great. Amazon is a faster option if you have a Prime account, for not that much more.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/e/ed4546f785126aa1dd0bdd8da174a6bb542d3a01.jpg)

### Restore instructions:

**Windows**

1. Purchase something like this (search “ST-Link” on eBay or Amazon): [[eBay]](http://www.ebay.com/itm/ST-Link-V2-Programming-Unit-mini-STM8-STM32-Emulator-Downloader-M89-Top-ST-/172256542811?hash=item281b4a405b:g:vIgAAOSwgY9XcoCG) [[Amazon]](http://a.co/dYLsgSE)
2. Download this tool: [STSW-LINK004](http://www.st.com/web/en/catalog/tools/PF258168) and install
3. Download this driver: [STSW-LINK009](http://www.st.com/web/en/catalog/tools/PF260219), unzip into a folder. Run the `stlink_winusb_install.bat` file by double-clicking on it.
4. Download this firmware file [combined-v0.4.8-rc.6-electron](https://github.com/spark/firmware/releases/download/v0.4.8-rc.6/combined-v0.4.8-rc.6-electron.bin) and save to a known location.
5. Plug in your mini ST-Link. The driver install should succeed.
6. Connect the mini ST-Link to your Electron as shown in [this diagram](http://imgur.com/1Iw202n)
7. Plug your Electron into USB power using a USB cable.
8. Put your Electron into [DFU Mode](https://docs.particle.io/guide/getting-started/modes/electron/#dfu-mode-device-firmware-upgrade-). Not a required step but you may need to press and release the reset button on the device just as you start to perform any operation on the chip.
9. Open the STM32 ST-Link UTILITY application in Windows
10. Open the TARGET menu then click SETTINGS, make sure the PORT is set to SWD mode.
11. Open the TARGET menu and click CONNECT. You should be connected to the target. (the data window should populate)
12. Now open the TARGET menu, then OPTION BYTES. Un-select all sectors (there is a button at the bottom to do this), and APPLY. This will un-writeprotect your flash.
13. Now do a full erase. Open the TARGET menu and click ERASE CHIP
14. Once complete reprogram the device. Open the TARGET menu and click PROGRAM. Select the bootloader file downloaded earlier (`combined-v0.4.8-rc.6-electron.bin`). Make sure, at the next popup the address is 0x08000000 (the default address). Program the device
15. Once complete the unit should eventually start blinking blue. Open up a command terminal and run the command `particle identify`. Make a note of the returned Device ID (you will need it later). You will need the [Particle CLI](https://github.com/spark/particle-cli) installed to do this.
16. Run the command `particle setup wifi` and follow the onscreen prompts. Once complete the unit will continue to blink blue. This is a known bug. Disconnect the ST-Link and then disconnect the USB cable from the Electron. Give it a moment then plug the USB cable back into the Electron (do not re-connect the ST-Link).
17. The unit should boot up. Eventually, you will get a cyan flashing with red blip due to handshake error. Run this CLI command to fix the keys: `particle keys doctor YOUR_DEVICE_ID`

**Mac / Linux**

1. Purchase something like this (search “ST-Link” on eBay or Amazon): [[eBay]](http://www.ebay.com/itm/ST-Link-V2-Programming-Unit-mini-STM8-STM32-Emulator-Downloader-M89-Top-ST-/172256542811?hash=item281b4a405b:g:vIgAAOSwgY9XcoCG) [[Amazon]](http://a.co/dYLsgSE)
2. (if on a Mac) Install the st-flash utility using the [these commands](https://gist.github.com/harrisonhjones/0319c8179fa24f551542) (if on a Linux system) follow the steps in [this article](https://startingelectronics.org/tutorials/STM32-microcontrollers/programming-STM32-flash-in-Linux/)
3. Download this firmware file [combined-v0.4.8-rc.6-electron](https://github.com/spark/firmware/releases/download/v0.4.8-rc.6/combined-v0.4.8-rc.6-electron.bin) and save to a known location.
4. Plug in your mini ST-Link.
5. Connect the mini ST-Link to your Electron as shown in [this diagram](http://imgur.com/1Iw202n)
6. Plug your Electron into USB power using a USB cable.
7. Put your Electron into [DFU Mode](https://docs.particle.io/guide/getting-started/modes/electron/#dfu-mode-device-firmware-upgrade-). Not a required step but you may need to press and release the reset button on the device just as you start to perform any operation on the chip.
8. Open up a terminal and navigate to folder with the bootloader file in it
9. Run this command `st-flash write v1 combined-v0.4.8-rc.6-electron.bin 0x08000000`. If you get an error message, then try using sudo in front of the above command or try rebooting the system.
10. Once complete the unit should eventually start blinking blue. Run the command `particle identify`. Make a note of the returned Device ID (you will need it later). You will need the [Particle CLI](https://github.com/spark/particle-cli) installed to do this.
11. Run the command `particle setup wifi` and follow the onscreen prompts. Once complete the unit will continue to blink blue. This is a known bug. Disconnect the ST-Link and then disconnect the USB cable from the Electron. Give it a moment then plug the USB cable back into the Electron (do not re-connect the ST-Link).
12. The unit should boot up. Eventually, you will get a cyan flashing with red blip due to handshake error. Run this CLI command to fix the keys: `particle keys doctor YOUR_DEVICE_ID`

[Next page](https://community.particle.io/t/multiple-software-timers-how-many-third-timer-not-triggering/29449.md?page=2)
