Blinking Green Question

Hey all,

Related question to this one. I just want to get the Hardware Serial Number of an Electron 3G, without activating its SIM card (but having installed its SIM card, and having connected the antenna nonetheless)

The Electron I’m working with at this moment, is fresh out of the box. I’m using particle cli and po-util, and I just now did po-util.sh update followed by po-util.sh upgrade and all went fine so far as I can tell. I then compiled and loaded the following sketch by executing particle compile electron && po-util.sh dfu-open && particle flash --usb /dev/ttyACM0:

#include <Particle.h>

SYSTEM_MODE(MANUAL);

void setup() {
    Serial.begin(115200);
    Serial.println("Hello World");
    pinMode(D0, INPUT_PULLUP);
}

// sample the sensor once a second
unsigned long sample_previousMillis = 0;
const long sample_interval = 1000;

void loop() {
    // get the current time
    unsigned long currentMillis = millis();
    String deviceID = System.deviceID(); // we'll need this in the message we publish

    if (currentMillis - sample_previousMillis >= sample_interval) {
      sample_previousMillis = currentMillis;
      Serial.println(deviceID);
    }
}

… and again all seemed to go fine there. Now my impression was because of SYSTEM_MODE(MANUAL); my sketch should just start running without concern for its networking state. However, I get no output from a serial terminal (e.g. miniterm.py /dev/ttyACM0 115200), and the green LED is continuously blinking.

What might I be doing wrong here? Or are my expectations flawed in some fundamental way. I’m going to go to lunch and leave the unit powered on while I’m away. Maybe it will snap out of it?

Just a quick follow up, still blinking green after a couple of hours… random side note, @nrobinson2000 how do I know what version of system firmware po-util is putting on my electron when I tell it to do po-util.sh electron upgrade?

In the config file ~/.po you will find a branch line.

Also, particle serial identify should tell you the exact version of the firmware on the electron.

both particle serial identify and (per the docs) particle identify /dev/ttyACM0 give:

! serial: Serial timed out

Docs also say:

helps get your device id via usb and serial
make sure your device is connected and blinking blue

… and my electrons are flashing green, so that probably explains it.

Is the electron in listening mode?

Does something like this still cause green blinking?

#include <Particle.h>

SYSTEM_MODE(MANUAL);

void setup() {
}

void loop() {
}

ya blinking green still after flashing the “null sketch”

$ ./load.sh 
+ rm electron_firmware_1488486154459.bin
+ particle compile electron .

Compiling code for electron

Including:
    /home/vic/git/get_electron_serial/get_electron_serial.ino
attempting to compile firmware 
downloading binary from: /v1/binaries/58b87f2d2d8dfe75586cfbe3
saving to: electron_firmware_1488486183871.bin
Memory use: 
   text	   data	    bss	    dec	    hex	filename
   4540	      8	   1504	   6052	   17a4	
Compile succeeded.
Saved firmware to: /home/vic/git/get_electron_serial/electron_firmware_1488486183871.bin
++ ls electron_firmware_1488486183871.bin
+ x=electron_firmware_1488486183871.bin
+ /home/vic/po-util.sh dfu-open
+ sleep 1
+ particle flash --usb electron_firmware_1488486183871.bin
Found DFU device 2b04:d00a
checking file electron_firmware_1488486183871.bin
spawning dfu-util -d 2b04:d00a -a 0 -i 0 -s 0x08080000:leave -D electron_firmware_1488486183871.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 2b04:d00a
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x08080000, size = 4548
Download	[=========================] 100%         4548 bytes
Download done.
File downloaded successfully

What if you build using po-util?

First make sure that you update the firmware repository:

cd ~/github/firmware && git pull && cd -

You might need to also refresh the system firmware on the electron:

po electron upgrade

Then try building and flashing with po-util:

po electron flash

FYI, I’m reinstalling po-util now…

@nrobinson2000 so I did:

rm -rf  ~/github
rm -rf ~/.po
git clone https://github.com/nrobinson2000/po-util
cd po-util
./po-util.sh install ; . ~/.bashrc

… at the tail of it I get

Installing particle-cli...
sudo: npm: command not found
Installing udev rule (requires sudo) ...
Installing po manpage...
Adding vic to plugdev group...

… then when I go to do po electron upgrade I get:

Switched to a new branch 'release/stable'
Connect your device and put into DFU mode. Press [ENTER] to continue...
sed: can't read /firmware/build/module-defaults.mk: No such file or directory
mv: cannot move 'temp.particle' to '/firmware/build/module-defaults.mk': No such file or directory
/home/vic/po-util.sh: line 1667: cd: /firmware/modules: No such file or directory

… things have gone from bad to worse …

… currently running npm install -g particle-cli manually

… starting over from the top, and also doing rm -rf ~/bin/gcc-arm-embedded for good measure.

@nrobinson2000 it doesn’t look to me like anything sets BASE_FIRMWARE in po-util.sh?

If I do export BASE_FIRMWARE=/home/vic/github/particle then po electron upgrade doesn’t bail out and does what it’s supposed to.

By the way, I in no way mean to sound disparaging about po-util, it is awesome!

I actually have been working on some major changes to po-util today, so everything might not be fully working yet.

No sweat, let me know when you think it’s ready and I’ll be happy to kick the tires again :slight_smile:

po-util should be working now. I added support for Redbear Duo today with the help of @geert, and I made some structural changes and cleaned it up a bit.

Feel free to reinstall po-util and try again.

1 Like

FYI, still getting the following toward the end of the install process with a fresh attempt this morning:

Installing particle-cli...
sudo: npm: command not found

BASE_FIRMWARE problem is no longer an issue though :+1:

It sounds like nvm is messing with node and npm, and your path to node is not found by po-util.

What is the full path of npm when you do:

which npm

Yup, that’s almost certainly the root cause, which npm returns:

/home/vic/.nvm/versions/node/v6.10.0/bin/npm

… but it’s something to consider, a lot of people use nvm (everyone should ;-))

I don’t and don’t need to, but I will try to add nvm support.


Where is the file that amends your path to add that version of npm? I could just source that file in po-util to let it know what node and npm to use.


I added the following to po-util:

#Import nvm if installed
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

Reinstall po-util. This should hopefully work.

@nrobinson2000 I just got this feedback on a support email sidebar. The default system firmware version changed yesterday to 0.6.1… not sure how / if po-util tracks that, but I think it might be related to my woes at the moment? As you were trying to tell me earlier, I probably shouldn’t be mixing po-util and particle compile…

, still getting sudo: npm: command not found with a fresh checkout from git. FYI, I think nvm actually manipulates $PATH…

if I say nvm use 6.9.1 and then echo $PATH | grep node, then I say nvm use 6.10.0 and echo $PATH | grep node, you can see $PATH changes each time.